'use client' import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuRadioItemIndicator, DropdownMenuTrigger, } from '@langgenius/dify-ui/dropdown-menu' import { useTheme } from 'next-themes' import { useTranslation } from 'react-i18next' import ActionButton from '@/app/components/base/action-button' const THEMES = ['light', 'dark', 'system'] as const export type Theme = (typeof THEMES)[number] const isTheme = (value: string): value is Theme => { return (THEMES as readonly string[]).includes(value) } export default function ThemeSelector() { const { t } = useTranslation() const { theme, setTheme } = useTheme() const handleThemeChange = (newTheme: Theme) => { setTheme(newTheme) } const handleThemeValueChange = (value: string) => { if (isTheme(value)) handleThemeChange(value) } const getCurrentIcon = () => { switch (theme) { case 'light': return case 'dark': return default: return } } return ( $['theme.theme'], { ns: 'common' })} className="h-8 w-8 p-[6px] data-popup-open:bg-state-base-hover" /> } > {getCurrentIcon()} {t(($) => $['theme.light'], { ns: 'common' })} {t(($) => $['theme.dark'], { ns: 'common' })} {t(($) => $['theme.auto'], { ns: 'common' })} ) }