mirror of
https://github.com/henrygd/beszel.git
synced 2025-12-17 10:46:16 +01:00
add prettier config and format files site files
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
Server,
|
||||
SettingsIcon,
|
||||
UsersIcon,
|
||||
} from 'lucide-react'
|
||||
} from "lucide-react"
|
||||
|
||||
import {
|
||||
CommandDialog,
|
||||
@@ -19,39 +19,33 @@ import {
|
||||
CommandList,
|
||||
CommandSeparator,
|
||||
CommandShortcut,
|
||||
} from '@/components/ui/command'
|
||||
import { useEffect } from 'react'
|
||||
import { useStore } from '@nanostores/react'
|
||||
import { $systems } from '@/lib/stores'
|
||||
import { isAdmin } from '@/lib/utils'
|
||||
import { navigate } from './router'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
} from "@/components/ui/command"
|
||||
import { useEffect } from "react"
|
||||
import { useStore } from "@nanostores/react"
|
||||
import { $systems } from "@/lib/stores"
|
||||
import { isAdmin } from "@/lib/utils"
|
||||
import { navigate } from "./router"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
export default function CommandPalette({
|
||||
open,
|
||||
setOpen,
|
||||
}: {
|
||||
open: boolean
|
||||
setOpen: (open: boolean) => void
|
||||
}) {
|
||||
export default function CommandPalette({ open, setOpen }: { open: boolean; setOpen: (open: boolean) => void }) {
|
||||
const { t } = useTranslation()
|
||||
const systems = useStore($systems)
|
||||
|
||||
useEffect(() => {
|
||||
const down = (e: KeyboardEvent) => {
|
||||
if (e.key === 'k' && (e.metaKey || e.ctrlKey)) {
|
||||
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
|
||||
e.preventDefault()
|
||||
setOpen(!open)
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('keydown', down)
|
||||
return () => document.removeEventListener('keydown', down)
|
||||
document.addEventListener("keydown", down)
|
||||
return () => document.removeEventListener("keydown", down)
|
||||
}, [open, setOpen])
|
||||
|
||||
return (
|
||||
<CommandDialog open={open} onOpenChange={setOpen}>
|
||||
<CommandInput placeholder={t('command.search')} />
|
||||
<CommandInput placeholder={t("command.search")} />
|
||||
<CommandList>
|
||||
<CommandEmpty>No results found.</CommandEmpty>
|
||||
{systems.length > 0 && (
|
||||
@@ -74,106 +68,106 @@ export default function CommandPalette({
|
||||
<CommandSeparator className="mb-1.5" />
|
||||
</>
|
||||
)}
|
||||
<CommandGroup heading={t('command.pages_settings')}>
|
||||
<CommandGroup heading={t("command.pages_settings")}>
|
||||
<CommandItem
|
||||
keywords={['home']}
|
||||
keywords={["home"]}
|
||||
onSelect={() => {
|
||||
navigate('/')
|
||||
navigate("/")
|
||||
setOpen(false)
|
||||
}}
|
||||
>
|
||||
<LayoutDashboard className="mr-2 h-4 w-4" />
|
||||
<span>{t('command.dashboard')}</span>
|
||||
<CommandShortcut>{t('command.page')}</CommandShortcut>
|
||||
<span>{t("command.dashboard")}</span>
|
||||
<CommandShortcut>{t("command.page")}</CommandShortcut>
|
||||
</CommandItem>
|
||||
<CommandItem
|
||||
onSelect={() => {
|
||||
navigate('/settings/general')
|
||||
navigate("/settings/general")
|
||||
setOpen(false)
|
||||
}}
|
||||
>
|
||||
<SettingsIcon className="mr-2 h-4 w-4" />
|
||||
<span>{t('settings.settings')}</span>
|
||||
<CommandShortcut>{t('settings.settings')}</CommandShortcut>
|
||||
<span>{t("settings.settings")}</span>
|
||||
<CommandShortcut>{t("settings.settings")}</CommandShortcut>
|
||||
</CommandItem>
|
||||
<CommandItem
|
||||
keywords={['alerts']}
|
||||
keywords={["alerts"]}
|
||||
onSelect={() => {
|
||||
navigate('/settings/notifications')
|
||||
navigate("/settings/notifications")
|
||||
setOpen(false)
|
||||
}}
|
||||
>
|
||||
<MailIcon className="mr-2 h-4 w-4" />
|
||||
<span>{t('settings.notifications.title')}</span>
|
||||
<CommandShortcut>{t('settings.settings')}</CommandShortcut>
|
||||
<span>{t("settings.notifications.title")}</span>
|
||||
<CommandShortcut>{t("settings.settings")}</CommandShortcut>
|
||||
</CommandItem>
|
||||
<CommandItem
|
||||
keywords={['github']}
|
||||
keywords={["github"]}
|
||||
onSelect={() => {
|
||||
window.location.href = 'https://github.com/henrygd/beszel/blob/main/readme.md'
|
||||
window.location.href = "https://github.com/henrygd/beszel/blob/main/readme.md"
|
||||
}}
|
||||
>
|
||||
<Github className="mr-2 h-4 w-4" />
|
||||
<span>{t('command.documentation')}</span>
|
||||
<span>{t("command.documentation")}</span>
|
||||
<CommandShortcut>GitHub</CommandShortcut>
|
||||
</CommandItem>
|
||||
</CommandGroup>
|
||||
{isAdmin() && (
|
||||
<>
|
||||
<CommandSeparator className="mb-1.5" />
|
||||
<CommandGroup heading={t('command.admin')}>
|
||||
<CommandGroup heading={t("command.admin")}>
|
||||
<CommandItem
|
||||
keywords={['pocketbase']}
|
||||
keywords={["pocketbase"]}
|
||||
onSelect={() => {
|
||||
setOpen(false)
|
||||
window.open('/_/', '_blank')
|
||||
window.open("/_/", "_blank")
|
||||
}}
|
||||
>
|
||||
<UsersIcon className="mr-2 h-4 w-4" />
|
||||
<span>{t('user_dm.users')}</span>
|
||||
<CommandShortcut>{t('command.admin')}</CommandShortcut>
|
||||
<span>{t("user_dm.users")}</span>
|
||||
<CommandShortcut>{t("command.admin")}</CommandShortcut>
|
||||
</CommandItem>
|
||||
<CommandItem
|
||||
onSelect={() => {
|
||||
setOpen(false)
|
||||
window.open('/_/#/logs', '_blank')
|
||||
window.open("/_/#/logs", "_blank")
|
||||
}}
|
||||
>
|
||||
<LogsIcon className="mr-2 h-4 w-4" />
|
||||
<span>{t('user_dm.logs')}</span>
|
||||
<CommandShortcut>{t('command.admin')}</CommandShortcut>
|
||||
<span>{t("user_dm.logs")}</span>
|
||||
<CommandShortcut>{t("command.admin")}</CommandShortcut>
|
||||
</CommandItem>
|
||||
<CommandItem
|
||||
onSelect={() => {
|
||||
setOpen(false)
|
||||
window.open('/_/#/settings/backups', '_blank')
|
||||
window.open("/_/#/settings/backups", "_blank")
|
||||
}}
|
||||
>
|
||||
<DatabaseBackupIcon className="mr-2 h-4 w-4" />
|
||||
<span>{t('user_dm.backups')}</span>
|
||||
<CommandShortcut>{t('command.admin')}</CommandShortcut>
|
||||
<span>{t("user_dm.backups")}</span>
|
||||
<CommandShortcut>{t("command.admin")}</CommandShortcut>
|
||||
</CommandItem>
|
||||
<CommandItem
|
||||
keywords={['oauth', 'oicd']}
|
||||
keywords={["oauth", "oicd"]}
|
||||
onSelect={() => {
|
||||
setOpen(false)
|
||||
window.open('/_/#/settings/auth-providers', '_blank')
|
||||
window.open("/_/#/settings/auth-providers", "_blank")
|
||||
}}
|
||||
>
|
||||
<LockKeyholeIcon className="mr-2 h-4 w-4" />
|
||||
<span>{t('user_dm.auth_providers')}</span>
|
||||
<CommandShortcut>{t('command.admin')}</CommandShortcut>
|
||||
<span>{t("user_dm.auth_providers")}</span>
|
||||
<CommandShortcut>{t("command.admin")}</CommandShortcut>
|
||||
</CommandItem>
|
||||
<CommandItem
|
||||
keywords={['email']}
|
||||
keywords={["email"]}
|
||||
onSelect={() => {
|
||||
setOpen(false)
|
||||
window.open('/_/#/settings/mail', '_blank')
|
||||
window.open("/_/#/settings/mail", "_blank")
|
||||
}}
|
||||
>
|
||||
<MailIcon className="mr-2 h-4 w-4" />
|
||||
<span>{t('command.SMTP_settings')}</span>
|
||||
<CommandShortcut>{t('command.admin')}</CommandShortcut>
|
||||
<span>{t("command.SMTP_settings")}</span>
|
||||
<CommandShortcut>{t("command.admin")}</CommandShortcut>
|
||||
</CommandItem>
|
||||
</CommandGroup>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user