import { Moon, Sun } from 'lucide-react' import { useTheme } from 'next-themes' import { useEffect, useState } from 'react' import Panel from 'components/ui/Panel' import { Listbox, Theme, themes } from 'ui' const ThemeSettings = () => { const [mounted, setMounted] = useState(false) const { theme, resolvedTheme, setTheme } = useTheme() /** * Avoid Hydration Mismatch * https://github.com/pacocoursey/next-themes?tab=readme-ov-file#avoid-hydration-mismatch */ // useEffect only runs on the client, so now we can safely show the UI useEffect(() => { setMounted(true) }, []) if (!mounted) { return null } return ( Theme}> : } onChange={(value: string) => setTheme(value)} > {themes .filter( (theme: Theme) => // temporary fix to exclude new themes theme.value === 'light' || theme.value === 'dark' || theme.value === 'system' ) .map((theme: Theme) => ( {theme.name} ))} ) } export default ThemeSettings