From 43968431d3c94cea07f06421d29ac0f190c55cde Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 9 Jun 2022 17:25:55 -0400 Subject: added activePage field for choosing dash page layout. --- src/client/util/CurrentUserUtils.ts | 1 + src/client/views/DashboardView.tsx | 3 ++- src/client/views/MainView.tsx | 21 +++++++++++---------- src/client/views/topbar/TopBar.tsx | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index 3107650d9..3b1009532 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -1093,6 +1093,7 @@ export class CurrentUserUtils { Docs.newAccount = !(field instanceof Doc); await Docs.Prototypes.initialize(); const userDoc = Docs.newAccount ? new Doc(userDocumentId, true) : field as Doc; + Docs.newAccount &&(userDoc.activePage = "home"); const updated = this.updateUserDocument(Doc.SetUserDoc(userDoc), sharingDocumentId, linkDatabaseId); (await DocListCastAsync(Cast(Doc.UserDoc().myLinkDatabase, Doc, null)?.data))?.forEach(async link => { // make sure anchors are loaded to avoid incremental updates to computedFn's in LinkManager const a1 = await Cast(link?.anchor1, Doc, null); diff --git a/src/client/views/DashboardView.tsx b/src/client/views/DashboardView.tsx index 3cfece970..b08151c0f 100644 --- a/src/client/views/DashboardView.tsx +++ b/src/client/views/DashboardView.tsx @@ -22,7 +22,8 @@ export class DashboardView extends React.Component { clickDashboard = async (e: React.MouseEvent, dashboard: Doc) => { if (e.detail === 2) { - Doc.UserDoc().activeDashboard = dashboard + Doc.UserDoc().activeDashboard = dashboard; + Doc.UserDoc().activePage = "dashboard"; } } diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index ad041384c..5fd76c388 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -662,16 +662,17 @@ export class MainView extends React.Component { {DocumentLinksButton.LinkEditorDocView ? DocumentLinksButton.LinkEditorDocView = undefined)} docView={DocumentLinksButton.LinkEditorDocView} /> : (null)} {LinkDocPreview.LinkInfo ? : (null)} - {Doc.UserDoc().activeDashboard ? - <> -
- -
- - {this.mainDashboardArea} - - : - + {((page:string) => { + switch (page) { + case "dashboard": + default:return <> +
+ +
+ {this.mainDashboardArea} + ; + case "home": return ; + } })(StrCast(Doc.UserDoc().activePage)) } diff --git a/src/client/views/topbar/TopBar.tsx b/src/client/views/topbar/TopBar.tsx index 21ef807ff..258891099 100644 --- a/src/client/views/topbar/TopBar.tsx +++ b/src/client/views/topbar/TopBar.tsx @@ -21,7 +21,7 @@ import "./TopBar.scss"; @observer export class TopBar extends React.Component { navigateToHome = () => { - CurrentUserUtils.CaptureDashboardThumbnail()?.then(() => Doc.UserDoc().activeDashboard = undefined); + CurrentUserUtils.CaptureDashboardThumbnail()?.then(() => Doc.UserDoc().activePage = "home"); } render() { const myDashboards = DocListCast(CurrentUserUtils.MyDashboards.data); -- cgit v1.2.3-70-g09d2