import { NavigationMenu, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, navigationMenuTriggerStyle, } from "@/components/ui/navigation-menu" import { ModeToggle } from "@/components/mode-toggle"; import { Card } from "./ui/card"; import { useMainStore } from "@/hooks/useMainStore"; import { Avatar, AvatarFallback, AvatarImage } from "./ui/avatar"; import { NzNavigationMenuLink } from "./xui/navigation-menu"; import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger } from "./ui/dropdown-menu"; import { LogOut, Settings, User2 } from "lucide-react"; import { useAuth } from "@/hooks/useAuth"; import { Link, useLocation } from "react-router-dom"; import { useMediaQuery } from "@/hooks/useMediaQuery"; import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, } from "@/components/ui/drawer" import { Button } from "./ui/button"; import { IconButton } from "./xui/icon-button"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import i18next from "i18next"; const pages = [ { href: "/dashboard", label: i18next.t("Server") }, { href: "/dashboard/service", label: i18next.t("Service") }, { href: "/dashboard/cron", label: i18next.t("Task") }, { href: "/dashboard/notification", label: i18next.t("Notification") }, { href: "/dashboard/ddns", label: i18next.t("DDNS") }, { href: "/dashboard/nat", label: i18next.t("NATT") }, { href: "/dashboard/server-group", label: i18next.t("Group") }, ] export default function Header() { const { t } = useTranslation(); const { logout } = useAuth(); const profile = useMainStore(store => store.profile); const location = useLocation(); const isDesktop = useMediaQuery("(min-width: 890px)") const [open, setOpen] = useState(false) const [dropdownOpen, setDropdownOpen] = useState(false); return ( isDesktop ? ( {t("nezha")} { profile && ( <> {t("Server")} {t("Service")} {t('Task')} {t('Notification')} {t('DDNS')} {t('NATT')} {t('Group')} > ) } { profile && <> {profile.username} {profile.username} { setDropdownOpen(false) }}> {t('Profile')} { setDropdownOpen(false) }}> {t('Settings')} {t('Logout')} > } ) : ( {profile && {t('NavigateTo')} {t('SelectAPageToNavigateTo')} {pages.slice(0).map((item, index) => ( { setOpen(false) }} > {item.label} ))} {t('Close')} } NEZHA { profile && <> {profile.username} {profile.username} { setDropdownOpen(false) }}> {t('Profile')} ⇧⌘P { setDropdownOpen(false) }}> {t('Settings')} ⇧⌘S {t('Logout')} ⇧⌘Q > } ) ) }