'use client' import { Database, DatabaseBackupIcon, Github, LayoutDashboard, LockKeyholeIcon, LogsIcon, MailIcon, Server, } from 'lucide-react' import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, } from '@/components/ui/command' import { useEffect, useState } from 'react' import { useStore } from '@nanostores/react' import { $systems } from '@/lib/stores' import { isAdmin } from '@/lib/utils' import { navigate } from './router' export default function CommandPalette() { const [open, setOpen] = useState(false) const servers = useStore($systems) useEffect(() => { const down = (e: KeyboardEvent) => { if (e.key === 'k' && (e.metaKey || e.ctrlKey)) { e.preventDefault() setOpen((open) => !open) } } document.addEventListener('keydown', down) return () => document.removeEventListener('keydown', down) }, []) return ( No results found. { navigate('/') setOpen((open) => !open) }} > Dashboard Page { window.location.href = 'https://github.com/henrygd' }} > Documentation GitHub {servers.map((server) => ( { navigate(`/server/${server.name}`) setOpen((open) => !open) }} > {server.name} {server.host} ))} {isAdmin() && ( <> { window.location.href = '/_/' }} > PocketBase Admin { window.location.href = '/_/#/logs' }} > Logs Admin { window.location.href = '/_/#/settings/backups' }} > Database backups Admin { window.location.href = '/_/#/settings/auth-providers' }} > Auth Providers Admin { window.location.href = '/_/#/settings/mail' }} > SMTP settings Admin )} ) }