import Switch from '@components/forms/Switch' import useLocalStorageState from 'hooks/useLocalStorageState' import { useTranslation } from 'next-i18next' import { SOUND_SETTINGS_KEY } from 'utils/constants' export const INITIAL_SOUND_SETTINGS = { 'recent-trades': false, 'swap-success': false, 'transaction-success': false, 'transaction-fail': false, } const SoundSettings = () => { const { t } = useTranslation(['common', 'settings']) const [soundSettings, setSoundSettings] = useLocalStorageState( SOUND_SETTINGS_KEY, INITIAL_SOUND_SETTINGS ) const handleToggleSoundSetting = (settingName: string) => { if (settingName === 'all') { const toggle = !Object.values(soundSettings).includes(false) Object.keys(soundSettings).forEach((key) => { soundSettings[key] = !toggle }) setSoundSettings(soundSettings) } else { setSoundSettings({ ...soundSettings, [settingName]: !soundSettings[settingName], }) } } return ( <>
{t('settings:recent-trades')}
{t('settings:swap-success')}
{t('settings:transaction-success')}
{t('settings:transaction-fail')}