From b24db389fb24d0c101975d53afaffd9091078ee2 Mon Sep 17 00:00:00 2001 From: Michael Gartner Date: Tue, 30 Jun 2026 16:40:16 -0600 Subject: [PATCH] Move page management into dialog --- src/components/QuickSwitcherSettings.tsx | 250 ++++++++++++++--------- 1 file changed, 159 insertions(+), 91 deletions(-) diff --git a/src/components/QuickSwitcherSettings.tsx b/src/components/QuickSwitcherSettings.tsx index 65af9d4..70ef629 100644 --- a/src/components/QuickSwitcherSettings.tsx +++ b/src/components/QuickSwitcherSettings.tsx @@ -1,4 +1,11 @@ -import { Button, Card, FormGroup, InputGroup, Tag } from "@blueprintjs/core"; +import { + Button, + Card, + Dialog, + FormGroup, + InputGroup, + Tag, +} from "@blueprintjs/core"; import React, { useMemo, useState } from "react"; import PageInput from "roamjs-components/components/PageInput"; import { render as renderToast } from "roamjs-components/components/Toast"; @@ -46,6 +53,7 @@ export const createQuickSwitcherSettingsComponent = ({ const QuickSwitcherSettings = (): React.ReactElement => { const [bookmarks, setBookmarks] = useState(initialBookmarks); + const [isManageDialogOpen, setIsManageDialogOpen] = useState(false); const [pageTitle, setPageTitle] = useState(""); const [shortcut, setShortcut] = useState(""); @@ -74,10 +82,16 @@ export const createQuickSwitcherSettingsComponent = ({ setShortcut(""); }; + const closeManageDialog = (): void => { + setIsManageDialogOpen(false); + clearForm(); + }; + const onShortcutKeyDown = ( event: React.KeyboardEvent, ): void => { event.preventDefault(); + event.stopPropagation(); if ( event.key === "Backspace" || event.key === "Delete" || @@ -187,104 +201,35 @@ export const createQuickSwitcherSettingsComponent = ({ }; return ( -
- - +
+
-
+
{bookmarks.length ? ( - bookmarks.map((bookmark, index) => ( - ( +
-
{bookmark.title}
-
- {bookmark.url} -
+
{bookmark.title}
-
- {bookmark.shortcut ? ( - - {formatShortcutForDisplay({ - shortcut: bookmark.shortcut, - isMac, - })} - - ) : null} -
- + {bookmark.shortcut ? ( + + {formatShortcutForDisplay({ + shortcut: bookmark.shortcut, + isMac, + })} + + ) : null} +
)) ) : (
@@ -292,6 +237,129 @@ export const createQuickSwitcherSettingsComponent = ({
)}
+ + +
+ + + + + + + + +
+
+ +
+ {bookmarks.length ? ( + bookmarks.map((bookmark, index) => ( + +
+
+ {bookmark.title} +
+
+ {bookmark.url} +
+
+
+ {bookmark.shortcut ? ( + + {formatShortcutForDisplay({ + shortcut: bookmark.shortcut, + isMac, + })} + + ) : null} +
+
+ )) + ) : ( +
+ No bookmarks configured yet. +
+ )} +
+
+
); };