diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/DashboardView.tsx | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/src/client/views/DashboardView.tsx b/src/client/views/DashboardView.tsx index a105e0790..b5dfab237 100644 --- a/src/client/views/DashboardView.tsx +++ b/src/client/views/DashboardView.tsx @@ -41,6 +41,7 @@ export class DashboardView extends React.Component { clickDashboard = async (e: React.MouseEvent, dashboard: Doc) => { if (e.detail === 2) { + Doc.AddDocToList(CurrentUserUtils.MySharedDocs, "viewed", dashboard) Doc.UserDoc().activeDashboard = dashboard; Doc.UserDoc().activePage = "dashboard"; } @@ -51,10 +52,16 @@ export class DashboardView extends React.Component { if (this.selectedDashboardGroup === DashboardGroup.MyDashboards) { return allDashboards.filter((dashboard) => Doc.GetProto(dashboard).author === Doc.CurrentUserEmail) } else { - return allDashboards.filter((dashboard) => Doc.GetProto(dashboard).author !== Doc.CurrentUserEmail) + const sharedDashboards = DocListCast(CurrentUserUtils.MySharedDocs.data).filter(doc => doc._viewType === CollectionViewType.Docking); + return sharedDashboards } } + isUnviewedSharedDashboard = (dashboard: Doc): boolean => { + // const sharedDashboards = DocListCast(CurrentUserUtils.MySharedDocs.data).filter(doc => doc._viewType === CollectionViewType.Docking); + return !DocListCast(CurrentUserUtils.MySharedDocs.viewed).includes(dashboard) + } + getSharedDashboards = () => { const sharedDashs = DocListCast(CurrentUserUtils.MySharedDocs.data).filter(doc => doc._viewType === CollectionViewType.Docking); return sharedDashs.filter((dashboard) => !DocListCast(CurrentUserUtils.MySharedDocs.viewed).includes(dashboard)) @@ -122,6 +129,9 @@ export class DashboardView extends React.Component { <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="info"> <div className="title"> {StrCast(dashboard.title)} </div> + {this.selectedDashboardGroup === DashboardGroup.SharedDashboards && this.isUnviewedSharedDashboard(dashboard) ? + <div>unviewed</div> : <div></div> + } <div className="more" onPointerDown={e => { this._downX = e.clientX; this._downY = e.clientY; @@ -137,31 +147,6 @@ export class DashboardView extends React.Component { })} </div> - <div style={{display:"block"}} > UNVIEWED SHARED DASHBOARDS </div> - <div className="all-dashboards"> - {this.getSharedDashboards().map((dashboard) => { - const href = ImageCast((dashboard.thumb as Doc)?.data)?.url.href; - return <div className="dashboard-container" key={dashboard[Id]} - onContextMenu={(e) => {this.onContextMenu(dashboard, e)}} - 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="info"> - <div className="title"> {StrCast(dashboard.title)} </div> - <div className="more" onPointerDown={e => { - this._downX = e.clientX; - this._downY = e.clientY; - }} - onClick={(e) => {this.onContextMenu(dashboard, e)}} - > - <FontAwesomeIcon color="black" size="lg" icon="bars" /> - </div> - </div> - - </div> - - })} - - </div> </div> <MainViewModal contents={this.namingInterface} @@ -173,3 +158,8 @@ export class DashboardView extends React.Component { } } + +export function AddToList(MySharedDocs: Doc, arg1: string, dash: any) { + throw new Error("Function not implemented."); +} + |