2024-05-15 16:54:55 +02:00
|
|
|
import { useState } from 'react';
|
2024-05-09 16:04:24 +02:00
|
|
|
import { useNavigate } from 'react-router-dom';
|
2024-05-09 18:29:55 +02:00
|
|
|
import { useTranslation } from 'react-i18next';
|
2024-05-10 12:46:52 +02:00
|
|
|
import styles from './settings-modal.module.css';
|
2024-05-15 16:54:55 +02:00
|
|
|
import AccountSettings from './account-settings';
|
|
|
|
|
import CryptoAddressSetting from './crypto-address-setting';
|
2024-05-15 21:20:14 +02:00
|
|
|
import CryptoWalletsSetting from './crypto-wallets-setting';
|
2024-05-16 22:41:36 +02:00
|
|
|
import InterfaceSettings from './interface-settings';
|
2024-05-10 17:03:33 +02:00
|
|
|
|
2024-05-09 18:29:55 +02:00
|
|
|
const SettingsModal = () => {
|
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
|
|
|
|
|
const closeModal = () => {
|
|
|
|
|
navigate(-1);
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-16 22:41:36 +02:00
|
|
|
const [showInterfaceSettings, setShowInterfaceSettings] = useState(false);
|
2024-05-10 17:03:33 +02:00
|
|
|
const [showAccountSettings, setShowAccountSettings] = useState(false);
|
2024-05-15 16:54:55 +02:00
|
|
|
const [showCryptoAddressSetting, setShowCryptoAddressSetting] = useState(false);
|
|
|
|
|
const [showCryptoWalletSettings, setShowCryptoWalletSettings] = useState(false);
|
2024-05-16 22:00:22 +02:00
|
|
|
const [expandAll, setExpandAll] = useState(false);
|
|
|
|
|
|
|
|
|
|
const handleExpandAll = () => {
|
|
|
|
|
const newExpandState = !expandAll;
|
|
|
|
|
setExpandAll(newExpandState);
|
2024-05-16 22:41:36 +02:00
|
|
|
setShowInterfaceSettings(newExpandState);
|
2024-05-16 22:00:22 +02:00
|
|
|
setShowAccountSettings(newExpandState);
|
|
|
|
|
setShowCryptoAddressSetting(newExpandState);
|
|
|
|
|
setShowCryptoWalletSettings(newExpandState);
|
|
|
|
|
};
|
2024-05-10 17:03:33 +02:00
|
|
|
|
2024-05-09 18:29:55 +02:00
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div className={styles.overlay} onClick={closeModal}></div>
|
|
|
|
|
<div className={styles.settingsModal}>
|
|
|
|
|
<div className={styles.header}>
|
|
|
|
|
<span className={styles.title}>{t('settings')}</span>
|
|
|
|
|
<span className={styles.closeButton} title='close' onClick={closeModal} />
|
|
|
|
|
</div>
|
2024-05-16 22:00:22 +02:00
|
|
|
<div className={styles.expandAllSettings}>
|
2024-05-31 17:09:20 +02:00
|
|
|
[<span onClick={handleExpandAll}>{expandAll ? t('collapse_all_settings') : t('expand_all_settings')}</span>]
|
2024-05-16 22:00:22 +02:00
|
|
|
</div>
|
2024-05-16 22:41:36 +02:00
|
|
|
<div className={`${styles.setting} ${styles.category}`}>
|
|
|
|
|
<label onClick={() => setShowInterfaceSettings(!showInterfaceSettings)}>
|
|
|
|
|
<span className={showInterfaceSettings ? styles.hideButton : styles.showButton} />
|
2024-05-31 16:51:22 +02:00
|
|
|
{t('interface')}
|
2024-05-16 22:41:36 +02:00
|
|
|
</label>
|
2024-05-10 12:46:52 +02:00
|
|
|
</div>
|
2024-05-16 22:41:36 +02:00
|
|
|
{showInterfaceSettings && <InterfaceSettings />}
|
2024-05-10 17:03:33 +02:00
|
|
|
<div className={`${styles.setting} ${styles.category}`}>
|
|
|
|
|
<label onClick={() => setShowAccountSettings(!showAccountSettings)}>
|
|
|
|
|
<span className={showAccountSettings ? styles.hideButton : styles.showButton} />
|
2024-05-15 22:12:32 +02:00
|
|
|
{t('account')}
|
2024-05-10 17:03:33 +02:00
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
{showAccountSettings && <AccountSettings />}
|
2024-05-15 16:54:55 +02:00
|
|
|
<div className={`${styles.setting} ${styles.category}`}>
|
|
|
|
|
<label onClick={() => setShowCryptoAddressSetting(!showCryptoAddressSetting)}>
|
|
|
|
|
<span className={showCryptoAddressSetting ? styles.hideButton : styles.showButton} />
|
2024-05-15 22:12:32 +02:00
|
|
|
{t('crypto_address')}
|
2024-05-15 16:54:55 +02:00
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
{showCryptoAddressSetting && <CryptoAddressSetting />}
|
|
|
|
|
<div className={`${styles.setting} ${styles.category}`}>
|
|
|
|
|
<label onClick={() => setShowCryptoWalletSettings(!showCryptoWalletSettings)}>
|
|
|
|
|
<span className={showCryptoWalletSettings ? styles.hideButton : styles.showButton} />
|
2024-05-15 22:12:32 +02:00
|
|
|
{t('crypto_wallets')}
|
2024-05-15 16:54:55 +02:00
|
|
|
</label>
|
|
|
|
|
</div>
|
2024-05-15 21:20:14 +02:00
|
|
|
{showCryptoWalletSettings && <CryptoWalletsSetting />}
|
2024-05-09 18:29:55 +02:00
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-09 16:04:24 +02:00
|
|
|
export default SettingsModal;
|