From 140e2f643f97057ba9c89c502cff7843bd738cd6 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Thu, 9 Jun 2022 16:59:09 -0400
Subject: fixed issues with taking dashboard snapshots to update dashboard view

---
 src/client/views/DashboardView.tsx | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'src/client/views/DashboardView.tsx')

diff --git a/src/client/views/DashboardView.tsx b/src/client/views/DashboardView.tsx
index 5fd9b550d..3cfece970 100644
--- a/src/client/views/DashboardView.tsx
+++ b/src/client/views/DashboardView.tsx
@@ -1,4 +1,5 @@
 import { observable } from "mobx";
+import { extname } from 'path';
 import { observer } from "mobx-react";
 import * as React from 'react';
 import { Doc, DocListCast } from "../../fields/Doc";
@@ -33,13 +34,16 @@ export class DashboardView extends React.Component {
                         <div>All Dashboards</div>
                   </div>
                   <div className="all-dashboards">
-                        {myDashboards.map((dashboard) =>
-                              <div className="dashboard-container" key={dashboard[Id]} onClick={(e) => { this.clickDashboard(e, dashboard) }}>
-                                    <img src="https://media.istockphoto.com/photos/hot-air-balloons-flying-over-the-botan-canyon-in-turkey-picture-id1297349747?b=1&k=20&m=1297349747&s=170667a&w=0&h=oH31fJty_4xWl_JQ4OIQWZKP8C6ji9Mz7L4XmEnbqRU="></img>
+                        {myDashboards.map((dashboard) => {
+                              const url = ImageCast((dashboard.thumb as Doc)?.data)?.url;
+                              const ext = url ? extname(url.href):"";
+                              const href = url?.href.replace(ext, "_m"+ ext); // need to choose which resolution image to show.  options are _s, _m, _l, _o   (small/medium/large/original)
+                              return <div className="dashboard-container" key={dashboard[Id]} onClick={e => this.clickDashboard(e, dashboard)}>
+                                    <img src={href ?? "https://media.istockphoto.com/photos/hot-air-balloons-flying-over-the-botan-canyon-in-turkey-picture-id1297349747?b=1&k=20&m=1297349747&s=170667a&w=0&h=oH31fJty_4xWl_JQ4OIQWZKP8C6ji9Mz7L4XmEnbqRU="}></img>
                                     <div className="title"> {StrCast(dashboard.title)} </div>
                               </div>
 
-                        )}
+                        })}
                         {myDashboards.map((dashboard) => {
                               console.log(dashboard.thumb)
                         })}
-- 
cgit v1.2.3-70-g09d2

