mirror of
https://github.com/henrygd/beszel.git
synced 2026-04-06 04:51:51 +02:00
- System page tabs display option - Remove very specific chart components (disk usage, container cpu, etc) and refactor to use more flexible area and line chart components - Optimizations around chart handling to decrease mem usage. Charts are only redrawn now if in view. - Resolve most of the react dev warnings Co-authored-by: sveng93 <svenvanginkel@icloud.com>
43 lines
1.5 KiB
Go
43 lines
1.5 KiB
Go
import { Trans, useLingui } from "@lingui/react/macro"
|
|
import { LanguagesIcon } from "lucide-react"
|
|
import { buttonVariants } from "@/components/ui/button"
|
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"
|
|
import { dynamicActivate } from "@/lib/i18n"
|
|
import languages from "@/lib/languages"
|
|
import { cn } from "@/lib/utils"
|
|
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip"
|
|
|
|
export function LangToggle() {
|
|
const { i18n } = useLingui()
|
|
|
|
const LangTrans = <Trans>Language</Trans>
|
|
|
|
return (
|
|
<DropdownMenu>
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<DropdownMenuTrigger className={cn(buttonVariants({ variant: "ghost", size: "icon" }))}>
|
|
<LanguagesIcon className="absolute h-[1.2rem] w-[1.2rem] light:opacity-85" />
|
|
<span className="sr-only">{LangTrans}</span>
|
|
<TooltipContent>{LangTrans}</TooltipContent>
|
|
</DropdownMenuTrigger>
|
|
</TooltipTrigger>
|
|
<DropdownMenuContent className="grid grid-cols-3">
|
|
{languages.map(([lang, label, e]) => (
|
|
<DropdownMenuItem
|
|
key={lang}
|
|
className={cn("px-2.5 flex gap-2.5 cursor-pointer", lang === i18n.locale && "bg-accent/70 font-medium")}
|
|
onClick={() => dynamicActivate(lang)}
|
|
>
|
|
<span>
|
|
{e || <code className="font-mono bg-muted text-[.65em] w-5 h-4 grid place-items-center">{lang}</code>}
|
|
</span>{" "}
|
|
{label}
|
|
</DropdownMenuItem>
|
|
))}
|
|
</DropdownMenuContent>
|
|
</Tooltip>
|
|
</DropdownMenu>
|
|
)
|
|
}
|