import { DatabaseBackupIcon, Github, LayoutDashboard, LockKeyholeIcon, LogsIcon, MailIcon, Server, UsersIcon, } 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 systems = 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/beszel/blob/main/readme.md' }} > Documentation GitHub {systems.length > 0 && ( <> {systems.map((system) => ( { navigate(`/system/${encodeURIComponent(system.name)}`) setOpen(false) }} > {system.name} {system.host} ))} )} {isAdmin() && ( <> { setOpen(false) window.open('/_/', '_blank') }} > Users Admin { setOpen(false) window.open('/_/#/logs', '_blank') }} > Logs Admin { setOpen(false) window.open('/_/#/settings/backups', '_blank') }} > Database backups Admin { setOpen(false) window.open('/_/#/settings/auth-providers', '_blank') }} > Auth Providers Admin { setOpen(false) window.open('/_/#/settings/mail', '_blank') }} > SMTP settings Admin )} ) }