import Switch from '@components/forms/Switch' import useLocalStorageState from 'hooks/useLocalStorageState' import { useTranslation } from 'next-i18next' import { ANIMATION_SETTINGS_KEY } from 'utils/constants' import { SETTINGS_BUTTON_TITLE_CLASSES } from './AccountSettings' export const INITIAL_ANIMATION_SETTINGS = { 'number-scroll': false, 'orderbook-flash': false, 'swap-success': false, } const AnimationSettings = () => { const { t } = useTranslation(['common', 'settings']) const [animationSettings, setAnimationSettings] = useLocalStorageState( ANIMATION_SETTINGS_KEY, INITIAL_ANIMATION_SETTINGS, ) const handleToggleAnimationSetting = (settingName: string) => { if (settingName === 'all') { const toggle = !Object.values(animationSettings).includes(false) Object.keys(animationSettings).forEach((key) => { animationSettings[key] = !toggle }) setAnimationSettings(animationSettings) } else { setAnimationSettings({ ...animationSettings, [settingName]: !animationSettings[settingName], }) } } return (

{t('settings:animations')}

handleToggleAnimationSetting('all')} />

{t('settings:number-scroll')}

handleToggleAnimationSetting('number-scroll')} />

{t('settings:orderbook-flash')}

handleToggleAnimationSetting('orderbook-flash')} />

{t('settings:swap-success')}

handleToggleAnimationSetting('swap-success')} />
) } export default AnimationSettings