From 950440f9c73746867454e20f0e5c3a38297728b9 Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 16 Jun 2022 09:28:00 -0400 Subject: added unviewed shared dashboards to dashboard view --- src/client/util/CurrentUserUtils.ts | 1 + src/client/views/DashboardView.tsx | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'src') diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index c0318e86b..3085e7e72 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -1286,6 +1286,7 @@ export class CurrentUserUtils { public static get ActivePresentation() { return Cast(Doc.UserDoc().activePresentation, Doc, null); } public static get MyRecentlyClosed() { return Cast(Doc.UserDoc().myRecentlyClosedDocs, Doc, null); } public static get MyDashboards() { return Cast(Doc.UserDoc().myDashboards, Doc, null); } + public static get MySharedDocs() { return Cast(Doc.UserDoc().mySharedDocs, Doc, null); } public static get EmptyPane() { return Cast(Doc.UserDoc().emptyPane, Doc, null); } public static get OverlayDocs() { return DocListCast((Doc.UserDoc().myOverlayDocs as Doc)?.data); } public static set SelectedTool(tool: InkTool) { Doc.UserDoc().activeInkTool = tool; } diff --git a/src/client/views/DashboardView.tsx b/src/client/views/DashboardView.tsx index 9f497dcbf..a105e0790 100644 --- a/src/client/views/DashboardView.tsx +++ b/src/client/views/DashboardView.tsx @@ -15,6 +15,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ContextMenuProps } from "./ContextMenuItem"; import { simulateMouseClick } from "../../Utils"; import { SharingManager } from "../util/SharingManager"; +import { CollectionViewType } from "./collections/CollectionView"; enum DashboardGroup { MyDashboards, SharedDashboards @@ -54,6 +55,11 @@ export class DashboardView extends React.Component { } } + getSharedDashboards = () => { + const sharedDashs = DocListCast(CurrentUserUtils.MySharedDocs.data).filter(doc => doc._viewType === CollectionViewType.Docking); + return sharedDashs.filter((dashboard) => !DocListCast(CurrentUserUtils.MySharedDocs.viewed).includes(dashboard)) + } + createNewDashboard = async (name: string) => { const batch = UndoManager.StartBatch("new dash"); await CurrentUserUtils.createNewDashboard(Doc.UserDoc(), undefined, name); @@ -129,6 +135,31 @@ export class DashboardView extends React.Component { })} + + +
UNVIEWED SHARED DASHBOARDS
+
+ {this.getSharedDashboards().map((dashboard) => { + const href = ImageCast((dashboard.thumb as Doc)?.data)?.url.href; + return
{this.onContextMenu(dashboard, e)}} + onClick={e => this.clickDashboard(e, dashboard)}> + +
+
{StrCast(dashboard.title)}
+
{ + this._downX = e.clientX; + this._downY = e.clientY; + }} + onClick={(e) => {this.onContextMenu(dashboard, e)}} + > + +
+
+ +
+ + })}
-- cgit v1.2.3-70-g09d2