aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/topbar/TopBar.tsx
diff options
context:
space:
mode:
authorMichael Foiani <sotech117@michaels-mbp-3.devices.brown.edu>2022-04-28 17:24:37 -0400
committerMichael Foiani <sotech117@michaels-mbp-3.devices.brown.edu>2022-04-28 17:24:37 -0400
commit22fe2791b6a6e92cc4d0ad953363120b51bd6e2c (patch)
tree0896be213b50026fdf5a05afb64b28328253d757 /src/client/views/topbar/TopBar.tsx
parent42819362e50bc35b3bca228607fcc516d528bb1b (diff)
parent99ae2ccde9dbcf6bae75edea231d4b10c736a692 (diff)
Merge with jenny
Diffstat (limited to 'src/client/views/topbar/TopBar.tsx')
-rw-r--r--src/client/views/topbar/TopBar.tsx26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/client/views/topbar/TopBar.tsx b/src/client/views/topbar/TopBar.tsx
index d5254e315..0af7de6af 100644
--- a/src/client/views/topbar/TopBar.tsx
+++ b/src/client/views/topbar/TopBar.tsx
@@ -7,7 +7,7 @@ import { StrCast } from '../../../fields/Types';
import { Utils } from '../../../Utils';
import { CurrentUserUtils } from "../../util/CurrentUserUtils";
import { SettingsManager } from "../../util/SettingsManager";
-import { undoBatch } from "../../util/UndoManager";
+import { undoBatch, UndoManager } from "../../util/UndoManager";
import { Borders, Colors } from "../global/globalEnums";
import "./TopBar.scss";
@@ -33,30 +33,36 @@ export class TopBar extends React.Component {
</div>
<div className="topbar-center" >
<div className="topbar-lozenge-dashboard">
- <select className="topbar-dashSelect" onChange={e => CurrentUserUtils.openDashboard(Doc.UserDoc(), myDashboards[Number(e.target.value)])}
+ <select className="topbar-dashSelect" onChange={undoBatch(e => CurrentUserUtils.openDashboard(Doc.UserDoc(), myDashboards[Number(e.target.value)]))}
value={myDashboards.indexOf(CurrentUserUtils.ActiveDashboard)}
style={{ color: Colors.WHITE }}>
{myDashboards.map((dash, i) => <option key={dash[Id]} value={i}> {StrCast(dash.title)} </option>)}
</select>
</div>
<div className="topbar-dashboards">
- <div className="topbar-icon" onClick={undoBatch(() => CurrentUserUtils.createNewDashboard(Doc.UserDoc()))}
- >
- {"New"}<FontAwesomeIcon icon="plus"></FontAwesomeIcon>
+ <div className="topbar-icon" onClick={async () => {
+ const batch = UndoManager.StartBatch("new dash");
+ await CurrentUserUtils.createNewDashboard(Doc.UserDoc());
+ batch.end();
+ }}>
+ {"New"}<FontAwesomeIcon icon="plus" />
</div>
- {Doc.UserDoc().noviceMode ? (null) : <div className="topbar-icon" onClick={undoBatch(() => CurrentUserUtils.snapshotDashboard(Doc.UserDoc()))}
- >
- {"Snapshot"}<FontAwesomeIcon icon="camera"></FontAwesomeIcon>
+ {<div className="topbar-icon" onClick={async () => {
+ const batch = UndoManager.StartBatch("snapshot");
+ await CurrentUserUtils.snapshotDashboard(Doc.UserDoc());
+ batch.end();
+ }}>
+ {"Snapshot"}<FontAwesomeIcon icon="camera" />
</div>}
</div>
</div>
<div className="topbar-right" >
<div className="topbar-icon" onClick={() => window.open(
"https://brown-dash.github.io/Dash-Documentation/", "_blank")}>
- {"Help"}<FontAwesomeIcon icon="question-circle"></FontAwesomeIcon>
+ {"Help"}<FontAwesomeIcon icon="question-circle" />
</div>
<div className="topbar-icon" onClick={() => SettingsManager.Instance.open()}>
- {"Settings"}<FontAwesomeIcon icon="cog"></FontAwesomeIcon>
+ {"Settings"}<FontAwesomeIcon icon="cog" />
</div>
</div>