aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/topbar
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-06-20 13:44:07 -0400
committerbobzel <zzzman@gmail.com>2022-06-20 13:44:07 -0400
commit165e28824883301c6777ecee430bb71e1db5b3ad (patch)
tree0f558efcd254b745925acef734c4177da8b5fe9d /src/client/views/topbar
parent244afabced075fd0567aca20a306afe088581b91 (diff)
parentb292a055401af6236e0537cfad603016d77a535a (diff)
Merge branch 'master' into mainview-jenny
Diffstat (limited to 'src/client/views/topbar')
-rw-r--r--src/client/views/topbar/TopBar.tsx25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/client/views/topbar/TopBar.tsx b/src/client/views/topbar/TopBar.tsx
index e4f48adce..13c8e907a 100644
--- a/src/client/views/topbar/TopBar.tsx
+++ b/src/client/views/topbar/TopBar.tsx
@@ -27,12 +27,12 @@ import "./TopBar.scss";
export class TopBar extends React.Component {
navigateToHome = () => {
CurrentUserUtils.CaptureDashboardThumbnail()?.then(() => {
- Doc.UserDoc().activePage = "home";
- CurrentUserUtils.closeActiveDashboard(); // bcz: if we do this, we need some other way to keep track, for user convenience, of the last dashboard in use
+ CurrentUserUtils.ActivePage = "home";
+ CurrentUserUtils.closeActiveDashboard(); // bcz: if we do this, we need some other way to keep track, for user convenience, of the last dashboard in use
});
}
render() {
- const activeDashboard = Cast(Doc.UserDoc().activeDashboard, Doc, null)
+ const activeDashboard = CurrentUserUtils.ActiveDashboard;
return (
//TODO:glr Add support for light / dark mode
<div style={{ pointerEvents: "all", background: Colors.DARK_GRAY, borderBottom: Borders.STANDARD }} className="topbar-container">
@@ -52,19 +52,18 @@ export class TopBar extends React.Component {
</div>
<div className="topbar-center" >
- <div className="topbar-title" onClick={() => SelectionManager.SelectView(DocumentManager.Instance.getDocumentView(activeDashboard)!, false)}>
+ <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 = DocumentManager.Instance.getDocumentView(activeDashboard);
- ContextMenu.Instance.addItem({
- description: "Snapshot Dashboard", event: async () => {
- const batch = UndoManager.StartBatch("snapshot");
- await CurrentUserUtils.snapshotDashboard(Doc.UserDoc());
- batch.end();
- }, icon: "edit"
- });
- dashView?.showContextMenu(e.clientX + 20, e.clientY + 30);
+ 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 CurrentUserUtils.snapshotDashboard(Doc.UserDoc());
+ batch.end();
+ }, icon: "edit" });
+ dashView?.showContextMenu(e.clientX+20, e.clientY+30);
}}>
<FontAwesomeIcon color="white" size="lg" icon="bars" />
</div>