aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/topbar
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-06-10 10:18:05 -0400
committerbobzel <zzzman@gmail.com>2022-06-10 10:18:05 -0400
commitbc662b4e7eaaa1f33f41f64ce64d60579939b971 (patch)
tree6910cb3e35dd079f6480352c1057662f63aeb507 /src/client/views/topbar
parent2eab3c6035c6444eae083cdeb35fb58a1234f581 (diff)
fixed some problems with dragging doc onto empty tab bar. made topBar be just one line to save vertical space. added a context menu to Dashboard
Diffstat (limited to 'src/client/views/topbar')
-rw-r--r--src/client/views/topbar/TopBar.scss6
-rw-r--r--src/client/views/topbar/TopBar.tsx45
2 files changed, 28 insertions, 23 deletions
diff --git a/src/client/views/topbar/TopBar.scss b/src/client/views/topbar/TopBar.scss
index 6662386d4..c5b340514 100644
--- a/src/client/views/topbar/TopBar.scss
+++ b/src/client/views/topbar/TopBar.scss
@@ -22,9 +22,9 @@
grid-auto-columns: 33.3% 33.3% 33.3%;
align-items: center;
- &:first-child {
- height: 20px;
- }
+ // &:first-child {
+ // height: 20px;
+ // }
}
.topbar-button-text {
diff --git a/src/client/views/topbar/TopBar.tsx b/src/client/views/topbar/TopBar.tsx
index 57ceac2dd..5bee58ccb 100644
--- a/src/client/views/topbar/TopBar.tsx
+++ b/src/client/views/topbar/TopBar.tsx
@@ -3,14 +3,18 @@ import { Tooltip } from "@material-ui/core";
import { action } from "mobx";
import { observer } from "mobx-react";
import * as React from 'react';
-import { Doc, DocListCast } from '../../../fields/Doc';
+import { AclAdmin, Doc, DocListCast } from '../../../fields/Doc';
import { Id } from '../../../fields/FieldSymbols';
import { Cast, StrCast } from '../../../fields/Types';
+import { GetEffectiveAcl } from "../../../fields/util";
import { Utils } from '../../../Utils';
import { CurrentUserUtils } from "../../util/CurrentUserUtils";
+import { DocumentManager } from "../../util/DocumentManager";
+import { SelectionManager } from "../../util/SelectionManager";
import { SettingsManager } from "../../util/SettingsManager";
import { SharingManager } from "../../util/SharingManager";
import { undoBatch, UndoManager } from "../../util/UndoManager";
+import { ContextMenu } from "../ContextMenu";
import { Borders, Colors } from "../global/globalEnums";
import { MainView } from "../MainView";
import "./TopBar.scss";
@@ -22,22 +26,38 @@ import "./TopBar.scss";
@observer
export class TopBar extends React.Component {
navigateToHome = () => {
- CurrentUserUtils.closeActiveDashboard();
- CurrentUserUtils.CaptureDashboardThumbnail()?.then(() => Doc.UserDoc().activePage = "home");
+ 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
+ });
}
render() {
- const myDashboards = DocListCast(CurrentUserUtils.MyDashboards.data);
const activeDashboard = Cast(Doc.UserDoc().activeDashboard, Doc, null)
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">
- <div className="topbar-button-text" onClick={this.navigateToHome}>Home</div>
+ {activeDashboard ? <div className="topbar-button-text">{Doc.CurrentUserEmail} (Placeholder)</div> : (null)}
</div>
<div className="topbar-center" >
+ <div className="topbar-title" onClick={() => 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: "Open Dashboard View", event: this.navigateToHome, icon: "edit" });
+ dashView?.showContextMenu(e.clientX+20, e.clientY+30);
+ }}>
+ <FontAwesomeIcon color="white" icon="bars" />
+ </div>
</div>
<div className="topbar-right" >
+ <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" }
+ </div>
<div className="topbar-button-icon" onClick={() => window.open(
"https://brown-dash.github.io/Dash-Documentation/", "_blank")}>
<FontAwesomeIcon icon="question-circle" />
@@ -47,21 +67,6 @@ export class TopBar extends React.Component {
</div>
</div>
</div>
- <div className="topbar-inner-container">
- <div className="topbar-left">
- {activeDashboard ? <div className="topbar-button-text">Freeform View (Placeholder)</div> : (null)}
- </div>
- <div className="topbar-center" >
- <div className="topbar-title">
- {activeDashboard ? StrCast(activeDashboard.title) : "Dash"}
- </div>
- </div>
- <div className="topbar-right" >
- {/* TODO: if this is my dashboard, display share
- if this is a shared dashboard, display "view original or view annotated" */}
- <div className="topbar-button-text" onClick={() => {SharingManager.Instance.open(undefined, activeDashboard)}}>Share</div>
- </div>
- </div>
</div>
);