diff options
author | bobzel <zzzman@gmail.com> | 2022-09-22 09:59:00 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-09-22 09:59:00 -0400 |
commit | 13a0c0c505edd4b00f9d7b5aed78237c4d23a3d1 (patch) | |
tree | 89979a0014c8a5eaa222fcf7c609ae888eeca14a /src | |
parent | d40a8e4506672f9d0ad505409f4b181d73762c28 (diff) |
remove overlaydocs when switching dashboards.
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/topbar/TopBar.tsx | 87 | ||||
-rw-r--r-- | src/fields/Doc.ts | 2 |
2 files changed, 7 insertions, 82 deletions
diff --git a/src/client/views/topbar/TopBar.tsx b/src/client/views/topbar/TopBar.tsx index 7bc7ba3ed..7e728306c 100644 --- a/src/client/views/topbar/TopBar.tsx +++ b/src/client/views/topbar/TopBar.tsx @@ -80,8 +80,6 @@ export class TopBar extends React.Component { * - Taking a snapshot of a dashboard */ @computed get topbarCenter() { - const myDashboards = DocListCast(Doc.MyDashboards.data); - const activeDashboard = Doc.ActiveDashboard; // const dashboardItems = myDashboards.map(board => { // const boardTitle = StrCast(board.title); // console.log(boardTitle); @@ -91,10 +89,10 @@ export class TopBar extends React.Component { // val: board, // }; // }); - return activeDashboard ? ( + return Doc.ActiveDashboard ? ( <div className="topbar-center"> <Button - text={StrCast(activeDashboard.title)} + text={StrCast(Doc.ActiveDashboard.title)} tooltip="Browsing mode for directly navigating to documents" fontSize={FontSize.SECONDARY} size={Size.SMALL} @@ -104,7 +102,7 @@ export class TopBar extends React.Component { borderRadius={5} hoverStyle="none" onClick={(e: React.MouseEvent) => { - const dashView = activeDashboard && DocumentManager.Instance.getDocumentView(activeDashboard); + const dashView = Doc.ActiveDashboard && DocumentManager.Instance.getDocumentView(Doc.ActiveDashboard); ContextMenu.Instance.addItem({ description: 'Open Dashboard View', event: this.navigateToHome, icon: 'edit' }); ContextMenu.Instance.addItem({ description: 'Snapshot Dashboard', @@ -119,9 +117,9 @@ export class TopBar extends React.Component { }} /> <Button - text={GetEffectiveAcl(Doc.GetProto(activeDashboard)) === AclAdmin ? 'Share' : 'View Original'} + text={GetEffectiveAcl(Doc.GetProto(Doc.ActiveDashboard)) === AclAdmin ? 'Share' : 'View Original'} onClick={() => { - SharingManager.Instance.open(undefined, activeDashboard); + SharingManager.Instance.open(undefined, Doc.ActiveDashboard); }} type="outline" fontSize={FontSize.SECONDARY} @@ -183,81 +181,6 @@ export class TopBar extends React.Component { ); } - // render() { - // const activeDashboard = Doc.ActiveDashboard; - // return ( - // //TODO:glr Add support for light / dark mode - // <div style={{ pointerEvents: 'all', background: Colors.DARK_GRAY, borderBottom: Borders.STANDARD }} className="topbar-container"> - // <div className="topbar-inner-container"> - // <div className="topbar-left"> - // {activeDashboard ? ( - // <> - // <div - // className="topbar-button-icon" - // onClick={e => { - // ContextMenu.Instance.addItem({ description: 'Logout', event: () => window.location.assign(Utils.prepend('/logout')), icon: 'edit' }); - // ContextMenu.Instance.displayMenu(e.clientX + 5, e.clientY + 10); - // }}> - // {Doc.CurrentUserEmail} - // </div> - // <div className="topbar-button-icon" onClick={this.navigateToHome}> - // <FontAwesomeIcon icon="home" /> - // </div> - // </> - // ) : null} - // </div> - // <div className="topbar-center"> - // <div className="topbar-title" onClick={() => activeDashboard && SelectionManager.SelectView(DocumentManager.Instance.getDocumentView(activeDashboard)!, false)}> - // {activeDashboard ? StrCast(activeDashboard.title) : 'Dash'} - // </div> - // <div - // className="topbar-button-icon" - // onClick={e => { - // const dashView = activeDashboard && DocumentManager.Instance.getDocumentView(activeDashboard); - // ContextMenu.Instance.addItem({ description: 'Open Dashboard View', event: this.navigateToHome, icon: 'edit' }); - // ContextMenu.Instance.addItem({ - // description: 'Snapshot Dashboard', - // event: async () => { - // const batch = UndoManager.StartBatch('snapshot'); - // await DashboardView.snapshotDashboard(); - // batch.end(); - // }, - // icon: 'edit', - // }); - // dashView?.showContextMenu(e.clientX + 20, e.clientY + 30); - // }}> - // <FontAwesomeIcon color="white" size="lg" icon="bars" /> - // </div> - // <Tooltip title={<div className="dash-tooltip">Browsing mode for directly navigating to documents</div>} placement="bottom"> - // <div className="topbar-button-icon" style={{ background: MainView.Instance._exploreMode ? Colors.LIGHT_BLUE : undefined }} onClick={action(() => (MainView.Instance._exploreMode = !MainView.Instance._exploreMode))}> - // <FontAwesomeIcon color={MainView.Instance._exploreMode ? 'red' : 'white'} icon="eye" size="lg" /> - // </div> - // </Tooltip> - // </div> - // <div className="topbar-right"> - // {Doc.ActiveDashboard ? ( - // <div - // className="topbar-button-icon" - // onClick={() => { - // SharingManager.Instance.open(undefined, activeDashboard); - // }}> - // {GetEffectiveAcl(Doc.GetProto(Doc.ActiveDashboard)) === AclAdmin ? 'Share' : 'view original'} - // </div> - // ) : null} - // <div className="topbar-button-icon" onClick={() => ReportManager.Instance.open()}> - // <MdBugReport /> - // </div> - // <div className="topbar-button-icon" onClick={() => window.open('https://brown-dash.github.io/Dash-Documentation/', '_blank')}> - // <FontAwesomeIcon icon="question-circle" /> - // </div> - // <div className="topbar-button-icon" onClick={() => SettingsManager.Instance.open()}> - // <FontAwesomeIcon icon="cog" /> - // </div> - // </div> - // </div> - // </div> - // ); - // } render() { return ( //TODO:glr Add support for light / dark mode diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 74a3d8cf2..a3c742f28 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -239,6 +239,8 @@ export class Doc extends RefField { return DocCast(Doc.UserDoc().activeDashboard); } public static set ActiveDashboard(val: Doc | undefined) { + const overlays = Cast(Doc.MyOverlayDocs.data, listSpec(Doc), null); + overlays && (overlays.length = 0); Doc.UserDoc().activeDashboard = val; } public static set ActiveTool(tool: InkTool) { |