()
| 178 | } |
| 179 | |
| 180 | export function HelpView(): JSX.Element { |
| 181 | const closeActiveNote = useStore((s) => s.closeActiveNote) |
| 182 | const setCommandPaletteOpen = useStore((s) => s.setCommandPaletteOpen) |
| 183 | const setSearchOpen = useStore((s) => s.setSearchOpen) |
| 184 | const setSettingsOpen = useStore((s) => s.setSettingsOpen) |
| 185 | const setFocusedPanel = useStore((s) => s.setFocusedPanel) |
| 186 | const keymapOverrides = useStore((s) => s.keymapOverrides) |
| 187 | const runtimePlatform = window.zen.platformSync() |
| 188 | const platformLabel = |
| 189 | runtimePlatform === 'darwin' |
| 190 | ? 'macOS' |
| 191 | : runtimePlatform === 'win32' |
| 192 | ? 'Windows' |
| 193 | : 'Linux' |
| 194 | const primaryModifierLabel = |
| 195 | runtimePlatform === 'darwin' ? 'Command (⌘)' : 'Ctrl' |
| 196 | |
| 197 | const [query, setQuery] = useState('') |
| 198 | const deferredQuery = useDeferredValue(query.trim().toLowerCase()) |
| 199 | |
| 200 | const allCommands = buildCommands({ includeUnavailable: true }) |
| 201 | |
| 202 | const quickStart = useMemo( |
| 203 | () => |
| 204 | HELP_QUICK_START.filter((card) => |
| 205 | matchesQuery(deferredQuery, card.title, card.body) |
| 206 | ), |
| 207 | [deferredQuery] |
| 208 | ) |
| 209 | |
| 210 | const coreConcepts = useMemo( |
| 211 | () => |
| 212 | HELP_CORE_CONCEPTS.filter((card) => |
| 213 | matchesQuery(deferredQuery, card.title, card.body) |
| 214 | ), |
| 215 | [deferredQuery] |
| 216 | ) |
| 217 | |
| 218 | const howToGuides = useMemo( |
| 219 | () => |
| 220 | HELP_HOW_TO_GUIDES.filter((card) => |
| 221 | matchesQuery(deferredQuery, card.title, card.body) |
| 222 | ), |
| 223 | [deferredQuery] |
| 224 | ) |
| 225 | |
| 226 | const shortcutSections = useMemo( |
| 227 | () => |
| 228 | HELP_SHORTCUT_SECTIONS.map((section) => { |
| 229 | const items = section.items.filter((item) => |
| 230 | matchesQuery( |
| 231 | deferredQuery, |
| 232 | section.title, |
| 233 | section.description, |
| 234 | resolveShortcutKeys(section.id, item.action, keymapOverrides) ?? item.keys, |
| 235 | item.action, |
| 236 | item.detail |
| 237 | ) |
nothing calls this directly
no test coverage detected