2021-08-05 11:18:16 +02:00
|
|
|
// @flow
|
2021-08-08 10:13:35 +02:00
|
|
|
import { SETTINGS_GRP } from 'constants/settings';
|
2021-08-05 11:18:16 +02:00
|
|
|
import React from 'react';
|
2021-10-08 05:47:39 +02:00
|
|
|
import * as SETTINGS from 'constants/settings';
|
2021-08-05 11:18:16 +02:00
|
|
|
import Card from 'component/common/card';
|
2021-08-05 14:48:04 +02:00
|
|
|
import { FormField } from 'component/common/form';
|
2021-08-05 11:18:16 +02:00
|
|
|
import HomepageSelector from 'component/homepageSelector';
|
|
|
|
import SettingLanguage from 'component/settingLanguage';
|
2021-08-05 15:16:10 +02:00
|
|
|
import SettingsRow from 'component/settingsRow';
|
2021-08-05 14:39:08 +02:00
|
|
|
import ThemeSelector from 'component/themeSelector';
|
2021-08-05 11:18:16 +02:00
|
|
|
// $FlowFixMe
|
|
|
|
import homepages from 'homepages';
|
|
|
|
|
2021-08-05 14:48:04 +02:00
|
|
|
type Props = {
|
2022-06-28 22:01:19 +02:00
|
|
|
disableBackground: boolean,
|
2021-08-05 14:48:04 +02:00
|
|
|
clock24h: boolean,
|
2021-08-05 15:16:10 +02:00
|
|
|
searchInLanguage: boolean,
|
2021-08-08 04:26:40 +02:00
|
|
|
hideBalance: boolean,
|
2021-08-05 14:48:04 +02:00
|
|
|
setClientSetting: (string, boolean | string | number) => void,
|
2021-08-05 15:16:10 +02:00
|
|
|
setSearchInLanguage: (boolean) => void,
|
2021-08-05 14:48:04 +02:00
|
|
|
};
|
2021-08-05 11:18:16 +02:00
|
|
|
|
|
|
|
export default function SettingAppearance(props: Props) {
|
2022-06-28 22:01:19 +02:00
|
|
|
const { clock24h, disableBackground, searchInLanguage, hideBalance, setClientSetting, setSearchInLanguage } = props;
|
2021-08-05 14:48:04 +02:00
|
|
|
|
2021-08-05 11:18:16 +02:00
|
|
|
return (
|
2021-08-09 04:22:16 +02:00
|
|
|
<>
|
|
|
|
<div className="card__title-section">
|
|
|
|
<h2 className="card__title">{__('Appearance')}</h2>
|
|
|
|
</div>
|
|
|
|
<Card
|
|
|
|
id={SETTINGS_GRP.APPEARANCE}
|
|
|
|
isBodyList
|
|
|
|
body={
|
|
|
|
<>
|
|
|
|
{homepages && Object.keys(homepages).length > 1 && (
|
|
|
|
<SettingsRow title={__('Homepage')} subtitle={__('Tailor your experience.')}>
|
|
|
|
<HomepageSelector />
|
|
|
|
</SettingsRow>
|
|
|
|
)}
|
2021-08-05 15:16:10 +02:00
|
|
|
|
2021-08-09 04:22:16 +02:00
|
|
|
<SettingsRow title={__('Language')} subtitle={__(HELP.LANGUAGE)}>
|
|
|
|
<SettingLanguage />
|
|
|
|
</SettingsRow>
|
2021-08-05 14:39:08 +02:00
|
|
|
|
2021-08-09 04:22:16 +02:00
|
|
|
<SettingsRow title={__('Search only in the selected language by default')}>
|
|
|
|
<FormField
|
|
|
|
name="search-in-language"
|
|
|
|
type="checkbox"
|
|
|
|
checked={searchInLanguage}
|
|
|
|
onChange={() => setSearchInLanguage(!searchInLanguage)}
|
|
|
|
/>
|
|
|
|
</SettingsRow>
|
2021-08-05 14:48:04 +02:00
|
|
|
|
2021-08-09 04:22:16 +02:00
|
|
|
<SettingsRow title={__('Theme')}>
|
|
|
|
<ThemeSelector />
|
|
|
|
</SettingsRow>
|
2021-08-08 04:26:40 +02:00
|
|
|
|
2021-08-09 04:22:16 +02:00
|
|
|
<SettingsRow title={__('24-hour clock')}>
|
2021-08-08 04:26:40 +02:00
|
|
|
<FormField
|
|
|
|
type="checkbox"
|
2021-08-09 04:22:16 +02:00
|
|
|
name="clock24h"
|
|
|
|
onChange={() => setClientSetting(SETTINGS.CLOCK_24H, !clock24h)}
|
|
|
|
checked={clock24h}
|
2021-08-08 04:26:40 +02:00
|
|
|
/>
|
|
|
|
</SettingsRow>
|
2022-06-28 22:01:19 +02:00
|
|
|
<SettingsRow title={__('Disable background')}>
|
|
|
|
<FormField
|
|
|
|
type="checkbox"
|
|
|
|
name="background"
|
|
|
|
onChange={() => setClientSetting(SETTINGS.DISABLE_BACKGROUND, !disableBackground)}
|
|
|
|
checked={disableBackground}
|
|
|
|
/>
|
|
|
|
</SettingsRow>
|
2022-01-07 20:02:33 +01:00
|
|
|
<SettingsRow title={__('Hide wallet balance in header')}>
|
|
|
|
<FormField
|
|
|
|
type="checkbox"
|
|
|
|
name="hide_balance"
|
|
|
|
onChange={() => setClientSetting(SETTINGS.HIDE_BALANCE, !hideBalance)}
|
|
|
|
checked={hideBalance}
|
|
|
|
/>
|
|
|
|
</SettingsRow>
|
2021-08-09 04:22:16 +02:00
|
|
|
</>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</>
|
2021-08-05 11:18:16 +02:00
|
|
|
);
|
|
|
|
}
|
2021-08-05 15:16:10 +02:00
|
|
|
|
2021-08-09 04:22:16 +02:00
|
|
|
// prettier-ignore
|
2021-08-05 15:16:10 +02:00
|
|
|
const HELP = {
|
|
|
|
LANGUAGE: 'Multi-language support is brand new and incomplete. Switching your language may have unintended consequences, like glossolalia.',
|
|
|
|
};
|