diff options
Diffstat (limited to 'src/client/views/topbar/TopBar.tsx')
| -rw-r--r-- | src/client/views/topbar/TopBar.tsx | 26 |
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> |
