aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenny Yu <jennyyu212@outlook.com>2022-06-09 21:05:20 -0700
committerJenny Yu <jennyyu212@outlook.com>2022-06-09 21:05:20 -0700
commitc159cec257544ff10c256181d1aedfccf3ae7843 (patch)
treec257fbf25c4ec3030e5964dde15fd8e53e1370dd
parent5089c14ca27a52326d3f38e7f3ef572548f72d2a (diff)
fix: close active dashboard
-rw-r--r--src/client/util/CurrentUserUtils.ts6
-rw-r--r--src/client/views/topbar/TopBar.tsx1
2 files changed, 6 insertions, 1 deletions
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 3b1009532..d32f1bf70 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -1212,6 +1212,10 @@ export class CurrentUserUtils {
CurrentUserUtils.openDashboard(userDoc, copy);
}
+ public static closeActiveDashboard = () => {
+ Doc.UserDoc().activeDashboard = undefined;
+ }
+
public static createNewDashboard = async (userDoc: Doc, id?: string) => {
const presentation = Doc.MakeCopy(userDoc.emptyPresentation as Doc, true);
const dashboards = await Cast(userDoc.myDashboards, Doc) as Doc;
@@ -1237,7 +1241,7 @@ export class CurrentUserUtils {
userDoc.activePresentation = presentation;
Doc.AddDocToList(dashboards, "data", dashboardDoc);
- CurrentUserUtils.openDashboard(userDoc, dashboardDoc);
+ // CurrentUserUtils.openDashboard(userDoc, dashboardDoc);
}
public static GetNewTextDoc(title: string, x: number, y: number, width?: number, height?: number, noMargins?: boolean, annotationOn?: Doc, maxHeight?: number, backgroundColor?: string) {
diff --git a/src/client/views/topbar/TopBar.tsx b/src/client/views/topbar/TopBar.tsx
index 79d48e13c..57ceac2dd 100644
--- a/src/client/views/topbar/TopBar.tsx
+++ b/src/client/views/topbar/TopBar.tsx
@@ -22,6 +22,7 @@ import "./TopBar.scss";
@observer
export class TopBar extends React.Component {
navigateToHome = () => {
+ CurrentUserUtils.closeActiveDashboard();
CurrentUserUtils.CaptureDashboardThumbnail()?.then(() => Doc.UserDoc().activePage = "home");
}
render() {