diff --git a/site/bun.lockb b/site/bun.lockb index 890127a..3763ac4 100755 Binary files a/site/bun.lockb and b/site/bun.lockb differ diff --git a/site/package.json b/site/package.json index 369a7d7..2290537 100644 --- a/site/package.json +++ b/site/package.json @@ -10,12 +10,14 @@ }, "dependencies": { "@nanostores/preact": "^0.5.1", + "@radix-ui/react-dialog": "^1.1.1", "@radix-ui/react-dropdown-menu": "^2.1.1", "@radix-ui/react-label": "^2.1.0", "@radix-ui/react-slot": "^1.1.0", "@tanstack/react-table": "^8.19.2", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", + "cmdk": "^1.0.0", "lucide-react": "^0.401.0", "nanostores": "^0.10.3", "pocketbase": "^0.21.3", diff --git a/site/src/components/command-dialog.tsx b/site/src/components/command-dialog.tsx new file mode 100644 index 0000000..2881ec3 --- /dev/null +++ b/site/src/components/command-dialog.tsx @@ -0,0 +1,82 @@ +'use client' + +import { Database, Home, Server } from 'lucide-react' + +import { + CommandDialog, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, + CommandSeparator, + CommandShortcut, +} from '@/components/ui/command' +import { useEffect, useState } from 'preact/hooks' +import { navigate } from 'wouter-preact/use-browser-location' + +export function CommandPalette() { + const [open, setOpen] = useState(false) + + useEffect(() => { + const down = (e: KeyboardEvent) => { + if (e.key === 'k' && (e.metaKey || e.ctrlKey)) { + console.log('open') + e.preventDefault() + setOpen((open) => !open) + } + } + + document.addEventListener('keydown', down) + return () => document.removeEventListener('keydown', down) + }, []) + + return ( + + + + No results found. + + { + navigate('/') + setOpen((open) => !open) + }} + > + + Home + + { + window.location.href = '/_/' + }} + > + + PocketBase + ⌘P + + + + + { + navigate('/server/kagemusha') + setOpen((open) => !open) + }} + > + + Kagemusha + + navigate('/server/rashomon')}> + + Rashomon + + navigate('/server/ikiru')}> + + Ikiru + + + + + ) +} diff --git a/site/src/components/mode-toggle.tsx b/site/src/components/mode-toggle.tsx index 5ab0bcf..90e1157 100644 --- a/site/src/components/mode-toggle.tsx +++ b/site/src/components/mode-toggle.tsx @@ -15,7 +15,7 @@ export function ModeToggle() { return ( -