2022-04-11 21:57:07 +00:00
|
|
|
import variables from 'modules/variables';
|
|
|
|
import { PureComponent } from 'react';
|
|
|
|
import Modal from 'react-modal';
|
|
|
|
import { MenuItem } from '@mui/material';
|
2022-04-08 13:48:36 +00:00
|
|
|
import {
|
|
|
|
MdUpload as ImportIcon,
|
|
|
|
MdDownload as ExportIcon,
|
|
|
|
MdRestartAlt as ResetIcon,
|
2022-04-11 21:57:07 +00:00
|
|
|
} from 'react-icons/md';
|
2021-08-15 21:28:37 +00:00
|
|
|
|
2022-04-11 21:57:07 +00:00
|
|
|
import { exportSettings, importSettings } from 'modules/helpers/settings/modals';
|
2021-02-28 20:30:57 +00:00
|
|
|
|
2022-04-11 21:57:07 +00:00
|
|
|
import Checkbox from '../Checkbox';
|
|
|
|
import FileUpload from '../FileUpload';
|
|
|
|
import Text from '../Text';
|
|
|
|
import Switch from '../Switch';
|
|
|
|
import ResetModal from '../ResetModal';
|
|
|
|
import Dropdown from '../Dropdown';
|
|
|
|
import SettingsItem from '../SettingsItem';
|
2021-02-28 20:30:57 +00:00
|
|
|
|
2022-04-11 21:57:07 +00:00
|
|
|
const time_zones = require('components/widgets/time/timezones.json');
|
2021-07-17 14:51:57 +00:00
|
|
|
|
2021-08-14 19:10:48 +00:00
|
|
|
export default class AdvancedSettings extends PureComponent {
|
2021-03-23 13:10:34 +00:00
|
|
|
constructor() {
|
|
|
|
super();
|
2021-03-19 20:18:57 +00:00
|
|
|
this.state = {
|
2022-04-08 13:48:36 +00:00
|
|
|
resetModal: false,
|
2021-03-19 20:18:57 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-03-17 13:01:53 +00:00
|
|
|
render() {
|
2022-04-11 21:57:07 +00:00
|
|
|
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
2021-03-18 15:22:41 +00:00
|
|
|
|
2021-03-17 13:01:53 +00:00
|
|
|
return (
|
2021-03-22 22:17:52 +00:00
|
|
|
<>
|
2022-04-08 13:48:36 +00:00
|
|
|
<span className="mainTitle">
|
2022-04-11 21:57:07 +00:00
|
|
|
{getMessage('modals.main.settings.sections.advanced.title')}
|
2022-04-08 13:48:36 +00:00
|
|
|
</span>
|
2022-04-11 21:57:07 +00:00
|
|
|
<SettingsItem title={getMessage('modals.main.settings.sections.advanced.offline_mode')}>
|
2022-04-08 13:48:36 +00:00
|
|
|
<Switch
|
|
|
|
name="offlineMode"
|
2022-04-11 21:57:07 +00:00
|
|
|
text={getMessage('modals.main.settings.sections.advanced.offline_mode')}
|
2022-04-08 13:48:36 +00:00
|
|
|
element=".other"
|
|
|
|
/>
|
|
|
|
</SettingsItem>
|
2022-04-11 21:57:07 +00:00
|
|
|
{localStorage.getItem('welcomePreview') !== 'true' ? (
|
2022-04-08 13:48:36 +00:00
|
|
|
<div className="settingsRow">
|
|
|
|
<div className="content">
|
|
|
|
<span className="title">
|
2022-04-11 21:57:07 +00:00
|
|
|
{getMessage('modals.main.settings.sections.advanced.data')}
|
2022-04-08 13:48:36 +00:00
|
|
|
</span>
|
|
|
|
<span className="subtitle">
|
2022-04-11 21:57:07 +00:00
|
|
|
{getMessage('modals.main.settings.sections.advanced.experimental_warning')}
|
2022-04-08 13:48:36 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div className="action activityButtons">
|
|
|
|
<button onClick={() => this.setState({ resetModal: true })}>
|
2022-04-11 21:57:07 +00:00
|
|
|
{getMessage('modals.main.settings.buttons.reset')}
|
2022-04-08 13:48:36 +00:00
|
|
|
<ResetIcon />
|
|
|
|
</button>
|
|
|
|
<button onClick={() => exportSettings()}>
|
2022-04-11 21:57:07 +00:00
|
|
|
{getMessage('modals.main.settings.buttons.export')}
|
2022-04-08 13:48:36 +00:00
|
|
|
<ExportIcon />
|
|
|
|
</button>
|
2022-04-11 21:57:07 +00:00
|
|
|
<button onClick={() => document.getElementById('file-input').click()}>
|
|
|
|
{getMessage('modals.main.settings.buttons.import')}
|
2022-04-08 13:48:36 +00:00
|
|
|
<ImportIcon />
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
) : null}
|
|
|
|
<SettingsItem title="This should really be in time">
|
|
|
|
<Dropdown
|
|
|
|
name="timezone"
|
2022-04-11 21:57:07 +00:00
|
|
|
label={getMessage('modals.main.settings.sections.advanced.timezone.title')}
|
2022-04-08 13:48:36 +00:00
|
|
|
category="timezone"
|
|
|
|
manual={true}
|
|
|
|
>
|
|
|
|
<MenuItem value="auto">
|
2022-04-11 21:57:07 +00:00
|
|
|
{getMessage('modals.main.settings.sections.advanced.timezone.automatic')}
|
2022-04-08 13:48:36 +00:00
|
|
|
</MenuItem>
|
|
|
|
{time_zones.map((timezone) => (
|
|
|
|
<MenuItem value={timezone} key={timezone}>
|
|
|
|
{timezone}
|
|
|
|
</MenuItem>
|
|
|
|
))}
|
|
|
|
</Dropdown>
|
|
|
|
</SettingsItem>
|
2022-04-11 21:57:07 +00:00
|
|
|
<SettingsItem title={getMessage('modals.main.settings.sections.advanced.tab_name')}>
|
2022-04-08 13:48:36 +00:00
|
|
|
<Text
|
2022-04-11 21:57:07 +00:00
|
|
|
title={getMessage('modals.main.settings.sections.advanced.tab_name')}
|
2022-04-08 13:48:36 +00:00
|
|
|
name="tabName"
|
2022-04-11 21:57:07 +00:00
|
|
|
default={getMessage('tabname')}
|
2022-04-08 13:48:36 +00:00
|
|
|
category="other"
|
|
|
|
/>
|
|
|
|
</SettingsItem>
|
|
|
|
<FileUpload
|
|
|
|
id="file-input"
|
|
|
|
accept="application/json"
|
|
|
|
type="settings"
|
|
|
|
loadFunction={(e) => importSettings(e)}
|
|
|
|
/>
|
2022-04-11 21:57:07 +00:00
|
|
|
<SettingsItem title={getMessage('modals.main.settings.sections.advanced.custom_css')}>
|
2022-04-08 13:48:36 +00:00
|
|
|
<Text
|
2022-04-11 21:57:07 +00:00
|
|
|
title={getMessage('modals.main.settings.sections.advanced.custom_css')}
|
2022-04-08 13:48:36 +00:00
|
|
|
name="customcss"
|
|
|
|
textarea={true}
|
|
|
|
category="other"
|
|
|
|
/>
|
|
|
|
</SettingsItem>
|
|
|
|
<div className="settingsRow">
|
|
|
|
<div className="content">
|
|
|
|
<span className="title">
|
2022-04-11 21:57:07 +00:00
|
|
|
{getMessage('modals.main.settings.sections.experimental.title')}
|
2022-04-08 13:48:36 +00:00
|
|
|
</span>
|
|
|
|
<span className="subtitle">
|
2022-04-11 21:57:07 +00:00
|
|
|
{getMessage('modals.main.settings.sections.advanced.experimental_warning')}
|
2022-04-08 13:48:36 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div className="action">
|
|
|
|
<Switch
|
|
|
|
name="experimental"
|
2022-04-11 21:57:07 +00:00
|
|
|
text={getMessage('modals.main.settings.enabled')}
|
2022-04-08 13:48:36 +00:00
|
|
|
element=".other"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-03-19 15:56:48 +00:00
|
|
|
|
2022-04-08 13:48:36 +00:00
|
|
|
<Modal
|
|
|
|
closeTimeoutMS={100}
|
|
|
|
onRequestClose={() => this.setState({ resetModal: false })}
|
|
|
|
isOpen={this.state.resetModal}
|
|
|
|
className="Modal resetmodal mainModal"
|
|
|
|
overlayClassName="Overlay resetoverlay"
|
|
|
|
ariaHideApp={false}
|
|
|
|
>
|
2021-03-19 20:18:57 +00:00
|
|
|
<ResetModal modalClose={() => this.setState({ resetModal: false })} />
|
|
|
|
</Modal>
|
2021-03-22 22:17:52 +00:00
|
|
|
</>
|
2021-03-17 13:01:53 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|