Skip to content

Commit b08948a

Browse files
authored
ENG-1154: Reload graph when left sidebar is enabled (#605)
* show alert to reload the graph when left sidebar is enabled * use flag panel instead of checkbox
1 parent 26ebb72 commit b08948a

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

apps/roam/src/components/settings/GeneralSettings.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
import React, { useMemo } from "react";
1+
import React, { useMemo, useState } from "react";
22
import TextPanel from "roamjs-components/components/ConfigPanels/TextPanel";
33
import FlagPanel from "roamjs-components/components/ConfigPanels/FlagPanel";
44
import { getFormattedConfigTree } from "~/utils/discourseConfigRef";
55
import refreshConfigTree from "~/utils/refreshConfigTree";
66
import { DEFAULT_CANVAS_PAGE_FORMAT } from "~/index";
7+
import { Alert, Intent } from "@blueprintjs/core";
78

89
const DiscourseGraphHome = () => {
910
const settings = useMemo(() => {
1011
refreshConfigTree();
1112
return getFormattedConfigTree();
1213
}, []);
1314

15+
const [isAlertOpen, setIsAlertOpen] = useState(false);
16+
1417
return (
1518
<div className="flex flex-col gap-4 p-1">
1619
<TextPanel
@@ -37,7 +40,25 @@ const DiscourseGraphHome = () => {
3740
uid={settings.leftSidebarEnabled.uid}
3841
parentUid={settings.settingsUid}
3942
value={settings.leftSidebarEnabled.value || false}
43+
options={{
44+
onChange: (checked: boolean) => {
45+
if (checked) {
46+
setIsAlertOpen(true);
47+
}
48+
},
49+
}}
4050
/>
51+
<Alert
52+
isOpen={isAlertOpen}
53+
onConfirm={() => window.location.reload()}
54+
onCancel={() => setIsAlertOpen(false)}
55+
confirmButtonText="Reload Graph"
56+
cancelButtonText="Later"
57+
intent={Intent.PRIMARY}
58+
>
59+
<p>Enabling the Left Sidebar requires a graph reload to take effect.</p>
60+
<p>Would you like to reload now?</p>
61+
</Alert>
4162
</div>
4263
);
4364
};

0 commit comments

Comments
 (0)