import { useCallback } from 'react' import { useTheme } from 'next-themes' import { Button, Select, Switch } from '@janhq/joi' import { useAtom, useAtomValue } from 'jotai' import { reduceTransparentAtom, selectedThemeIdAtom, spellCheckAtom, themeDataAtom, themesOptionsAtom, } from '@/helpers/atoms/Setting.atom' export default function AppearanceOptions() { const [selectedIdTheme, setSelectedIdTheme] = useAtom(selectedThemeIdAtom) const themeOptions = useAtomValue(themesOptionsAtom) const { setTheme } = useTheme() const [themeData, setThemeData] = useAtom(themeDataAtom) const [reduceTransparent, setReduceTransparent] = useAtom( reduceTransparentAtom ) const [spellCheck, setSpellCheck] = useAtom(spellCheckAtom) const handleClickTheme = useCallback( async (e: string) => { setSelectedIdTheme(e) const theme: Theme = await window.electronAPI.readTheme(e) setThemeData(theme) setTheme(String(theme?.nativeTheme)) if (theme?.reduceTransparent) { setReduceTransparent(reduceTransparent) } else { setReduceTransparent(true) } }, [ reduceTransparent, setReduceTransparent, setSelectedIdTheme, setTheme, setThemeData, ] ) return (
Select a color theme.
Translucent option is only available for some theme.
Toggle to enable or disable spell checking.