import { Theme } from "@/components/ThemeProvider" import { Button } from "@/components/ui/button" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu" import { cn } from "@/lib/utils" import { CheckCircleIcon } from "@heroicons/react/20/solid" import { Moon, Sun } from "lucide-react" import { useTranslation } from "react-i18next" import { useTheme } from "../hooks/use-theme" export function ModeToggle() { const { t } = useTranslation() const { setTheme, theme } = useTheme() const customBackgroundImage = // @ts-expect-error CustomBackgroundImage is a global variable (window.CustomBackgroundImage as string) !== "" ? window.CustomBackgroundImage : undefined const handleSelect = (e: Event, newTheme: Theme) => { e.preventDefault() setTheme(newTheme) } return ( handleSelect(e, "light")}> {t("theme.light")} {theme === "light" && } handleSelect(e, "dark")}> {t("theme.dark")} {theme === "dark" && } handleSelect(e, "system")}> {t("theme.system")} {theme === "system" && } ) }