aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/topbar
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-06-21 21:51:17 -0400
committerbobzel <zzzman@gmail.com>2022-06-21 21:51:17 -0400
commit669d20040a727cf0599126eccffb175643d4fa09 (patch)
treef14822bbda878b48301d8c7f4de89473bcfd6dc7 /src/client/views/topbar
parente691d8e72ba632f0ef2d4122fe7233f9a48d4439 (diff)
parentb99e32960ff624237ca99c8d6ee756026a79003a (diff)
Merge branch 'master' into data-visualization-view-naafi
Diffstat (limited to 'src/client/views/topbar')
-rw-r--r--src/client/views/topbar/TopBar.tsx12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/client/views/topbar/TopBar.tsx b/src/client/views/topbar/TopBar.tsx
index 0db3950a2..6a4deca38 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.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">
@@ -44,15 +44,15 @@ export class TopBar extends React.Component {
}}>{Doc.CurrentUserEmail}</div> : (null)}
</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);
+ 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());
+ await CurrentUserUtils.snapshotDashboard();
batch.end();
}, icon: "edit" });
dashView?.showContextMenu(e.clientX+20, e.clientY+30);
@@ -69,7 +69,7 @@ export class TopBar extends React.Component {
<div className="topbar-button-text" onClick={() => {SharingManager.Instance.open(undefined, activeDashboard)}}>
{/* TODO: if this is my dashboard, display share
if this is a shared dashboard, display "view original or view annotated" */}
- { Doc.GetProto(CurrentUserUtils.ActiveDashboard)?.author === Doc.CurrentUserEmail ? "Share": "view original" }
+ { CurrentUserUtils.ActiveDashboard && (Doc.GetProto(CurrentUserUtils.ActiveDashboard)?.author === Doc.CurrentUserEmail ? "Share": "view original") }
</div>
<div className="topbar-button-icon" onClick={() => window.open(
"https://brown-dash.github.io/Dash-Documentation/", "_blank")}>