diff --git a/understand-anything-plugin/packages/dashboard/src/App.tsx b/understand-anything-plugin/packages/dashboard/src/App.tsx index 6961930..3f1f265 100644 --- a/understand-anything-plugin/packages/dashboard/src/App.tsx +++ b/understand-anything-plugin/packages/dashboard/src/App.tsx @@ -32,6 +32,7 @@ function App() { // Help { key: "?", + shiftKey: true, description: "Show keyboard shortcuts", action: () => setShowKeyboardHelp((prev) => !prev), category: "General", @@ -43,14 +44,14 @@ function App() { action: () => { // Read from store at invocation time to avoid stale closures const state = useDashboardStore.getState(); - if (showKeyboardHelp) { - setShowKeyboardHelp(false); - } else if (state.codeViewerOpen) { + if (state.codeViewerOpen) { state.closeCodeViewer(); } else if (state.selectedNodeId) { state.selectNode(null); } else if (state.tourActive) { state.stopTour(); + } else { + setShowKeyboardHelp(false); } }, category: "Navigation", @@ -109,11 +110,11 @@ function App() { category: "View", }, ], - [showKeyboardHelp] + [] ); // Register keyboard shortcuts - useKeyboardShortcuts(shortcuts, !showKeyboardHelp); + useKeyboardShortcuts(shortcuts); useEffect(() => { fetch("/knowledge-graph.json") @@ -219,8 +220,11 @@ function App() { {/* Main content: Graph + Sidebar */}
{/* Graph area */} -
+
+
+ Press ? for keyboard shortcuts +
{/* Right sidebar */} diff --git a/understand-anything-plugin/packages/dashboard/src/hooks/useKeyboardShortcuts.ts b/understand-anything-plugin/packages/dashboard/src/hooks/useKeyboardShortcuts.ts index a46d754..fcf91e3 100644 --- a/understand-anything-plugin/packages/dashboard/src/hooks/useKeyboardShortcuts.ts +++ b/understand-anything-plugin/packages/dashboard/src/hooks/useKeyboardShortcuts.ts @@ -60,10 +60,12 @@ export function formatShortcutKey(shortcut: KeyboardShortcut): string { if (shortcut.ctrlKey || shortcut.metaKey) { keys.push(isMac ? "⌘" : "Ctrl"); } - if (shortcut.shiftKey) keys.push("⇧"); + // Don't show ⇧ for keys that inherently require Shift (e.g. ?, !, @) + const isShiftedPunctuation = shortcut.key.length === 1 && /[^a-zA-Z0-9]/.test(shortcut.key); + if (shortcut.shiftKey && !isShiftedPunctuation) keys.push("⇧"); if (shortcut.altKey) keys.push(isMac ? "⌥" : "Alt"); - keys.push(shortcut.key.toUpperCase()); + keys.push(isShiftedPunctuation ? shortcut.key : shortcut.key.toUpperCase()); return keys.join(" + "); }