mirror of
https://github.com/mue/mue.git
synced 2026-07-14 12:34:03 +02:00
fix: author loading before quote
- Make author div not load if quote is empty - photoinformation taking too much of the screen - more transitions and consistent transitions - running prettier across all files Co-authored-by: David Ralph <me@davidcralph.co.uk>
This commit is contained in:
@@ -134,7 +134,7 @@ export default class About extends PureComponent {
|
||||
<span className="mainTitle">
|
||||
{this.getMessage('modals.main.settings.sections.about.title')}
|
||||
</span>
|
||||
<div className='settingsRow' style={{ justifyContent: 'center' }}>
|
||||
<div className="settingsRow" style={{ justifyContent: 'center' }}>
|
||||
<div style={{ display: 'flex', flexFlow: 'column', gap: '5px' }}>
|
||||
<img draggable="false" className="aboutLogo" src={this.state.image} alt="Logo" />
|
||||
<span className="title">
|
||||
@@ -179,10 +179,10 @@ export default class About extends PureComponent {
|
||||
{this.getMessage('modals.main.settings.sections.about.contact_us')}
|
||||
</span>
|
||||
<div className="aboutContact">
|
||||
<a class='donateButton' href='https://muetab.com/contact'>
|
||||
<MdContactPage />
|
||||
Form
|
||||
</a>
|
||||
<a class="donateButton" href="https://muetab.com/contact">
|
||||
<MdContactPage />
|
||||
Form
|
||||
</a>
|
||||
<Tooltip title={'Email'}>
|
||||
<a
|
||||
href={'mailto:' + variables.constants.EMAIL}
|
||||
@@ -217,13 +217,16 @@ export default class About extends PureComponent {
|
||||
<span className="title">
|
||||
{this.getMessage('modals.main.settings.sections.about.support_mue')}
|
||||
</span>
|
||||
<p>As Mue is entirely free, we rely on donations to cover pay the server bills and fund development</p>
|
||||
<p>
|
||||
As Mue is entirely free, we rely on donations to cover pay the server bills and fund
|
||||
development
|
||||
</p>
|
||||
<div className="aboutContact">
|
||||
<a class='donateButton' href={variables.constants.DONATE_LINK}>
|
||||
<a class="donateButton" href={variables.constants.DONATE_LINK}>
|
||||
<BiDonateHeart />
|
||||
Donate
|
||||
</a>
|
||||
<Tooltip title={'Github Sponsors'}>
|
||||
</a>
|
||||
<Tooltip title={'Github Sponsors'}>
|
||||
<a
|
||||
href={'https://discord.gg/' + variables.constants.DISCORD_SERVER}
|
||||
target="_blank"
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
import variables from "modules/variables";
|
||||
import { PureComponent } from "react";
|
||||
import Modal from "react-modal";
|
||||
import { MenuItem } from "@mui/material";
|
||||
import variables from 'modules/variables';
|
||||
import { PureComponent } from 'react';
|
||||
import Modal from 'react-modal';
|
||||
import { MenuItem } from '@mui/material';
|
||||
import {
|
||||
MdUpload as ImportIcon,
|
||||
MdDownload as ExportIcon,
|
||||
MdRestartAlt as ResetIcon,
|
||||
} from "react-icons/md";
|
||||
} from 'react-icons/md';
|
||||
|
||||
import {
|
||||
exportSettings,
|
||||
importSettings,
|
||||
} from "modules/helpers/settings/modals";
|
||||
import { exportSettings, importSettings } from 'modules/helpers/settings/modals';
|
||||
|
||||
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";
|
||||
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';
|
||||
|
||||
const time_zones = require("components/widgets/time/timezones.json");
|
||||
const time_zones = require('components/widgets/time/timezones.json');
|
||||
|
||||
export default class AdvancedSettings extends PureComponent {
|
||||
constructor() {
|
||||
@@ -32,52 +29,41 @@ export default class AdvancedSettings extends PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
const getMessage = (text) =>
|
||||
variables.language.getMessage(variables.languagecode, text);
|
||||
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
||||
|
||||
return (
|
||||
<>
|
||||
<span className="mainTitle">
|
||||
{getMessage("modals.main.settings.sections.advanced.title")}
|
||||
{getMessage('modals.main.settings.sections.advanced.title')}
|
||||
</span>
|
||||
<SettingsItem
|
||||
title={getMessage(
|
||||
"modals.main.settings.sections.advanced.offline_mode"
|
||||
)}
|
||||
>
|
||||
<SettingsItem title={getMessage('modals.main.settings.sections.advanced.offline_mode')}>
|
||||
<Switch
|
||||
name="offlineMode"
|
||||
text={getMessage(
|
||||
"modals.main.settings.sections.advanced.offline_mode"
|
||||
)}
|
||||
text={getMessage('modals.main.settings.sections.advanced.offline_mode')}
|
||||
element=".other"
|
||||
/>
|
||||
</SettingsItem>
|
||||
{localStorage.getItem("welcomePreview") !== "true" ? (
|
||||
{localStorage.getItem('welcomePreview') !== 'true' ? (
|
||||
<div className="settingsRow">
|
||||
<div className="content">
|
||||
<span className="title">
|
||||
{getMessage("modals.main.settings.sections.advanced.data")}
|
||||
{getMessage('modals.main.settings.sections.advanced.data')}
|
||||
</span>
|
||||
<span className="subtitle">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.advanced.experimental_warning"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.advanced.experimental_warning')}
|
||||
</span>
|
||||
</div>
|
||||
<div className="action activityButtons">
|
||||
<button onClick={() => this.setState({ resetModal: true })}>
|
||||
{getMessage("modals.main.settings.buttons.reset")}
|
||||
{getMessage('modals.main.settings.buttons.reset')}
|
||||
<ResetIcon />
|
||||
</button>
|
||||
<button onClick={() => exportSettings()}>
|
||||
{getMessage("modals.main.settings.buttons.export")}
|
||||
{getMessage('modals.main.settings.buttons.export')}
|
||||
<ExportIcon />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => document.getElementById("file-input").click()}
|
||||
>
|
||||
{getMessage("modals.main.settings.buttons.import")}
|
||||
<button onClick={() => document.getElementById('file-input').click()}>
|
||||
{getMessage('modals.main.settings.buttons.import')}
|
||||
<ImportIcon />
|
||||
</button>
|
||||
</div>
|
||||
@@ -86,16 +72,12 @@ export default class AdvancedSettings extends PureComponent {
|
||||
<SettingsItem title="This should really be in time">
|
||||
<Dropdown
|
||||
name="timezone"
|
||||
label={getMessage(
|
||||
"modals.main.settings.sections.advanced.timezone.title"
|
||||
)}
|
||||
label={getMessage('modals.main.settings.sections.advanced.timezone.title')}
|
||||
category="timezone"
|
||||
manual={true}
|
||||
>
|
||||
<MenuItem value="auto">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.advanced.timezone.automatic"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.advanced.timezone.automatic')}
|
||||
</MenuItem>
|
||||
{time_zones.map((timezone) => (
|
||||
<MenuItem value={timezone} key={timezone}>
|
||||
@@ -104,15 +86,11 @@ export default class AdvancedSettings extends PureComponent {
|
||||
))}
|
||||
</Dropdown>
|
||||
</SettingsItem>
|
||||
<SettingsItem
|
||||
title={getMessage("modals.main.settings.sections.advanced.tab_name")}
|
||||
>
|
||||
<SettingsItem title={getMessage('modals.main.settings.sections.advanced.tab_name')}>
|
||||
<Text
|
||||
title={getMessage(
|
||||
"modals.main.settings.sections.advanced.tab_name"
|
||||
)}
|
||||
title={getMessage('modals.main.settings.sections.advanced.tab_name')}
|
||||
name="tabName"
|
||||
default={getMessage("tabname")}
|
||||
default={getMessage('tabname')}
|
||||
category="other"
|
||||
/>
|
||||
</SettingsItem>
|
||||
@@ -122,15 +100,9 @@ export default class AdvancedSettings extends PureComponent {
|
||||
type="settings"
|
||||
loadFunction={(e) => importSettings(e)}
|
||||
/>
|
||||
<SettingsItem
|
||||
title={getMessage(
|
||||
"modals.main.settings.sections.advanced.custom_css"
|
||||
)}
|
||||
>
|
||||
<SettingsItem title={getMessage('modals.main.settings.sections.advanced.custom_css')}>
|
||||
<Text
|
||||
title={getMessage(
|
||||
"modals.main.settings.sections.advanced.custom_css"
|
||||
)}
|
||||
title={getMessage('modals.main.settings.sections.advanced.custom_css')}
|
||||
name="customcss"
|
||||
textarea={true}
|
||||
category="other"
|
||||
@@ -139,18 +111,16 @@ export default class AdvancedSettings extends PureComponent {
|
||||
<div className="settingsRow">
|
||||
<div className="content">
|
||||
<span className="title">
|
||||
{getMessage("modals.main.settings.sections.experimental.title")}
|
||||
{getMessage('modals.main.settings.sections.experimental.title')}
|
||||
</span>
|
||||
<span className="subtitle">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.advanced.experimental_warning"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.advanced.experimental_warning')}
|
||||
</span>
|
||||
</div>
|
||||
<div className="action">
|
||||
<Switch
|
||||
name="experimental"
|
||||
text={getMessage("modals.main.settings.enabled")}
|
||||
text={getMessage('modals.main.settings.enabled')}
|
||||
element=".other"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,53 +1,52 @@
|
||||
import variables from "modules/variables";
|
||||
import variables from 'modules/variables';
|
||||
|
||||
import Checkbox from "../Checkbox";
|
||||
import Dropdown from "../Dropdown";
|
||||
import Radio from "../Radio";
|
||||
import Slider from "../Slider";
|
||||
import Text from "../Text";
|
||||
import SettingsItem from "../SettingsItem";
|
||||
import Checkbox from '../Checkbox';
|
||||
import Dropdown from '../Dropdown';
|
||||
import Radio from '../Radio';
|
||||
import Slider from '../Slider';
|
||||
import Text from '../Text';
|
||||
import SettingsItem from '../SettingsItem';
|
||||
|
||||
import { values } from "modules/helpers/settings/modals";
|
||||
import { values } from 'modules/helpers/settings/modals';
|
||||
|
||||
export default function AppearanceSettings() {
|
||||
const getMessage = (text) =>
|
||||
variables.language.getMessage(variables.languagecode, text);
|
||||
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
||||
|
||||
const themeOptions = [
|
||||
{
|
||||
name: getMessage("modals.main.settings.sections.appearance.theme.auto"),
|
||||
value: "auto",
|
||||
name: getMessage('modals.main.settings.sections.appearance.theme.auto'),
|
||||
value: 'auto',
|
||||
},
|
||||
{
|
||||
name: getMessage("modals.main.settings.sections.appearance.theme.light"),
|
||||
value: "light",
|
||||
name: getMessage('modals.main.settings.sections.appearance.theme.light'),
|
||||
value: 'light',
|
||||
},
|
||||
{
|
||||
name: getMessage("modals.main.settings.sections.appearance.theme.dark"),
|
||||
value: "dark",
|
||||
name: getMessage('modals.main.settings.sections.appearance.theme.dark'),
|
||||
value: 'dark',
|
||||
},
|
||||
];
|
||||
|
||||
const styleOptions = [
|
||||
{
|
||||
name: "Legacy",
|
||||
value: "legacy",
|
||||
name: 'Legacy',
|
||||
value: 'legacy',
|
||||
},
|
||||
{
|
||||
name: "New",
|
||||
value: "new",
|
||||
name: 'New',
|
||||
value: 'new',
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<span className="mainTitle">
|
||||
{getMessage("modals.main.settings.sections.appearance.title")}
|
||||
{getMessage('modals.main.settings.sections.appearance.title')}
|
||||
</span>
|
||||
<div className="settingsRow">
|
||||
<div className="content">
|
||||
<span className="title">
|
||||
{getMessage("modals.main.settings.sections.appearance.theme.title")}
|
||||
{getMessage('modals.main.settings.sections.appearance.theme.title')}
|
||||
</span>
|
||||
<span className="subtitle">subtitle</span>
|
||||
</div>
|
||||
@@ -58,96 +57,66 @@ export default function AppearanceSettings() {
|
||||
<div className="settingsRow">
|
||||
<div className="content">
|
||||
<span className="title">
|
||||
{getMessage("modals.main.settings.sections.appearance.font.title")}
|
||||
{getMessage('modals.main.settings.sections.appearance.font.title')}
|
||||
</span>
|
||||
<span className="subtitle">subtitle</span>
|
||||
</div>
|
||||
<div className="action">
|
||||
<Checkbox
|
||||
name="fontGoogle"
|
||||
text={getMessage(
|
||||
"modals.main.settings.sections.appearance.font.google"
|
||||
)}
|
||||
text={getMessage('modals.main.settings.sections.appearance.font.google')}
|
||||
category="other"
|
||||
/>
|
||||
<Text
|
||||
title={getMessage(
|
||||
"modals.main.settings.sections.appearance.font.custom"
|
||||
)}
|
||||
title={getMessage('modals.main.settings.sections.appearance.font.custom')}
|
||||
name="font"
|
||||
upperCaseFirst={true}
|
||||
category="other"
|
||||
/>
|
||||
<Dropdown
|
||||
label={getMessage(
|
||||
"modals.main.settings.sections.appearance.font.weight.title"
|
||||
)}
|
||||
label={getMessage('modals.main.settings.sections.appearance.font.weight.title')}
|
||||
name="fontweight"
|
||||
category="other"
|
||||
>
|
||||
{/* names are taken from https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight */}
|
||||
<option value="100">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.appearance.font.weight.thin"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.appearance.font.weight.thin')}
|
||||
</option>
|
||||
<option value="200">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.appearance.font.weight.extra_light"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.appearance.font.weight.extra_light')}
|
||||
</option>
|
||||
<option value="300">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.appearance.font.weight.light"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.appearance.font.weight.light')}
|
||||
</option>
|
||||
<option value="400">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.appearance.font.weight.normal"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.appearance.font.weight.normal')}
|
||||
</option>
|
||||
<option value="500">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.appearance.font.weight.medium"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.appearance.font.weight.medium')}
|
||||
</option>
|
||||
<option value="600">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.appearance.font.weight.semi_bold"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.appearance.font.weight.semi_bold')}
|
||||
</option>
|
||||
<option value="700">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.appearance.font.weight.bold"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.appearance.font.weight.bold')}
|
||||
</option>
|
||||
<option value="800">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.appearance.font.weight.extra_bold"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.appearance.font.weight.extra_bold')}
|
||||
</option>
|
||||
</Dropdown>
|
||||
<Dropdown
|
||||
label={getMessage(
|
||||
"modals.main.settings.sections.appearance.font.style.title"
|
||||
)}
|
||||
label={getMessage('modals.main.settings.sections.appearance.font.style.title')}
|
||||
name="fontstyle"
|
||||
category="other"
|
||||
>
|
||||
<option value="normal">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.appearance.font.style.normal"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.appearance.font.style.normal')}
|
||||
</option>
|
||||
<option value="italic">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.appearance.font.style.italic"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.appearance.font.style.italic')}
|
||||
</option>
|
||||
<option value="oblique">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.appearance.font.style.oblique"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.appearance.font.style.oblique')}
|
||||
</option>
|
||||
</Dropdown>
|
||||
</div>
|
||||
@@ -167,17 +136,13 @@ export default function AppearanceSettings() {
|
||||
<div className="settingsRow">
|
||||
<div className="content">
|
||||
<span className="title">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.appearance.accessibility.title"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.appearance.accessibility.title')}
|
||||
</span>
|
||||
<span className="subtitle">subtitle</span>
|
||||
</div>
|
||||
<div className="action">
|
||||
<Dropdown
|
||||
label={getMessage(
|
||||
"modals.main.settings.sections.appearance.accessibility.text_shadow"
|
||||
)}
|
||||
label={getMessage('modals.main.settings.sections.appearance.accessibility.text_shadow')}
|
||||
name="textBorder"
|
||||
category="other"
|
||||
>
|
||||
@@ -186,27 +151,23 @@ export default function AppearanceSettings() {
|
||||
<option value="none">None</option>
|
||||
</Dropdown>
|
||||
<Checkbox
|
||||
text={getMessage(
|
||||
"modals.main.settings.sections.appearance.accessibility.animations"
|
||||
)}
|
||||
text={getMessage('modals.main.settings.sections.appearance.accessibility.animations')}
|
||||
name="animations"
|
||||
category="other"
|
||||
/>
|
||||
<Slider
|
||||
title={getMessage(
|
||||
"modals.main.settings.sections.appearance.accessibility.toast_duration"
|
||||
'modals.main.settings.sections.appearance.accessibility.toast_duration',
|
||||
)}
|
||||
name="toastDisplayTime"
|
||||
default="2500"
|
||||
step="100"
|
||||
min="500"
|
||||
max="5000"
|
||||
marks={values("toast")}
|
||||
marks={values('toast')}
|
||||
display={
|
||||
" " +
|
||||
getMessage(
|
||||
"modals.main.settings.sections.appearance.accessibility.milliseconds"
|
||||
)
|
||||
' ' +
|
||||
getMessage('modals.main.settings.sections.appearance.accessibility.milliseconds')
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import variables from "modules/variables";
|
||||
import { PureComponent, createRef } from "react";
|
||||
import { MdOutlineWifiOff } from "react-icons/md";
|
||||
import Modal from "react-modal";
|
||||
import variables from 'modules/variables';
|
||||
import { PureComponent, createRef } from 'react';
|
||||
import { MdOutlineWifiOff } from 'react-icons/md';
|
||||
import Modal from 'react-modal';
|
||||
|
||||
import Lightbox from "../../marketplace/Lightbox";
|
||||
import Lightbox from '../../marketplace/Lightbox';
|
||||
|
||||
export default class Changelog extends PureComponent {
|
||||
constructor() {
|
||||
@@ -13,14 +13,14 @@ export default class Changelog extends PureComponent {
|
||||
showLightbox: false,
|
||||
lightboxImg: null,
|
||||
};
|
||||
this.offlineMode = localStorage.getItem("offlineMode") === "true";
|
||||
this.offlineMode = localStorage.getItem('offlineMode') === 'true';
|
||||
this.controller = new AbortController();
|
||||
this.changelog = createRef();
|
||||
}
|
||||
|
||||
async getUpdate() {
|
||||
const data = await (
|
||||
await fetch(variables.constants.BLOG_POST + "/index.json", {
|
||||
await fetch(variables.constants.BLOG_POST + '/index.json', {
|
||||
signal: this.controller.signal,
|
||||
})
|
||||
).json();
|
||||
@@ -29,11 +29,11 @@ export default class Changelog extends PureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
let date = new Date(data.date.split(" ")[0]);
|
||||
date = date.toLocaleDateString(variables.languagecode.replace("_", "-"), {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
let date = new Date(data.date.split(' ')[0]);
|
||||
date = date.toLocaleDateString(variables.languagecode.replace('_', '-'), {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
});
|
||||
|
||||
this.setState({
|
||||
@@ -42,17 +42,17 @@ export default class Changelog extends PureComponent {
|
||||
image: data.featured_image || null,
|
||||
author: variables.language.getMessage(
|
||||
variables.languagecode,
|
||||
"modals.main.settings.sections.changelog.by",
|
||||
'modals.main.settings.sections.changelog.by',
|
||||
{
|
||||
author: data.authors.join(", "),
|
||||
}
|
||||
author: data.authors.join(', '),
|
||||
},
|
||||
),
|
||||
html: data.html,
|
||||
});
|
||||
|
||||
// lightbox etc
|
||||
const images = this.changelog.current.getElementsByTagName("img");
|
||||
const links = this.changelog.current.getElementsByTagName("a");
|
||||
const images = this.changelog.current.getElementsByTagName('img');
|
||||
const links = this.changelog.current.getElementsByTagName('a');
|
||||
|
||||
for (const img of images) {
|
||||
img.draggable = false;
|
||||
@@ -66,8 +66,8 @@ export default class Changelog extends PureComponent {
|
||||
|
||||
// open in new tab
|
||||
for (let link = 0; link < links.length; link++) {
|
||||
links[link].target = "_blank";
|
||||
links[link].rel = "noopener noreferrer";
|
||||
links[link].target = '_blank';
|
||||
links[link].rel = 'noopener noreferrer';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,8 +85,7 @@ export default class Changelog extends PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
const getMessage = (text) =>
|
||||
variables.language.getMessage(variables.languagecode, text);
|
||||
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
||||
|
||||
const errorMessage = (msg) => {
|
||||
return (
|
||||
@@ -100,11 +99,9 @@ export default class Changelog extends PureComponent {
|
||||
return errorMessage(
|
||||
<>
|
||||
<MdOutlineWifiOff />
|
||||
<h1>{getMessage("modals.main.marketplace.offline.title")}</h1>
|
||||
<p className="description">
|
||||
{getMessage("modals.main.marketplace.offline.description")}
|
||||
</p>
|
||||
</>
|
||||
<h1>{getMessage('modals.main.marketplace.offline.title')}</h1>
|
||||
<p className="description">{getMessage('modals.main.marketplace.offline.description')}</p>
|
||||
</>,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -113,7 +110,7 @@ export default class Changelog extends PureComponent {
|
||||
<div className="loaderHolder">
|
||||
<div id="loader"></div>
|
||||
<span className="subtitle">Just be a sec.</span>
|
||||
</div>
|
||||
</div>,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -131,10 +128,7 @@ export default class Changelog extends PureComponent {
|
||||
className="updateImage"
|
||||
/>
|
||||
) : null}
|
||||
<div
|
||||
className="updateChangelog"
|
||||
dangerouslySetInnerHTML={{ __html: this.state.html }}
|
||||
/>
|
||||
<div className="updateChangelog" dangerouslySetInnerHTML={{ __html: this.state.html }} />
|
||||
<Modal
|
||||
closeTimeoutMS={100}
|
||||
onRequestClose={() => this.setState({ showLightbox: false })}
|
||||
|
||||
@@ -1,44 +1,39 @@
|
||||
import variables from "modules/variables";
|
||||
import { PureComponent } from "react";
|
||||
import variables from 'modules/variables';
|
||||
import { PureComponent } from 'react';
|
||||
|
||||
import Header from "../Header";
|
||||
import Checkbox from "../Checkbox";
|
||||
import Dropdown from "../Dropdown";
|
||||
import SettingsItem from "../SettingsItem";
|
||||
import Header from '../Header';
|
||||
import Checkbox from '../Checkbox';
|
||||
import Dropdown from '../Dropdown';
|
||||
import SettingsItem from '../SettingsItem';
|
||||
|
||||
export default class DateSettings extends PureComponent {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
dateType: localStorage.getItem("dateType") || "long",
|
||||
dateType: localStorage.getItem('dateType') || 'long',
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
const getMessage = (text) =>
|
||||
variables.language.getMessage(variables.languagecode, text);
|
||||
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
||||
|
||||
let dateSettings;
|
||||
|
||||
const longSettings = (
|
||||
<>
|
||||
<Dropdown
|
||||
label="Long Format"
|
||||
name="longFormat"
|
||||
category="date"
|
||||
>
|
||||
<Dropdown label="Long Format" name="longFormat" category="date">
|
||||
<option value="DMY">DMY</option>
|
||||
<option value="MDY">MDY</option>
|
||||
<option value="YMD">YMD</option>
|
||||
</Dropdown>
|
||||
<Checkbox
|
||||
name="dayofweek"
|
||||
text={getMessage("modals.main.settings.sections.date.day_of_week")}
|
||||
text={getMessage('modals.main.settings.sections.date.day_of_week')}
|
||||
category="date"
|
||||
/>
|
||||
<Checkbox
|
||||
name="datenth"
|
||||
text={getMessage("modals.main.settings.sections.date.datenth")}
|
||||
text={getMessage('modals.main.settings.sections.date.datenth')}
|
||||
category="date"
|
||||
/>
|
||||
</>
|
||||
@@ -47,7 +42,7 @@ export default class DateSettings extends PureComponent {
|
||||
const shortSettings = (
|
||||
<>
|
||||
<Dropdown
|
||||
label={getMessage("modals.main.settings.sections.date.short_format")}
|
||||
label={getMessage('modals.main.settings.sections.date.short_format')}
|
||||
name="dateFormat"
|
||||
category="date"
|
||||
>
|
||||
@@ -57,37 +52,27 @@ export default class DateSettings extends PureComponent {
|
||||
</Dropdown>
|
||||
|
||||
<Dropdown
|
||||
label={getMessage(
|
||||
"modals.main.settings.sections.date.short_separator.title"
|
||||
)}
|
||||
label={getMessage('modals.main.settings.sections.date.short_separator.title')}
|
||||
name="shortFormat"
|
||||
category="date"
|
||||
>
|
||||
<option value="dash">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.date.short_separator.dash"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.date.short_separator.dash')}
|
||||
</option>
|
||||
<option value="dots">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.date.short_separator.dots"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.date.short_separator.dots')}
|
||||
</option>
|
||||
<option value="gaps">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.date.short_separator.gaps"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.date.short_separator.gaps')}
|
||||
</option>
|
||||
<option value="slashes">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.date.short_separator.slashes"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.date.short_separator.slashes')}
|
||||
</option>
|
||||
</Dropdown>
|
||||
</>
|
||||
);
|
||||
|
||||
if (this.state.dateType === "long") {
|
||||
if (this.state.dateType === 'long') {
|
||||
dateSettings = longSettings;
|
||||
} else {
|
||||
dateSettings = shortSettings;
|
||||
@@ -96,7 +81,7 @@ export default class DateSettings extends PureComponent {
|
||||
return (
|
||||
<>
|
||||
<Header
|
||||
title={getMessage("modals.main.settings.sections.date.title")}
|
||||
title={getMessage('modals.main.settings.sections.date.title')}
|
||||
setting="date"
|
||||
category="date"
|
||||
element=".date"
|
||||
@@ -105,28 +90,28 @@ export default class DateSettings extends PureComponent {
|
||||
/>
|
||||
<SettingsItem title="Date Type">
|
||||
<Dropdown
|
||||
label={getMessage("modals.main.settings.sections.time.type")}
|
||||
label={getMessage('modals.main.settings.sections.time.type')}
|
||||
name="dateType"
|
||||
onChange={(value) => this.setState({ dateType: value })}
|
||||
category="date"
|
||||
>
|
||||
<option value="long">
|
||||
{getMessage("modals.main.settings.sections.date.type.long")}
|
||||
{getMessage('modals.main.settings.sections.date.type.long')}
|
||||
</option>
|
||||
<option value="short">
|
||||
{getMessage("modals.main.settings.sections.date.type.short")}
|
||||
{getMessage('modals.main.settings.sections.date.type.short')}
|
||||
</option>
|
||||
</Dropdown>
|
||||
</SettingsItem>
|
||||
<SettingsItem title="Extra Options">
|
||||
<Checkbox
|
||||
name="weeknumber"
|
||||
text={getMessage("modals.main.settings.sections.date.week_number")}
|
||||
text={getMessage('modals.main.settings.sections.date.week_number')}
|
||||
category="date"
|
||||
/>
|
||||
<Checkbox
|
||||
name="datezero"
|
||||
text={getMessage("modals.main.settings.sections.time.digital.zero")}
|
||||
text={getMessage('modals.main.settings.sections.time.digital.zero')}
|
||||
category="date"
|
||||
/>
|
||||
{dateSettings}
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
import variables from "modules/variables";
|
||||
import { useState } from "react";
|
||||
import Checkbox from "../Checkbox";
|
||||
import Slider from "../Slider";
|
||||
import { TextField } from "@mui/material";
|
||||
import variables from 'modules/variables';
|
||||
import { useState } from 'react';
|
||||
import Checkbox from '../Checkbox';
|
||||
import Slider from '../Slider';
|
||||
import { TextField } from '@mui/material';
|
||||
|
||||
import EventBus from "modules/helpers/eventbus";
|
||||
import { values } from "modules/helpers/settings/modals";
|
||||
import EventBus from 'modules/helpers/eventbus';
|
||||
import { values } from 'modules/helpers/settings/modals';
|
||||
|
||||
export default function ExperimentalSettings() {
|
||||
const getMessage = (text) =>
|
||||
variables.language.getMessage(variables.languagecode, text);
|
||||
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
||||
const [eventType, setEventType] = useState();
|
||||
const [eventName, setEventName] = useState();
|
||||
|
||||
return (
|
||||
<>
|
||||
<h2>{getMessage("modals.main.settings.sections.experimental.title")}</h2>
|
||||
<p>{getMessage("modals.main.settings.sections.experimental.warning")}</p>
|
||||
<h3>
|
||||
{getMessage("modals.main.settings.sections.experimental.developer")}
|
||||
</h3>
|
||||
<h2>{getMessage('modals.main.settings.sections.experimental.title')}</h2>
|
||||
<p>{getMessage('modals.main.settings.sections.experimental.warning')}</p>
|
||||
<h3>{getMessage('modals.main.settings.sections.experimental.developer')}</h3>
|
||||
<Checkbox name="debug" text="Debug hotkey (Ctrl + #)" element=".other" />
|
||||
<Slider
|
||||
title="Debug timeout"
|
||||
@@ -28,12 +25,12 @@ export default function ExperimentalSettings() {
|
||||
max="5000"
|
||||
default="0"
|
||||
step="100"
|
||||
marks={values("experimental")}
|
||||
marks={values('experimental')}
|
||||
element=".other"
|
||||
/>
|
||||
<p>Send Event</p>
|
||||
<TextField
|
||||
label={"Type"}
|
||||
label={'Type'}
|
||||
value={eventType}
|
||||
onChange={(e) => setEventType(e.target.value)}
|
||||
spellCheck={false}
|
||||
@@ -41,7 +38,7 @@ export default function ExperimentalSettings() {
|
||||
InputLabelProps={{ shrink: true }}
|
||||
/>
|
||||
<TextField
|
||||
label={"Name"}
|
||||
label={'Name'}
|
||||
value={eventName}
|
||||
onChange={(e) => setEventName(e.target.value)}
|
||||
spellCheck={false}
|
||||
@@ -49,19 +46,12 @@ export default function ExperimentalSettings() {
|
||||
InputLabelProps={{ shrink: true }}
|
||||
/>
|
||||
<br />
|
||||
<button
|
||||
className="uploadbg"
|
||||
onClick={() => EventBus.dispatch(eventType, eventName)}
|
||||
>
|
||||
<button className="uploadbg" onClick={() => EventBus.dispatch(eventType, eventName)}>
|
||||
Send
|
||||
</button>
|
||||
<br />
|
||||
<br />
|
||||
<button
|
||||
className="reset"
|
||||
style={{ marginLeft: "0px" }}
|
||||
onClick={() => localStorage.clear()}
|
||||
>
|
||||
<button className="reset" style={{ marginLeft: '0px' }} onClick={() => localStorage.clear()}>
|
||||
Clear LocalStorage
|
||||
</button>
|
||||
</>
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class GreetingSettings extends PureComponent {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
birthday: new Date(localStorage.getItem('birthday')) || new Date()
|
||||
birthday: new Date(localStorage.getItem('birthday')) || new Date(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -19,26 +19,64 @@ export default class GreetingSettings extends PureComponent {
|
||||
localStorage.setItem('birthday', e.target.value || new Date());
|
||||
|
||||
this.setState({
|
||||
birthday: e.target.value ? new Date(e.target.value) : new Date()
|
||||
birthday: e.target.value ? new Date(e.target.value) : new Date(),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header title={getMessage('modals.main.settings.sections.greeting.title')} setting='greeting' category='greeting' element='.greeting' zoomSetting='zoomGreeting' switch={true}/>
|
||||
<SettingsItem title="Additional Settings" subtitle={getMessage('modals.main.settings.enabled')}>
|
||||
<Checkbox name='events' text={getMessage('modals.main.settings.sections.greeting.events')} category='greeting'/>
|
||||
<Checkbox name='defaultGreetingMessage' text={getMessage('modals.main.settings.sections.greeting.default')} category='greeting'/>
|
||||
<Text title={getMessage('modals.main.settings.sections.greeting.name')} name='greetingName' category='greeting'/>
|
||||
<Header
|
||||
title={getMessage('modals.main.settings.sections.greeting.title')}
|
||||
setting="greeting"
|
||||
category="greeting"
|
||||
element=".greeting"
|
||||
zoomSetting="zoomGreeting"
|
||||
switch={true}
|
||||
/>
|
||||
<SettingsItem
|
||||
title="Additional Settings"
|
||||
subtitle={getMessage('modals.main.settings.enabled')}
|
||||
>
|
||||
<Checkbox
|
||||
name="events"
|
||||
text={getMessage('modals.main.settings.sections.greeting.events')}
|
||||
category="greeting"
|
||||
/>
|
||||
<Checkbox
|
||||
name="defaultGreetingMessage"
|
||||
text={getMessage('modals.main.settings.sections.greeting.default')}
|
||||
category="greeting"
|
||||
/>
|
||||
<Text
|
||||
title={getMessage('modals.main.settings.sections.greeting.name')}
|
||||
name="greetingName"
|
||||
category="greeting"
|
||||
/>
|
||||
</SettingsItem>
|
||||
<SettingsItem title={getMessage('modals.main.settings.sections.greeting.birthday')} subtitle={getMessage('modals.main.settings.enabled')}>
|
||||
<Switch name='birthdayenabled' text={getMessage('modals.main.settings.enabled')} category='greeting'/>
|
||||
<Checkbox name='birthdayage' text={getMessage('modals.main.settings.sections.greeting.birthday_age')} category='greeting'/>
|
||||
<p>{getMessage('modals.main.settings.sections.greeting.birthday_date')}</p>
|
||||
<input type='date' onChange={this.changeDate} value={this.state.birthday.toISOString().substr(0, 10)} required/>
|
||||
<SettingsItem
|
||||
title={getMessage('modals.main.settings.sections.greeting.birthday')}
|
||||
subtitle={getMessage('modals.main.settings.enabled')}
|
||||
>
|
||||
<Switch
|
||||
name="birthdayenabled"
|
||||
text={getMessage('modals.main.settings.enabled')}
|
||||
category="greeting"
|
||||
/>
|
||||
<Checkbox
|
||||
name="birthdayage"
|
||||
text={getMessage('modals.main.settings.sections.greeting.birthday_age')}
|
||||
category="greeting"
|
||||
/>
|
||||
<p>{getMessage('modals.main.settings.sections.greeting.birthday_date')}</p>
|
||||
<input
|
||||
type="date"
|
||||
onChange={this.changeDate}
|
||||
value={this.state.birthday.toISOString().substr(0, 10)}
|
||||
required
|
||||
/>
|
||||
</SettingsItem>
|
||||
{/*<h3>{getMessage('modals.main.settings.sections.greeting.birthday')}</h3>
|
||||
<Switch name='birthdayenabled' text={getMessage('modals.main.settings.enabled')} category='greeting'/>
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class KeybindSettings extends PureComponent {
|
||||
super();
|
||||
this.state = {
|
||||
keybinds: JSON.parse(localStorage.getItem('keybinds')) || {},
|
||||
cancelled: false
|
||||
cancelled: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ export default class KeybindSettings extends PureComponent {
|
||||
currentKeybinds[type] = this.getMessage('modals.main.settings.sections.keybinds.recording');
|
||||
this.setState({
|
||||
keybinds: currentKeybinds,
|
||||
cancelled: false
|
||||
cancelled: false,
|
||||
});
|
||||
this.forceUpdate();
|
||||
|
||||
@@ -42,7 +42,7 @@ export default class KeybindSettings extends PureComponent {
|
||||
keys = `${keys}+${event.key}`;
|
||||
}
|
||||
|
||||
previouskey = event.key
|
||||
previouskey = event.key;
|
||||
});
|
||||
|
||||
this.keyup = document.addEventListener('keyup', () => {
|
||||
@@ -55,7 +55,7 @@ export default class KeybindSettings extends PureComponent {
|
||||
keybinds[type] = keys.split('+').slice(0, 4).join('+');
|
||||
localStorage.setItem('keybinds', JSON.stringify(keybinds));
|
||||
this.setState({
|
||||
keybinds: JSON.parse(localStorage.getItem('keybinds')) || {}
|
||||
keybinds: JSON.parse(localStorage.getItem('keybinds')) || {},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -73,7 +73,7 @@ export default class KeybindSettings extends PureComponent {
|
||||
|
||||
this.setState({
|
||||
keybinds: currentKeybinds,
|
||||
cancelled: true
|
||||
cancelled: true,
|
||||
});
|
||||
this.forceUpdate();
|
||||
}
|
||||
@@ -85,7 +85,7 @@ export default class KeybindSettings extends PureComponent {
|
||||
|
||||
this.setState({
|
||||
keybinds: JSON.parse(localStorage.getItem('keybinds')) || {},
|
||||
cancelled: true
|
||||
cancelled: true,
|
||||
});
|
||||
|
||||
this.showReminder();
|
||||
@@ -110,35 +110,140 @@ export default class KeybindSettings extends PureComponent {
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
<Header title={this.getMessage('modals.main.settings.sections.keybinds.title')} setting='keybindsEnabled' element='.other' />
|
||||
<table className='keybind-table'>
|
||||
<Header
|
||||
title={this.getMessage('modals.main.settings.sections.keybinds.title')}
|
||||
setting="keybindsEnabled"
|
||||
element=".other"
|
||||
/>
|
||||
<table className="keybind-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><KeybindInput name={this.getMessage('modals.main.settings.sections.keybinds.background.favourite')} state={this.state.keybinds} setting='favouriteBackground' action={(type, e) => this.action(type, e)}/></th>
|
||||
<th><KeybindInput name={this.getMessage('modals.main.settings.sections.keybinds.background.maximise')} state={this.state.keybinds} setting='maximiseBackground' action={(type, e) => this.action(type, e)}/></th>
|
||||
<th>
|
||||
<KeybindInput
|
||||
name={this.getMessage(
|
||||
'modals.main.settings.sections.keybinds.background.favourite',
|
||||
)}
|
||||
state={this.state.keybinds}
|
||||
setting="favouriteBackground"
|
||||
action={(type, e) => this.action(type, e)}
|
||||
/>
|
||||
</th>
|
||||
<th>
|
||||
<KeybindInput
|
||||
name={this.getMessage(
|
||||
'modals.main.settings.sections.keybinds.background.maximise',
|
||||
)}
|
||||
state={this.state.keybinds}
|
||||
setting="maximiseBackground"
|
||||
action={(type, e) => this.action(type, e)}
|
||||
/>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><KeybindInput name={this.getMessage('modals.main.settings.sections.keybinds.background.download')} state={this.state.keybinds} setting='downloadBackground' action={(type, e) => this.action(type, e)}/></th>
|
||||
<th><KeybindInput name={this.getMessage('modals.main.settings.sections.keybinds.background.show_info')} state={this.state.keybinds} setting='showBackgroundInformation' action={(type, e) => this.action(type, e)}/></th>
|
||||
<th>
|
||||
<KeybindInput
|
||||
name={this.getMessage(
|
||||
'modals.main.settings.sections.keybinds.background.download',
|
||||
)}
|
||||
state={this.state.keybinds}
|
||||
setting="downloadBackground"
|
||||
action={(type, e) => this.action(type, e)}
|
||||
/>
|
||||
</th>
|
||||
<th>
|
||||
<KeybindInput
|
||||
name={this.getMessage(
|
||||
'modals.main.settings.sections.keybinds.background.show_info',
|
||||
)}
|
||||
state={this.state.keybinds}
|
||||
setting="showBackgroundInformation"
|
||||
action={(type, e) => this.action(type, e)}
|
||||
/>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><KeybindInput name={this.getMessage('modals.main.settings.sections.keybinds.background.show_info')} state={this.state.keybinds} setting='showBackgroundInformation' action={(type, e) => this.action(type, e)}/></th>
|
||||
<th><KeybindInput name={this.getMessage('modals.main.settings.sections.keybinds.quote.favourite')} state={this.state.keybinds} setting='favouriteQuote' action={(type, e) => this.action(type, e)}/></th>
|
||||
<th>
|
||||
<KeybindInput
|
||||
name={this.getMessage(
|
||||
'modals.main.settings.sections.keybinds.background.show_info',
|
||||
)}
|
||||
state={this.state.keybinds}
|
||||
setting="showBackgroundInformation"
|
||||
action={(type, e) => this.action(type, e)}
|
||||
/>
|
||||
</th>
|
||||
<th>
|
||||
<KeybindInput
|
||||
name={this.getMessage('modals.main.settings.sections.keybinds.quote.favourite')}
|
||||
state={this.state.keybinds}
|
||||
setting="favouriteQuote"
|
||||
action={(type, e) => this.action(type, e)}
|
||||
/>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><KeybindInput name={this.getMessage('modals.main.settings.sections.keybinds.quote.copy')} state={this.state.keybinds} setting='copyQuote' action={(type, e) => this.action(type, e)}/></th>
|
||||
<th><KeybindInput name={this.getMessage('modals.main.settings.sections.keybinds.quote.tweet')} state={this.state.keybinds} setting='tweetQuote' action={(type, e) => this.action(type, e)}/></th>
|
||||
<th>
|
||||
<KeybindInput
|
||||
name={this.getMessage('modals.main.settings.sections.keybinds.quote.copy')}
|
||||
state={this.state.keybinds}
|
||||
setting="copyQuote"
|
||||
action={(type, e) => this.action(type, e)}
|
||||
/>
|
||||
</th>
|
||||
<th>
|
||||
<KeybindInput
|
||||
name={this.getMessage('modals.main.settings.sections.keybinds.quote.tweet')}
|
||||
state={this.state.keybinds}
|
||||
setting="tweetQuote"
|
||||
action={(type, e) => this.action(type, e)}
|
||||
/>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><KeybindInput name={this.getMessage('modals.main.settings.sections.keybinds.notes.pin')} state={this.state.keybinds} setting='pinNotes' action={(type, e) => this.action(type, e)}/></th>
|
||||
<th><KeybindInput name={this.getMessage('modals.main.settings.sections.keybinds.notes.copy')} state={this.state.keybinds} setting='copyNotes' action={(type, e) => this.action(type, e)}/></th>
|
||||
<th>
|
||||
<KeybindInput
|
||||
name={this.getMessage('modals.main.settings.sections.keybinds.notes.pin')}
|
||||
state={this.state.keybinds}
|
||||
setting="pinNotes"
|
||||
action={(type, e) => this.action(type, e)}
|
||||
/>
|
||||
</th>
|
||||
<th>
|
||||
<KeybindInput
|
||||
name={this.getMessage('modals.main.settings.sections.keybinds.notes.copy')}
|
||||
state={this.state.keybinds}
|
||||
setting="copyNotes"
|
||||
action={(type, e) => this.action(type, e)}
|
||||
/>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><KeybindInput name={this.getMessage('modals.main.settings.sections.keybinds.search')} state={this.state.keybinds} setting='focusSearch' action={(type, e) => this.action(type, e)}/></th>
|
||||
<th><KeybindInput name={this.getMessage('modals.main.settings.sections.keybinds.quicklinks')} state={this.state.keybinds} setting='toggleQuicklinks' action={(type, e) => this.action(type, e)}/></th>
|
||||
<th>
|
||||
<KeybindInput
|
||||
name={this.getMessage('modals.main.settings.sections.keybinds.search')}
|
||||
state={this.state.keybinds}
|
||||
setting="focusSearch"
|
||||
action={(type, e) => this.action(type, e)}
|
||||
/>
|
||||
</th>
|
||||
<th>
|
||||
<KeybindInput
|
||||
name={this.getMessage('modals.main.settings.sections.keybinds.quicklinks')}
|
||||
state={this.state.keybinds}
|
||||
setting="toggleQuicklinks"
|
||||
action={(type, e) => this.action(type, e)}
|
||||
/>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><KeybindInput name={this.getMessage('modals.main.settings.sections.keybinds.modal')} state={this.state.keybinds} setting='toggleModal' action={(type, e) => this.action(type, e)}/></th>
|
||||
<th>
|
||||
<KeybindInput
|
||||
name={this.getMessage('modals.main.settings.sections.keybinds.modal')}
|
||||
state={this.state.keybinds}
|
||||
setting="toggleModal"
|
||||
action={(type, e) => this.action(type, e)}
|
||||
/>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -96,8 +96,9 @@ export default class Message extends PureComponent {
|
||||
<th>
|
||||
{this.state.messages.length > 1 ? (
|
||||
<button
|
||||
className='deleteButton'
|
||||
onClick={() => this.modifyMessage('remove', index)}>
|
||||
className="deleteButton"
|
||||
onClick={() => this.modifyMessage('remove', index)}
|
||||
>
|
||||
<MdCancel />
|
||||
</button>
|
||||
) : null}
|
||||
|
||||
@@ -12,12 +12,38 @@ export default function QuickLinks() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header title={getMessage('modals.main.settings.sections.quicklinks.title')} setting='quicklinksenabled' category='quicklinks' element='.quicklinks-container' zoomSetting='zoomQuicklinks' switch={true}/>
|
||||
<Header
|
||||
title={getMessage('modals.main.settings.sections.quicklinks.title')}
|
||||
setting="quicklinksenabled"
|
||||
category="quicklinks"
|
||||
element=".quicklinks-container"
|
||||
zoomSetting="zoomQuicklinks"
|
||||
switch={true}
|
||||
/>
|
||||
<SettingsItem title="Extra Options" subtitle="subtitle">
|
||||
<Checkbox name='quicklinksText' text={getMessage('modals.main.settings.sections.quicklinks.text_only')} category='quicklinks' onChange={(value) => setTextOnly(value)}/>
|
||||
<Checkbox name='quicklinksddgProxy' text={getMessage('modals.main.settings.sections.background.ddg_image_proxy')} category='quicklinks' disabled={textOnly}/>
|
||||
<Checkbox name='quicklinksnewtab' text={getMessage('modals.main.settings.sections.quicklinks.open_new')} category='quicklinks'/>
|
||||
<Checkbox name='quicklinkstooltip' text={getMessage('modals.main.settings.sections.quicklinks.tooltip')} category='quicklinks' disabled={textOnly}/>
|
||||
<Checkbox
|
||||
name="quicklinksText"
|
||||
text={getMessage('modals.main.settings.sections.quicklinks.text_only')}
|
||||
category="quicklinks"
|
||||
onChange={(value) => setTextOnly(value)}
|
||||
/>
|
||||
<Checkbox
|
||||
name="quicklinksddgProxy"
|
||||
text={getMessage('modals.main.settings.sections.background.ddg_image_proxy')}
|
||||
category="quicklinks"
|
||||
disabled={textOnly}
|
||||
/>
|
||||
<Checkbox
|
||||
name="quicklinksnewtab"
|
||||
text={getMessage('modals.main.settings.sections.quicklinks.open_new')}
|
||||
category="quicklinks"
|
||||
/>
|
||||
<Checkbox
|
||||
name="quicklinkstooltip"
|
||||
text={getMessage('modals.main.settings.sections.quicklinks.tooltip')}
|
||||
category="quicklinks"
|
||||
disabled={textOnly}
|
||||
/>
|
||||
</SettingsItem>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -6,7 +6,7 @@ export default class ReminderSettings extends PureComponent {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
colour: localStorage.getItem('reminderColour') || '#ffa500'
|
||||
colour: localStorage.getItem('reminderColour') || '#ffa500',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,9 +20,24 @@ export default class ReminderSettings extends PureComponent {
|
||||
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
||||
return (
|
||||
<>
|
||||
<Header title='Reminder' setting='reminder' category='reminder' element='.reminder' zoomSetting='zoomReminder' switch={true}/>
|
||||
<input type='color' name='colour' className='colour' onChange={(event) => this.updateColour(event)} value={this.state.colour}></input>
|
||||
<label htmlFor={'colour'} className='customBackgroundHex'>{this.state.colour}</label>
|
||||
<Header
|
||||
title="Reminder"
|
||||
setting="reminder"
|
||||
category="reminder"
|
||||
element=".reminder"
|
||||
zoomSetting="zoomReminder"
|
||||
switch={true}
|
||||
/>
|
||||
<input
|
||||
type="color"
|
||||
name="colour"
|
||||
className="colour"
|
||||
onChange={(event) => this.updateColour(event)}
|
||||
value={this.state.colour}
|
||||
></input>
|
||||
<label htmlFor={'colour'} className="customBackgroundHex">
|
||||
{this.state.colour}
|
||||
</label>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,14 +22,14 @@ export default class SearchSettings extends PureComponent {
|
||||
this.state = {
|
||||
customEnabled: false,
|
||||
customDisplay: 'none',
|
||||
customValue: localStorage.getItem('customSearchEngine') || ''
|
||||
customValue: localStorage.getItem('customSearchEngine') || '',
|
||||
};
|
||||
}
|
||||
|
||||
resetSearch() {
|
||||
localStorage.removeItem('customSearchEngine');
|
||||
this.setState({
|
||||
customValue: ''
|
||||
customValue: '',
|
||||
});
|
||||
|
||||
toast(this.getMessage('toasts.reset'));
|
||||
@@ -39,7 +39,7 @@ export default class SearchSettings extends PureComponent {
|
||||
if (localStorage.getItem('searchEngine') === 'custom') {
|
||||
this.setState({
|
||||
customDisplay: 'block',
|
||||
customEnabled: true
|
||||
customEnabled: true,
|
||||
});
|
||||
} else {
|
||||
localStorage.removeItem('customSearchEngine');
|
||||
@@ -58,12 +58,12 @@ export default class SearchSettings extends PureComponent {
|
||||
if (input === 'custom') {
|
||||
this.setState({
|
||||
customDisplay: 'block',
|
||||
customEnabled: true
|
||||
customEnabled: true,
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
customDisplay: 'none',
|
||||
customEnabled: false
|
||||
customEnabled: false,
|
||||
});
|
||||
localStorage.setItem('searchEngine', input);
|
||||
}
|
||||
@@ -74,30 +74,78 @@ export default class SearchSettings extends PureComponent {
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
<Header title={this.getMessage('modals.main.settings.sections.search.title')} setting='searchBar' category='widgets' switch={true}/>
|
||||
<Header
|
||||
title={this.getMessage('modals.main.settings.sections.search.title')}
|
||||
setting="searchBar"
|
||||
category="widgets"
|
||||
switch={true}
|
||||
/>
|
||||
<SettingsItem title="Extra Options" subtitle="eeeee">
|
||||
{/* not supported on firefox */}
|
||||
{(navigator.userAgent.includes('Chrome') && typeof InstallTrigger === 'undefined') ?
|
||||
<Checkbox name='voiceSearch' text={this.getMessage('modals.main.settings.sections.search.voice_search')} category='search'/>
|
||||
: null}
|
||||
<Checkbox name='searchDropdown' text={this.getMessage('modals.main.settings.sections.search.dropdown')} category='search' element='.other'/>
|
||||
<Checkbox name='searchFocus' text={this.getMessage('modals.main.settings.sections.search.focus')} category='search' element='.other'/>
|
||||
<ul style={{ display: this.state.customDisplay }}>
|
||||
<p style={{ marginTop: '0px' }}><span className='link' onClick={() => this.resetSearch()}>{this.getMessage('modals.main.settings.buttons.reset')}</span></p>
|
||||
<TextField label={this.getMessage('modals.main.settings.sections.search.custom')} value={this.state.customValue} onInput={(e) => this.setState({ customValue: e.target.value })} varient='outlined' InputLabelProps={{ shrink: true }} />
|
||||
</ul>
|
||||
<Checkbox name='autocomplete' text={this.getMessage('modals.main.settings.sections.search.autocomplete')} category='search' />
|
||||
{/* not supported on firefox */}
|
||||
{navigator.userAgent.includes('Chrome') && typeof InstallTrigger === 'undefined' ? (
|
||||
<Checkbox
|
||||
name="voiceSearch"
|
||||
text={this.getMessage('modals.main.settings.sections.search.voice_search')}
|
||||
category="search"
|
||||
/>
|
||||
) : null}
|
||||
<Checkbox
|
||||
name="searchDropdown"
|
||||
text={this.getMessage('modals.main.settings.sections.search.dropdown')}
|
||||
category="search"
|
||||
element=".other"
|
||||
/>
|
||||
<Checkbox
|
||||
name="searchFocus"
|
||||
text={this.getMessage('modals.main.settings.sections.search.focus')}
|
||||
category="search"
|
||||
element=".other"
|
||||
/>
|
||||
<ul style={{ display: this.state.customDisplay }}>
|
||||
<p style={{ marginTop: '0px' }}>
|
||||
<span className="link" onClick={() => this.resetSearch()}>
|
||||
{this.getMessage('modals.main.settings.buttons.reset')}
|
||||
</span>
|
||||
</p>
|
||||
<TextField
|
||||
label={this.getMessage('modals.main.settings.sections.search.custom')}
|
||||
value={this.state.customValue}
|
||||
onInput={(e) => this.setState({ customValue: e.target.value })}
|
||||
varient="outlined"
|
||||
InputLabelProps={{ shrink: true }}
|
||||
/>
|
||||
</ul>
|
||||
<Checkbox
|
||||
name="autocomplete"
|
||||
text={this.getMessage('modals.main.settings.sections.search.autocomplete')}
|
||||
category="search"
|
||||
/>
|
||||
</SettingsItem>
|
||||
<SettingsItem title={this.getMessage('modals.main.settings.sections.search.search_engine')} subtitle="cheese is gucci tbf">
|
||||
<Dropdown label={this.getMessage('modals.main.settings.sections.search.search_engine')} name='searchEngine' onChange={(value) => this.setSearchEngine(value)} manual={true}>
|
||||
{searchEngines.map((engine) => (
|
||||
<MenuItem key={engine.name} value={engine.settingsName}>{engine.name}</MenuItem>
|
||||
))}
|
||||
<MenuItem value='custom'>{this.getMessage('modals.main.settings.sections.search.custom').split(' ')[0]}</MenuItem>
|
||||
</Dropdown>
|
||||
<SettingsItem
|
||||
title={this.getMessage('modals.main.settings.sections.search.search_engine')}
|
||||
subtitle="cheese is gucci tbf"
|
||||
>
|
||||
<Dropdown
|
||||
label={this.getMessage('modals.main.settings.sections.search.search_engine')}
|
||||
name="searchEngine"
|
||||
onChange={(value) => this.setSearchEngine(value)}
|
||||
manual={true}
|
||||
>
|
||||
{searchEngines.map((engine) => (
|
||||
<MenuItem key={engine.name} value={engine.settingsName}>
|
||||
{engine.name}
|
||||
</MenuItem>
|
||||
))}
|
||||
<MenuItem value="custom">
|
||||
{this.getMessage('modals.main.settings.sections.search.custom').split(' ')[0]}
|
||||
</MenuItem>
|
||||
</Dropdown>
|
||||
</SettingsItem>
|
||||
<SettingsItem title={this.getMessage('modals.main.settings.sections.search.autocomplete_provider')} subtitle="cheese">
|
||||
<Radio options={autocompleteProviders} name='autocompleteProvider' category='search'/>
|
||||
<SettingsItem
|
||||
title={this.getMessage('modals.main.settings.sections.search.autocomplete_provider')}
|
||||
subtitle="cheese"
|
||||
>
|
||||
<Radio options={autocompleteProviders} name="autocompleteProvider" category="search" />
|
||||
</SettingsItem>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -8,13 +8,12 @@ import Checkbox from '../Checkbox';
|
||||
import { TextField } from '@mui/material';
|
||||
import SettingsItem from '../SettingsItem';
|
||||
|
||||
|
||||
export default class TimeSettings extends PureComponent {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
location: localStorage.getItem('location') || '',
|
||||
windSpeed: (localStorage.getItem('windspeed') !== 'true')
|
||||
windSpeed: localStorage.getItem('windspeed') !== 'true',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -29,26 +28,34 @@ export default class TimeSettings extends PureComponent {
|
||||
|
||||
changeLocation(e) {
|
||||
this.setState({
|
||||
location: e.target.value
|
||||
location: e.target.value,
|
||||
});
|
||||
|
||||
this.showReminder();
|
||||
}
|
||||
|
||||
getAuto() {
|
||||
navigator.geolocation.getCurrentPosition(async (position) => {
|
||||
const data = await (await fetch(`${variables.constants.PROXY_URL}/weather/autolocation?lat=${position.coords.latitude}&lon=${position.coords.longitude}`)).json();
|
||||
this.setState({
|
||||
location: data[0].name
|
||||
});
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
async (position) => {
|
||||
const data = await (
|
||||
await fetch(
|
||||
`${variables.constants.PROXY_URL}/weather/autolocation?lat=${position.coords.latitude}&lon=${position.coords.longitude}`,
|
||||
)
|
||||
).json();
|
||||
this.setState({
|
||||
location: data[0].name,
|
||||
});
|
||||
|
||||
this.showReminder();
|
||||
}, (error) => {
|
||||
// firefox requires this 2nd function
|
||||
console.log(error);
|
||||
}, {
|
||||
enableHighAccuracy: true
|
||||
});
|
||||
this.showReminder();
|
||||
},
|
||||
(error) => {
|
||||
// firefox requires this 2nd function
|
||||
console.log(error);
|
||||
},
|
||||
{
|
||||
enableHighAccuracy: true,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -57,62 +64,151 @@ export default class TimeSettings extends PureComponent {
|
||||
const tempFormat = [
|
||||
{
|
||||
name: getMessage('modals.main.settings.sections.weather.temp_format.celsius') + ' (°C)',
|
||||
value: 'celsius'
|
||||
value: 'celsius',
|
||||
},
|
||||
{
|
||||
name: getMessage('modals.main.settings.sections.weather.temp_format.fahrenheit') + ' (°F)',
|
||||
value: 'fahrenheit'
|
||||
value: 'fahrenheit',
|
||||
},
|
||||
{
|
||||
name: getMessage('modals.main.settings.sections.weather.temp_format.kelvin') + ' (K)',
|
||||
value: 'kelvin'
|
||||
}
|
||||
value: 'kelvin',
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header title={getMessage('modals.main.settings.sections.weather.title')} setting='weatherEnabled' category='widgets' zoomSetting='zoomWeather' zoomCategory='weather' switch={true}/>
|
||||
<Header
|
||||
title={getMessage('modals.main.settings.sections.weather.title')}
|
||||
setting="weatherEnabled"
|
||||
category="widgets"
|
||||
zoomSetting="zoomWeather"
|
||||
zoomCategory="weather"
|
||||
switch={true}
|
||||
/>
|
||||
<SettingsItem title="Widget Type">
|
||||
<Dropdown label="Type" name="weatherType">
|
||||
<option value='1'>Basic</option>
|
||||
<option value='2'>Standard</option>
|
||||
<option value='3'>Expanded</option>
|
||||
</Dropdown>
|
||||
<Dropdown label="Type" name="weatherType">
|
||||
<option value="1">Basic</option>
|
||||
<option value="2">Standard</option>
|
||||
<option value="3">Expanded</option>
|
||||
</Dropdown>
|
||||
</SettingsItem>
|
||||
<SettingsItem title={getMessage('modals.main.settings.sections.weather.location')}>
|
||||
<TextField label={getMessage('modals.main.settings.sections.weather.location')} value={this.state.location} onChange={(e) => this.changeLocation(e)} placeholder='London' varient='outlined' InputLabelProps={{ shrink: true }} />
|
||||
<span className='link' onClick={() => this.getAuto()}>{getMessage('modals.main.settings.sections.weather.auto')}</span>
|
||||
<TextField
|
||||
label={getMessage('modals.main.settings.sections.weather.location')}
|
||||
value={this.state.location}
|
||||
onChange={(e) => this.changeLocation(e)}
|
||||
placeholder="London"
|
||||
varient="outlined"
|
||||
InputLabelProps={{ shrink: true }}
|
||||
/>
|
||||
<span className="link" onClick={() => this.getAuto()}>
|
||||
{getMessage('modals.main.settings.sections.weather.auto')}
|
||||
</span>
|
||||
</SettingsItem>
|
||||
<SettingsItem title={getMessage('modals.main.settings.sections.weather.temp_format.title')}>
|
||||
<Radio name='tempformat' options={tempFormat} category='weather'/>
|
||||
<Radio name="tempformat" options={tempFormat} category="weather" />
|
||||
</SettingsItem>
|
||||
{ localStorage.getItem('weatherType') > 1 &&
|
||||
{localStorage.getItem('weatherType') > 1 && (
|
||||
<SettingsItem title="Active bit" subtitle="idk a better word for it sorry">
|
||||
<Dropdown label="Type" name="weatherActiveBit" category='weather'>
|
||||
<option value='weatherdescription'>{getMessage('modals.main.settings.sections.weather.extra_info.show_description')} </option>
|
||||
<option value='cloudiness'>{getMessage('modals.main.settings.sections.weather.extra_info.cloudiness')}</option>
|
||||
<option value='humidity'>{getMessage('modals.main.settings.sections.weather.extra_info.humidity')}</option>
|
||||
<option value='visibility'>{getMessage('modals.main.settings.sections.weather.extra_info.visibility')}</option>
|
||||
<option value='windspeed' onChange={() => this.setState({ windSpeed: (localStorage.getItem('windspeed') !== 'true') })}>{getMessage('modals.main.settings.sections.weather.extra_info.wind_speed')}</option>
|
||||
<option value='windDirection' disabled={this.state.windSpeed}>{getMessage('modals.main.settings.sections.weather.extra_info.wind_direction')}</option>
|
||||
<option value='mintemp'>{getMessage('modals.main.settings.sections.weather.extra_info.min_temp')}</option>
|
||||
<option value='maxtemp'>{getMessage('modals.main.settings.sections.weather.extra_info.max_temp')}</option>
|
||||
<option value='feelsliketemp'>Feels like temperature</option>
|
||||
<option value='atmosphericpressure'>{getMessage('modals.main.settings.sections.weather.extra_info.atmospheric_pressure')}</option>
|
||||
</Dropdown>
|
||||
<Dropdown label="Type" name="weatherActiveBit" category="weather">
|
||||
<option value="weatherdescription">
|
||||
{getMessage('modals.main.settings.sections.weather.extra_info.show_description')}{' '}
|
||||
</option>
|
||||
<option value="cloudiness">
|
||||
{getMessage('modals.main.settings.sections.weather.extra_info.cloudiness')}
|
||||
</option>
|
||||
<option value="humidity">
|
||||
{getMessage('modals.main.settings.sections.weather.extra_info.humidity')}
|
||||
</option>
|
||||
<option value="visibility">
|
||||
{getMessage('modals.main.settings.sections.weather.extra_info.visibility')}
|
||||
</option>
|
||||
<option
|
||||
value="windspeed"
|
||||
onChange={() =>
|
||||
this.setState({
|
||||
windSpeed: localStorage.getItem('windspeed') !== 'true',
|
||||
})
|
||||
}
|
||||
>
|
||||
{getMessage('modals.main.settings.sections.weather.extra_info.wind_speed')}
|
||||
</option>
|
||||
<option value="windDirection" disabled={this.state.windSpeed}>
|
||||
{getMessage('modals.main.settings.sections.weather.extra_info.wind_direction')}
|
||||
</option>
|
||||
<option value="mintemp">
|
||||
{getMessage('modals.main.settings.sections.weather.extra_info.min_temp')}
|
||||
</option>
|
||||
<option value="maxtemp">
|
||||
{getMessage('modals.main.settings.sections.weather.extra_info.max_temp')}
|
||||
</option>
|
||||
<option value="feelsliketemp">Feels like temperature</option>
|
||||
<option value="atmosphericpressure">
|
||||
{getMessage(
|
||||
'modals.main.settings.sections.weather.extra_info.atmospheric_pressure',
|
||||
)}
|
||||
</option>
|
||||
</Dropdown>
|
||||
</SettingsItem>
|
||||
}
|
||||
<Checkbox name='showlocation' text={getMessage('modals.main.settings.sections.weather.extra_info.show_location')} category='weather'/>
|
||||
<Checkbox name='weatherdescription' text={getMessage('modals.main.settings.sections.weather.extra_info.show_description')} category='weather'/>
|
||||
<Checkbox name='cloudiness' text={getMessage('modals.main.settings.sections.weather.extra_info.cloudiness')} category='weather'/>
|
||||
<Checkbox name='humidity' text={getMessage('modals.main.settings.sections.weather.extra_info.humidity')} category='weather'/>
|
||||
<Checkbox name='visibility' text={getMessage('modals.main.settings.sections.weather.extra_info.visibility')} category='weather'/>
|
||||
<Checkbox name='windspeed' text={getMessage('modals.main.settings.sections.weather.extra_info.wind_speed')} category='weather' onChange={() => this.setState({ windSpeed: (localStorage.getItem('windspeed') !== 'true') })}/>
|
||||
<Checkbox name='windDirection' text={getMessage('modals.main.settings.sections.weather.extra_info.wind_direction')} category='weather' disabled={this.state.windSpeed}/>
|
||||
<Checkbox name='mintemp' text={getMessage('modals.main.settings.sections.weather.extra_info.min_temp')} category='weather'/>
|
||||
<Checkbox name='maxtemp' text={getMessage('modals.main.settings.sections.weather.extra_info.max_temp')} category='weather'/>
|
||||
<Checkbox name='feelsliketemp' text={'Feels like temperature'} category='weather'/>
|
||||
<Checkbox name='atmosphericpressure' text={getMessage('modals.main.settings.sections.weather.extra_info.atmospheric_pressure')} category='weather'/>
|
||||
)}
|
||||
<Checkbox
|
||||
name="showlocation"
|
||||
text={getMessage('modals.main.settings.sections.weather.extra_info.show_location')}
|
||||
category="weather"
|
||||
/>
|
||||
<Checkbox
|
||||
name="weatherdescription"
|
||||
text={getMessage('modals.main.settings.sections.weather.extra_info.show_description')}
|
||||
category="weather"
|
||||
/>
|
||||
<Checkbox
|
||||
name="cloudiness"
|
||||
text={getMessage('modals.main.settings.sections.weather.extra_info.cloudiness')}
|
||||
category="weather"
|
||||
/>
|
||||
<Checkbox
|
||||
name="humidity"
|
||||
text={getMessage('modals.main.settings.sections.weather.extra_info.humidity')}
|
||||
category="weather"
|
||||
/>
|
||||
<Checkbox
|
||||
name="visibility"
|
||||
text={getMessage('modals.main.settings.sections.weather.extra_info.visibility')}
|
||||
category="weather"
|
||||
/>
|
||||
<Checkbox
|
||||
name="windspeed"
|
||||
text={getMessage('modals.main.settings.sections.weather.extra_info.wind_speed')}
|
||||
category="weather"
|
||||
onChange={() =>
|
||||
this.setState({
|
||||
windSpeed: localStorage.getItem('windspeed') !== 'true',
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Checkbox
|
||||
name="windDirection"
|
||||
text={getMessage('modals.main.settings.sections.weather.extra_info.wind_direction')}
|
||||
category="weather"
|
||||
disabled={this.state.windSpeed}
|
||||
/>
|
||||
<Checkbox
|
||||
name="mintemp"
|
||||
text={getMessage('modals.main.settings.sections.weather.extra_info.min_temp')}
|
||||
category="weather"
|
||||
/>
|
||||
<Checkbox
|
||||
name="maxtemp"
|
||||
text={getMessage('modals.main.settings.sections.weather.extra_info.max_temp')}
|
||||
category="weather"
|
||||
/>
|
||||
<Checkbox name="feelsliketemp" text={'Feels like temperature'} category="weather" />
|
||||
<Checkbox
|
||||
name="atmosphericpressure"
|
||||
text={getMessage('modals.main.settings.sections.weather.extra_info.atmospheric_pressure')}
|
||||
category="weather"
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,38 +1,37 @@
|
||||
import variables from "modules/variables";
|
||||
import { PureComponent } from "react";
|
||||
import { MenuItem } from "@mui/material";
|
||||
import variables from 'modules/variables';
|
||||
import { PureComponent } from 'react';
|
||||
import { MenuItem } from '@mui/material';
|
||||
|
||||
import Header from "../../Header";
|
||||
import Checkbox from "../../Checkbox";
|
||||
import Dropdown from "../../Dropdown";
|
||||
import Slider from "../../Slider";
|
||||
import Radio from "../../Radio";
|
||||
import SettingsItem from "../../SettingsItem";
|
||||
import Header from '../../Header';
|
||||
import Checkbox from '../../Checkbox';
|
||||
import Dropdown from '../../Dropdown';
|
||||
import Slider from '../../Slider';
|
||||
import Radio from '../../Radio';
|
||||
import SettingsItem from '../../SettingsItem';
|
||||
|
||||
import ColourSettings from "./Colour";
|
||||
import CustomSettings from "./Custom";
|
||||
import ColourSettings from './Colour';
|
||||
import CustomSettings from './Custom';
|
||||
|
||||
import { values } from "modules/helpers/settings/modals";
|
||||
import { values } from 'modules/helpers/settings/modals';
|
||||
|
||||
export default class BackgroundSettings extends PureComponent {
|
||||
getMessage = (text) =>
|
||||
variables.language.getMessage(variables.languagecode, text);
|
||||
getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
backgroundType: localStorage.getItem("backgroundType") || "api",
|
||||
backgroundFilter: localStorage.getItem("backgroundFilter") || "none",
|
||||
backgroundCategories: [this.getMessage("modals.main.loading")],
|
||||
backgroundAPI: localStorage.getItem("backgroundAPI") || "mue",
|
||||
marketplaceEnabled: localStorage.getItem("photo_packs"),
|
||||
backgroundType: localStorage.getItem('backgroundType') || 'api',
|
||||
backgroundFilter: localStorage.getItem('backgroundFilter') || 'none',
|
||||
backgroundCategories: [this.getMessage('modals.main.loading')],
|
||||
backgroundAPI: localStorage.getItem('backgroundAPI') || 'mue',
|
||||
marketplaceEnabled: localStorage.getItem('photo_packs'),
|
||||
};
|
||||
this.controller = new AbortController();
|
||||
}
|
||||
|
||||
async getBackgroundCategories() {
|
||||
const data = await (
|
||||
await fetch(variables.constants.API_URL + "/images/categories", {
|
||||
await fetch(variables.constants.API_URL + '/images/categories', {
|
||||
signal: this.controller.signal,
|
||||
})
|
||||
).json();
|
||||
@@ -47,12 +46,9 @@ export default class BackgroundSettings extends PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (
|
||||
navigator.onLine === false ||
|
||||
localStorage.getItem("offlineMode") === "true"
|
||||
) {
|
||||
if (navigator.onLine === false || localStorage.getItem('offlineMode') === 'true') {
|
||||
return this.setState({
|
||||
backgroundCategories: [this.getMessage("modals.update.offline.title")],
|
||||
backgroundCategories: [this.getMessage('modals.update.offline.title')],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -71,53 +67,41 @@ export default class BackgroundSettings extends PureComponent {
|
||||
|
||||
const apiOptions = [
|
||||
{
|
||||
name: "Mue",
|
||||
value: "mue",
|
||||
name: 'Mue',
|
||||
value: 'mue',
|
||||
},
|
||||
{
|
||||
name: "Unsplash",
|
||||
value: "unsplash",
|
||||
name: 'Unsplash',
|
||||
value: 'unsplash',
|
||||
},
|
||||
{
|
||||
name: "Pexels",
|
||||
value: "pexels",
|
||||
name: 'Pexels',
|
||||
value: 'pexels',
|
||||
},
|
||||
];
|
||||
|
||||
const interval = (
|
||||
<SettingsItem>
|
||||
<Dropdown
|
||||
label={getMessage(
|
||||
"modals.main.settings.sections.background.interval.title"
|
||||
)}
|
||||
label={getMessage('modals.main.settings.sections.background.interval.title')}
|
||||
name="backgroundchange"
|
||||
>
|
||||
<option value="refresh">{getMessage("tabname")}</option>
|
||||
<option value="refresh">{getMessage('tabname')}</option>
|
||||
<option value="60000">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.interval.minute"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.interval.minute')}
|
||||
</option>
|
||||
<option value="1800000">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.interval.half_hour"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.interval.half_hour')}
|
||||
</option>
|
||||
<option value="3600000">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.interval.hour"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.interval.hour')}
|
||||
</option>
|
||||
<option value="86400000">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.interval.day"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.interval.day')}
|
||||
</option>
|
||||
<option value="604800000">{getMessage("widgets.date.week")}</option>
|
||||
<option value="604800000">{getMessage('widgets.date.week')}</option>
|
||||
<option value="2628000000">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.interval.month"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.interval.month')}
|
||||
</option>
|
||||
</Dropdown>
|
||||
</SettingsItem>
|
||||
@@ -127,37 +111,30 @@ export default class BackgroundSettings extends PureComponent {
|
||||
<>
|
||||
<SettingsItem>
|
||||
<Radio
|
||||
title={getMessage(
|
||||
"modals.main.settings.sections.background.source.api"
|
||||
)}
|
||||
title={getMessage('modals.main.settings.sections.background.source.api')}
|
||||
options={apiOptions}
|
||||
name="backgroundAPI"
|
||||
category="background"
|
||||
element="#backgroundImage"
|
||||
onChange={(e) => this.setState({ backgroundAPI: e })}
|
||||
/>
|
||||
{this.state.backgroundCategories[0] ===
|
||||
getMessage("modals.main.loading") ? (
|
||||
{this.state.backgroundCategories[0] === getMessage('modals.main.loading') ? (
|
||||
<>
|
||||
<Dropdown
|
||||
label={getMessage(
|
||||
"modals.main.settings.sections.background.category"
|
||||
)}
|
||||
label={getMessage('modals.main.settings.sections.background.category')}
|
||||
name="apiCategory"
|
||||
>
|
||||
<MenuItem value="loading" key="loading">
|
||||
{getMessage("modals.main.loading")}
|
||||
{getMessage('modals.main.loading')}
|
||||
</MenuItem>
|
||||
<MenuItem value="loading" key="loading">
|
||||
{getMessage("modals.main.loading")}
|
||||
{getMessage('modals.main.loading')}
|
||||
</MenuItem>
|
||||
</Dropdown>
|
||||
</>
|
||||
) : (
|
||||
<Dropdown
|
||||
label={getMessage(
|
||||
"modals.main.settings.sections.background.category"
|
||||
)}
|
||||
label={getMessage('modals.main.settings.sections.background.category')}
|
||||
name="apiCategory"
|
||||
>
|
||||
{this.state.backgroundCategories.map((category) => (
|
||||
@@ -168,31 +145,21 @@ export default class BackgroundSettings extends PureComponent {
|
||||
</Dropdown>
|
||||
)}
|
||||
<Dropdown
|
||||
label={getMessage(
|
||||
"modals.main.settings.sections.background.source.quality.title"
|
||||
)}
|
||||
label={getMessage('modals.main.settings.sections.background.source.quality.title')}
|
||||
name="apiQuality"
|
||||
element=".other"
|
||||
>
|
||||
<option value="original">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.source.quality.original"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.source.quality.original')}
|
||||
</option>
|
||||
<option value="high">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.source.quality.high"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.source.quality.high')}
|
||||
</option>
|
||||
<option value="normal">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.source.quality.normal"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.source.quality.normal')}
|
||||
</option>
|
||||
<option value="datasaver">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.source.quality.datasaver"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.source.quality.datasaver')}
|
||||
</option>
|
||||
</Dropdown>
|
||||
</SettingsItem>
|
||||
@@ -201,16 +168,16 @@ export default class BackgroundSettings extends PureComponent {
|
||||
);
|
||||
|
||||
switch (this.state.backgroundType) {
|
||||
case "custom":
|
||||
case 'custom':
|
||||
backgroundSettings = <CustomSettings interval={interval} />;
|
||||
break;
|
||||
case "colour":
|
||||
case 'colour':
|
||||
backgroundSettings = <ColourSettings />;
|
||||
break;
|
||||
case "random_colour":
|
||||
case 'random_colour':
|
||||
backgroundSettings = <></>;
|
||||
break;
|
||||
case "random_gradient":
|
||||
case 'random_gradient':
|
||||
backgroundSettings = <></>;
|
||||
break;
|
||||
default:
|
||||
@@ -219,23 +186,23 @@ export default class BackgroundSettings extends PureComponent {
|
||||
}
|
||||
|
||||
if (
|
||||
localStorage.getItem("photo_packs") &&
|
||||
this.state.backgroundType !== "custom" &&
|
||||
this.state.backgroundType !== "colour" &&
|
||||
this.state.backgroundType !== "api"
|
||||
localStorage.getItem('photo_packs') &&
|
||||
this.state.backgroundType !== 'custom' &&
|
||||
this.state.backgroundType !== 'colour' &&
|
||||
this.state.backgroundType !== 'api'
|
||||
) {
|
||||
backgroundSettings = null;
|
||||
}
|
||||
|
||||
const usingImage =
|
||||
this.state.backgroundType !== "colour" &&
|
||||
this.state.backgroundType !== "random_colour" &&
|
||||
this.state.backgroundType !== "random_gradient";
|
||||
this.state.backgroundType !== 'colour' &&
|
||||
this.state.backgroundType !== 'random_colour' &&
|
||||
this.state.backgroundType !== 'random_gradient';
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header
|
||||
title={getMessage("modals.main.settings.sections.background.title")}
|
||||
title={getMessage('modals.main.settings.sections.background.title')}
|
||||
setting="background"
|
||||
category="background"
|
||||
element="#backgroundImage"
|
||||
@@ -243,171 +210,130 @@ export default class BackgroundSettings extends PureComponent {
|
||||
<SettingsItem title="cheese" subtitle="cheese">
|
||||
<Checkbox
|
||||
name="ddgProxy"
|
||||
text={getMessage(
|
||||
"modals.main.settings.sections.background.ddg_image_proxy"
|
||||
)}
|
||||
text={getMessage('modals.main.settings.sections.background.ddg_image_proxy')}
|
||||
element=".other"
|
||||
disabled={!usingImage}
|
||||
/>
|
||||
<Checkbox
|
||||
name="bgtransition"
|
||||
text={getMessage(
|
||||
"modals.main.settings.sections.background.transition"
|
||||
)}
|
||||
text={getMessage('modals.main.settings.sections.background.transition')}
|
||||
element=".other"
|
||||
disabled={!usingImage}
|
||||
/>
|
||||
<Checkbox
|
||||
name="photoInformation"
|
||||
text={getMessage(
|
||||
"modals.main.settings.sections.background.photo_information"
|
||||
)}
|
||||
text={getMessage('modals.main.settings.sections.background.photo_information')}
|
||||
element=".other"
|
||||
disabled={
|
||||
this.state.backgroundType !== "api" &&
|
||||
this.state.backgroundType !== "marketplace"
|
||||
this.state.backgroundType !== 'api' && this.state.backgroundType !== 'marketplace'
|
||||
}
|
||||
/>
|
||||
<Checkbox
|
||||
name="photoMap"
|
||||
text={getMessage(
|
||||
"modals.main.settings.sections.background.show_map"
|
||||
)}
|
||||
text={getMessage('modals.main.settings.sections.background.show_map')}
|
||||
element=".other"
|
||||
disabled={this.state.backgroundAPI !== "unsplash"}
|
||||
disabled={this.state.backgroundAPI !== 'unsplash'}
|
||||
/>
|
||||
</SettingsItem>
|
||||
<SettingsItem
|
||||
title={getMessage(
|
||||
"modals.main.settings.sections.background.source.title"
|
||||
)}
|
||||
title={getMessage('modals.main.settings.sections.background.source.title')}
|
||||
subtitle="mucho gracias"
|
||||
>
|
||||
<Dropdown
|
||||
label={getMessage(
|
||||
"modals.main.settings.sections.background.type.title"
|
||||
)}
|
||||
label={getMessage('modals.main.settings.sections.background.type.title')}
|
||||
name="backgroundType"
|
||||
onChange={(value) => this.setState({ backgroundType: value })}
|
||||
category="background"
|
||||
>
|
||||
{this.state.marketplaceEnabled ? (
|
||||
<option value="photo_pack">
|
||||
{this.getMessage("modals.main.navbar.marketplace")}
|
||||
{this.getMessage('modals.main.navbar.marketplace')}
|
||||
</option>
|
||||
) : null}
|
||||
<option value="api">
|
||||
{getMessage("modals.main.settings.sections.background.type.api")}
|
||||
{getMessage('modals.main.settings.sections.background.type.api')}
|
||||
</option>
|
||||
<option value="custom">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.type.custom_image"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.type.custom_image')}
|
||||
</option>
|
||||
<option value="colour">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.type.custom_colour"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.type.custom_colour')}
|
||||
</option>
|
||||
<option value="random_colour">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.type.random_colour"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.type.random_colour')}
|
||||
</option>
|
||||
<option value="random_gradient">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.type.random_gradient"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.type.random_gradient')}
|
||||
</option>
|
||||
</Dropdown>
|
||||
</SettingsItem>
|
||||
{backgroundSettings}
|
||||
{this.state.backgroundType === "api" ||
|
||||
this.state.backgroundType === "custom" ||
|
||||
{this.state.backgroundType === 'api' ||
|
||||
this.state.backgroundType === 'custom' ||
|
||||
this.state.marketplaceEnabled ? (
|
||||
<SettingsItem
|
||||
title={getMessage(
|
||||
"modals.main.settings.sections.background.effects.title"
|
||||
)}
|
||||
title={getMessage('modals.main.settings.sections.background.effects.title')}
|
||||
subtitle="cheese"
|
||||
>
|
||||
<Slider
|
||||
title={getMessage(
|
||||
"modals.main.settings.sections.background.effects.blur"
|
||||
)}
|
||||
title={getMessage('modals.main.settings.sections.background.effects.blur')}
|
||||
name="blur"
|
||||
min="0"
|
||||
max="100"
|
||||
default="0"
|
||||
display="%"
|
||||
marks={values("background")}
|
||||
marks={values('background')}
|
||||
category="background"
|
||||
element="#backgroundImage"
|
||||
/>
|
||||
<Slider
|
||||
title={getMessage(
|
||||
"modals.main.settings.sections.background.effects.brightness"
|
||||
)}
|
||||
title={getMessage('modals.main.settings.sections.background.effects.brightness')}
|
||||
name="brightness"
|
||||
min="0"
|
||||
max="100"
|
||||
default="90"
|
||||
display="%"
|
||||
marks={values("background")}
|
||||
marks={values('background')}
|
||||
category="background"
|
||||
element="#backgroundImage"
|
||||
/>
|
||||
<Dropdown
|
||||
label={getMessage(
|
||||
"modals.main.settings.sections.background.effects.filters.title"
|
||||
)}
|
||||
label={getMessage('modals.main.settings.sections.background.effects.filters.title')}
|
||||
name="backgroundFilter"
|
||||
onChange={(value) => this.setState({ backgroundFilter: value })}
|
||||
category="background"
|
||||
element="#backgroundImage"
|
||||
>
|
||||
<option value="none">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.appearance.navbar.refresh_options.none"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.appearance.navbar.refresh_options.none')}
|
||||
</option>
|
||||
<option value="grayscale">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.effects.filters.grayscale"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.effects.filters.grayscale')}
|
||||
</option>
|
||||
<option value="sepia">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.effects.filters.sepia"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.effects.filters.sepia')}
|
||||
</option>
|
||||
<option value="invert">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.effects.filters.invert"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.effects.filters.invert')}
|
||||
</option>
|
||||
<option value="saturate">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.effects.filters.saturate"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.effects.filters.saturate')}
|
||||
</option>
|
||||
<option value="contrast">
|
||||
{getMessage(
|
||||
"modals.main.settings.sections.background.effects.filters.contrast"
|
||||
)}
|
||||
{getMessage('modals.main.settings.sections.background.effects.filters.contrast')}
|
||||
</option>
|
||||
</Dropdown>
|
||||
{this.state.backgroundFilter !== "none" ? (
|
||||
{this.state.backgroundFilter !== 'none' ? (
|
||||
<Slider
|
||||
title={getMessage(
|
||||
"modals.main.settings.sections.background.effects.filters.amount"
|
||||
'modals.main.settings.sections.background.effects.filters.amount',
|
||||
)}
|
||||
name="backgroundFilterAmount"
|
||||
min="0"
|
||||
max="100"
|
||||
default="0"
|
||||
display="%"
|
||||
marks={values("background")}
|
||||
marks={values('background')}
|
||||
category="background"
|
||||
element="#backgroundImage"
|
||||
/>
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
import variables from "modules/variables";
|
||||
import { PureComponent, Fragment } from "react";
|
||||
import { ColorPicker } from "react-color-gradient-picker";
|
||||
import { toast } from "react-toastify";
|
||||
import SettingsItem from "../../SettingsItem";
|
||||
import variables from 'modules/variables';
|
||||
import { PureComponent, Fragment } from 'react';
|
||||
import { ColorPicker } from 'react-color-gradient-picker';
|
||||
import { toast } from 'react-toastify';
|
||||
import SettingsItem from '../../SettingsItem';
|
||||
|
||||
import hexToRgb from "modules/helpers/background/hexToRgb";
|
||||
import rgbToHex from "modules/helpers/background/rgbToHex";
|
||||
import hexToRgb from 'modules/helpers/background/hexToRgb';
|
||||
import rgbToHex from 'modules/helpers/background/rgbToHex';
|
||||
|
||||
import "react-color-gradient-picker/dist/index.css";
|
||||
import "../../../scss/settings/react-color-picker-gradient-picker-custom-styles.scss";
|
||||
import 'react-color-gradient-picker/dist/index.css';
|
||||
import '../../../scss/settings/react-color-picker-gradient-picker-custom-styles.scss';
|
||||
|
||||
export default class ColourSettings extends PureComponent {
|
||||
DefaultGradientSettings = {
|
||||
angle: "180",
|
||||
gradient: [{ colour: "#ffb032", stop: 0 }],
|
||||
type: "linear",
|
||||
angle: '180',
|
||||
gradient: [{ colour: '#ffb032', stop: 0 }],
|
||||
type: 'linear',
|
||||
};
|
||||
GradientPickerInitialState = undefined;
|
||||
|
||||
getMessage = (text) =>
|
||||
variables.language.getMessage(variables.languagecode, text);
|
||||
getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -29,11 +28,11 @@ export default class ColourSettings extends PureComponent {
|
||||
}
|
||||
|
||||
resetColour() {
|
||||
localStorage.setItem("customBackgroundColour", "");
|
||||
localStorage.setItem('customBackgroundColour', '');
|
||||
this.setState({
|
||||
gradientSettings: this.DefaultGradientSettings,
|
||||
});
|
||||
toast(this.getMessage("toasts.reset"));
|
||||
toast(this.getMessage('toasts.reset'));
|
||||
}
|
||||
|
||||
initialiseColourPickerState(gradientSettings) {
|
||||
@@ -54,10 +53,10 @@ export default class ColourSettings extends PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const hex = localStorage.getItem("customBackgroundColour");
|
||||
const hex = localStorage.getItem('customBackgroundColour');
|
||||
let gradientSettings = undefined;
|
||||
|
||||
if (hex !== "") {
|
||||
if (hex !== '') {
|
||||
try {
|
||||
gradientSettings = JSON.parse(hex);
|
||||
} catch (e) {
|
||||
@@ -75,10 +74,7 @@ export default class ColourSettings extends PureComponent {
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
localStorage.setItem(
|
||||
"customBackgroundColour",
|
||||
this.currentGradientSettings()
|
||||
);
|
||||
localStorage.setItem('customBackgroundColour', this.currentGradientSettings());
|
||||
}
|
||||
|
||||
onGradientChange = (event, index) => {
|
||||
@@ -89,7 +85,7 @@ export default class ColourSettings extends PureComponent {
|
||||
gradientSettings: {
|
||||
...s.gradientSettings,
|
||||
gradient: s.gradientSettings.gradient.map((g, i) =>
|
||||
i === index ? { ...g, [name]: newValue } : g
|
||||
i === index ? { ...g, [name]: newValue } : g,
|
||||
),
|
||||
},
|
||||
});
|
||||
@@ -100,8 +96,7 @@ export default class ColourSettings extends PureComponent {
|
||||
|
||||
addColour = () => {
|
||||
this.setState((s) => {
|
||||
const [lastGradient, ...initGradients] =
|
||||
s.gradientSettings.gradient.reverse();
|
||||
const [lastGradient, ...initGradients] = s.gradientSettings.gradient.reverse();
|
||||
return {
|
||||
gradientSettings: {
|
||||
...s.gradientSettings,
|
||||
@@ -109,10 +104,7 @@ export default class ColourSettings extends PureComponent {
|
||||
...initGradients,
|
||||
lastGradient,
|
||||
{
|
||||
colour:
|
||||
localStorage.getItem("theme") === "dark"
|
||||
? "#000000"
|
||||
: "#ffffff",
|
||||
colour: localStorage.getItem('theme') === 'dark' ? '#000000' : '#ffffff',
|
||||
stop: 100,
|
||||
},
|
||||
].sort((a, b) => (a.stop > b.stop ? 1 : -1)),
|
||||
@@ -120,25 +112,18 @@ export default class ColourSettings extends PureComponent {
|
||||
};
|
||||
});
|
||||
|
||||
variables.stats.postEvent(
|
||||
"setting",
|
||||
"Changed backgroundType from colour to gradient"
|
||||
);
|
||||
variables.stats.postEvent('setting', 'Changed backgroundType from colour to gradient');
|
||||
};
|
||||
|
||||
currentGradientSettings = () => {
|
||||
if (
|
||||
typeof this.state.gradientSettings === "object" &&
|
||||
typeof this.state.gradientSettings === 'object' &&
|
||||
this.state.gradientSettings.gradient.every(
|
||||
(g) =>
|
||||
g.colour !==
|
||||
this.getMessage(
|
||||
"modals.main.settings.sections.background.source.disabled"
|
||||
)
|
||||
g.colour !== this.getMessage('modals.main.settings.sections.background.source.disabled'),
|
||||
)
|
||||
) {
|
||||
const clampNumber = (num, a, b) =>
|
||||
Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b));
|
||||
const clampNumber = (num, a, b) => Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b));
|
||||
return JSON.stringify({
|
||||
...this.state.gradientSettings,
|
||||
gradient: [
|
||||
@@ -148,13 +133,11 @@ export default class ColourSettings extends PureComponent {
|
||||
].sort((a, b) => (a.stop > b.stop ? 1 : -1)),
|
||||
});
|
||||
}
|
||||
return this.getMessage(
|
||||
"modals.main.settings.sections.background.source.disabled"
|
||||
);
|
||||
return this.getMessage('modals.main.settings.sections.background.source.disabled');
|
||||
};
|
||||
|
||||
onColourPickerChange = (attrs, name) => {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log(attrs, name);
|
||||
}
|
||||
|
||||
@@ -163,7 +146,7 @@ export default class ColourSettings extends PureComponent {
|
||||
angle: attrs.degree,
|
||||
gradient: attrs.points.map((p) => {
|
||||
return {
|
||||
colour: "#" + rgbToHex(p.red, p.green, p.blue),
|
||||
colour: '#' + rgbToHex(p.red, p.green, p.blue),
|
||||
stop: p.left,
|
||||
};
|
||||
}),
|
||||
@@ -175,18 +158,17 @@ export default class ColourSettings extends PureComponent {
|
||||
};
|
||||
|
||||
showReminder() {
|
||||
const reminderInfo = document.querySelector(".reminder-info");
|
||||
if (reminderInfo.style.display !== "block") {
|
||||
reminderInfo.style.display = "block";
|
||||
localStorage.setItem("showReminder", true);
|
||||
const reminderInfo = document.querySelector('.reminder-info');
|
||||
if (reminderInfo.style.display !== 'block') {
|
||||
reminderInfo.style.display = 'block';
|
||||
localStorage.setItem('showReminder', true);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
let colourSettings = null;
|
||||
if (typeof this.state.gradientSettings === "object") {
|
||||
const gradientHasMoreThanOneColour =
|
||||
this.state.gradientSettings.gradient.length > 1;
|
||||
if (typeof this.state.gradientSettings === 'object') {
|
||||
const gradientHasMoreThanOneColour = this.state.gradientSettings.gradient.length > 1;
|
||||
|
||||
let gradientInputs;
|
||||
if (gradientHasMoreThanOneColour) {
|
||||
@@ -196,11 +178,9 @@ export default class ColourSettings extends PureComponent {
|
||||
|
||||
gradientInputs = (
|
||||
<ColorPicker
|
||||
onStartChange={(colour) =>
|
||||
this.onColourPickerChange(colour, "start")
|
||||
}
|
||||
onChange={(colour) => this.onColourPickerChange(colour, "change")}
|
||||
onEndChange={(colour) => this.onColourPickerChange(colour, "end")}
|
||||
onStartChange={(colour) => this.onColourPickerChange(colour, 'start')}
|
||||
onChange={(colour) => this.onColourPickerChange(colour, 'change')}
|
||||
onEndChange={(colour) => this.onColourPickerChange(colour, 'end')}
|
||||
gradient={this.GradientPickerInitialState}
|
||||
isGradient
|
||||
/>
|
||||
@@ -210,14 +190,14 @@ export default class ColourSettings extends PureComponent {
|
||||
return (
|
||||
<Fragment key={i}>
|
||||
<input
|
||||
id={"colour_" + i}
|
||||
id={'colour_' + i}
|
||||
type="color"
|
||||
name="colour"
|
||||
className="colour"
|
||||
onChange={(event) => this.onGradientChange(event, i)}
|
||||
value={g.colour}
|
||||
></input>
|
||||
<label htmlFor={"colour_" + i} className="customBackgroundHex">
|
||||
<label htmlFor={'colour_' + i} className="customBackgroundHex">
|
||||
{g.colour}
|
||||
</label>
|
||||
</Fragment>
|
||||
@@ -231,9 +211,7 @@ export default class ColourSettings extends PureComponent {
|
||||
{!gradientHasMoreThanOneColour ? (
|
||||
<>
|
||||
<button type="button" className="add" onClick={this.addColour}>
|
||||
{this.getMessage(
|
||||
"modals.main.settings.sections.background.source.add_colour"
|
||||
)}
|
||||
{this.getMessage('modals.main.settings.sections.background.source.add_colour')}
|
||||
</button>
|
||||
</>
|
||||
) : null}
|
||||
@@ -244,12 +222,10 @@ export default class ColourSettings extends PureComponent {
|
||||
return (
|
||||
<>
|
||||
<SettingsItem
|
||||
title={this.getMessage(
|
||||
"modals.main.settings.sections.background.source.custom_colour"
|
||||
)}
|
||||
title={this.getMessage('modals.main.settings.sections.background.source.custom_colour')}
|
||||
>
|
||||
<span className="link" onClick={() => this.resetColour()}>
|
||||
{this.getMessage("modals.main.settings.buttons.reset")}
|
||||
{this.getMessage('modals.main.settings.buttons.reset')}
|
||||
</span>
|
||||
{colourSettings}
|
||||
</SettingsItem>
|
||||
|
||||
@@ -1,25 +1,19 @@
|
||||
import variables from "modules/variables";
|
||||
import { PureComponent } from "react";
|
||||
import { toast } from "react-toastify";
|
||||
import {
|
||||
MdCancel,
|
||||
MdAddLink,
|
||||
MdAddPhotoAlternate,
|
||||
MdPersonalVideo,
|
||||
} from "react-icons/md";
|
||||
import EventBus from "modules/helpers/eventbus";
|
||||
import variables from 'modules/variables';
|
||||
import { PureComponent } from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
import { MdCancel, MdAddLink, MdAddPhotoAlternate, MdPersonalVideo } from 'react-icons/md';
|
||||
import EventBus from 'modules/helpers/eventbus';
|
||||
|
||||
import Checkbox from "../../Checkbox";
|
||||
import FileUpload from "../../FileUpload";
|
||||
import SettingsItem from "../../SettingsItem";
|
||||
import Checkbox from '../../Checkbox';
|
||||
import FileUpload from '../../FileUpload';
|
||||
import SettingsItem from '../../SettingsItem';
|
||||
|
||||
import Modal from "react-modal";
|
||||
import Modal from 'react-modal';
|
||||
|
||||
import CustomURLModal from "./CustomURLModal";
|
||||
import CustomURLModal from './CustomURLModal';
|
||||
|
||||
export default class CustomSettings extends PureComponent {
|
||||
getMessage = (text) =>
|
||||
variables.language.getMessage(variables.languagecode, text);
|
||||
getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -30,12 +24,12 @@ export default class CustomSettings extends PureComponent {
|
||||
}
|
||||
|
||||
resetCustom = () => {
|
||||
localStorage.setItem("customBackground", "[]");
|
||||
localStorage.setItem('customBackground', '[]');
|
||||
this.setState({
|
||||
customBackground: [],
|
||||
});
|
||||
toast(this.getMessage("toasts.reset"));
|
||||
EventBus.dispatch("refresh", "background");
|
||||
toast(this.getMessage('toasts.reset'));
|
||||
EventBus.dispatch('refresh', 'background');
|
||||
};
|
||||
|
||||
customBackground(e, text, index) {
|
||||
@@ -48,15 +42,15 @@ export default class CustomSettings extends PureComponent {
|
||||
});
|
||||
this.forceUpdate();
|
||||
|
||||
localStorage.setItem("customBackground", JSON.stringify(customBackground));
|
||||
document.querySelector(".reminder-info").style.display = "flex";
|
||||
localStorage.setItem("showReminder", true);
|
||||
localStorage.setItem('customBackground', JSON.stringify(customBackground));
|
||||
document.querySelector('.reminder-info').style.display = 'flex';
|
||||
localStorage.setItem('showReminder', true);
|
||||
}
|
||||
|
||||
modifyCustomBackground(type, index) {
|
||||
const customBackground = this.state.customBackground;
|
||||
if (type === "add") {
|
||||
customBackground.push("");
|
||||
if (type === 'add') {
|
||||
customBackground.push('');
|
||||
} else {
|
||||
customBackground.splice(index, 1);
|
||||
}
|
||||
@@ -66,39 +60,33 @@ export default class CustomSettings extends PureComponent {
|
||||
});
|
||||
this.forceUpdate();
|
||||
|
||||
localStorage.setItem("customBackground", JSON.stringify(customBackground));
|
||||
document.querySelector(".reminder-info").style.display = "flex";
|
||||
localStorage.setItem("showReminder", true);
|
||||
localStorage.setItem('customBackground', JSON.stringify(customBackground));
|
||||
document.querySelector('.reminder-info').style.display = 'flex';
|
||||
localStorage.setItem('showReminder', true);
|
||||
}
|
||||
|
||||
videoCheck(url) {
|
||||
return (
|
||||
url.startsWith("data:video/") ||
|
||||
url.endsWith(".mp4") ||
|
||||
url.endsWith(".webm") ||
|
||||
url.endsWith(".ogg")
|
||||
url.startsWith('data:video/') ||
|
||||
url.endsWith('.mp4') ||
|
||||
url.endsWith('.webm') ||
|
||||
url.endsWith('.ogg')
|
||||
);
|
||||
}
|
||||
|
||||
videoCustomSettings = () => {
|
||||
const hasVideo = this.state.customBackground.filter((bg) =>
|
||||
this.videoCheck(bg)
|
||||
);
|
||||
const hasVideo = this.state.customBackground.filter((bg) => this.videoCheck(bg));
|
||||
|
||||
if (hasVideo.length > 0) {
|
||||
return (
|
||||
<>
|
||||
<Checkbox
|
||||
name="backgroundVideoLoop"
|
||||
text={this.getMessage(
|
||||
"modals.main.settings.sections.background.source.loop_video"
|
||||
)}
|
||||
text={this.getMessage('modals.main.settings.sections.background.source.loop_video')}
|
||||
/>
|
||||
<Checkbox
|
||||
name="backgroundVideoMute"
|
||||
text={this.getMessage(
|
||||
"modals.main.settings.sections.background.source.mute_video"
|
||||
)}
|
||||
text={this.getMessage('modals.main.settings.sections.background.source.mute_video')}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
@@ -110,19 +98,17 @@ export default class CustomSettings extends PureComponent {
|
||||
getCustom() {
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(localStorage.getItem("customBackground"));
|
||||
data = JSON.parse(localStorage.getItem('customBackground'));
|
||||
} catch (e) {
|
||||
data = [localStorage.getItem("customBackground")];
|
||||
data = [localStorage.getItem('customBackground')];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
uploadCustomBackground() {
|
||||
document
|
||||
.getElementById("bg-input")
|
||||
.setAttribute("index", this.state.customBackground.length);
|
||||
document.getElementById("bg-input").click();
|
||||
document.getElementById('bg-input').setAttribute('index', this.state.customBackground.length);
|
||||
document.getElementById('bg-input').click();
|
||||
// to fix loadFunction
|
||||
this.setState({
|
||||
currentBackgroundIndex: this.state.customBackground.length,
|
||||
@@ -134,39 +120,27 @@ export default class CustomSettings extends PureComponent {
|
||||
customURLModal: false,
|
||||
currentBackgroundIndex: this.state.customBackground.length,
|
||||
});
|
||||
this.customBackground(
|
||||
{ target: { value: e } },
|
||||
true,
|
||||
this.state.customBackground.length
|
||||
);
|
||||
this.customBackground({ target: { value: e } }, true, this.state.customBackground.length);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
{this.props.interval}
|
||||
<div className="settingsRow" style={{ alignItems: "flex-start" }}>
|
||||
<div className="settingsRow" style={{ alignItems: 'flex-start' }}>
|
||||
<div className="content">
|
||||
<div className="images-row">
|
||||
{this.state.customBackground.map((url, index) => (
|
||||
<div key={index}>
|
||||
<img
|
||||
alt={"Custom background " + (index || 0)}
|
||||
src={`${
|
||||
!this.videoCheck(url)
|
||||
? this.state.customBackground[index]
|
||||
: ""
|
||||
}`}
|
||||
alt={'Custom background ' + (index || 0)}
|
||||
src={`${!this.videoCheck(url) ? this.state.customBackground[index] : ''}`}
|
||||
/>
|
||||
{this.videoCheck(url) ? (
|
||||
<MdPersonalVideo className="customvideoicon" />
|
||||
) : null}
|
||||
{this.videoCheck(url) ? <MdPersonalVideo className="customvideoicon" /> : null}
|
||||
{this.state.customBackground.length > 0 ? (
|
||||
<button
|
||||
className="iconButton"
|
||||
onClick={() =>
|
||||
this.modifyCustomBackground("remove", index)
|
||||
}
|
||||
onClick={() => this.modifyCustomBackground('remove', index)}
|
||||
>
|
||||
<MdCancel />
|
||||
</button>
|
||||
@@ -183,14 +157,10 @@ export default class CustomSettings extends PureComponent {
|
||||
<span className="subtitle">
|
||||
Available formats, jpeg, png, webp, webm, gif, mp4, webm, ogg
|
||||
</span>
|
||||
<button onClick={() => this.uploadCustomBackground()}>
|
||||
Or Select
|
||||
</button>
|
||||
<button onClick={() => this.uploadCustomBackground()}>Or Select</button>
|
||||
</div>
|
||||
<button onClick={() => this.setState({ customURLModal: true })}>
|
||||
{this.getMessage(
|
||||
"modals.main.settings.sections.background.source.add_url"
|
||||
)}{" "}
|
||||
{this.getMessage('modals.main.settings.sections.background.source.add_url')}{' '}
|
||||
<MdAddLink />
|
||||
</button>
|
||||
{/*<span className='subtitle'>
|
||||
@@ -204,9 +174,7 @@ export default class CustomSettings extends PureComponent {
|
||||
<FileUpload
|
||||
id="bg-input"
|
||||
accept="image/jpeg, image/png, image/webp, image/webm, image/gif, video/mp4, video/webm, video/ogg"
|
||||
loadFunction={(e) =>
|
||||
this.customBackground(e, false, this.state.currentBackgroundIndex)
|
||||
}
|
||||
loadFunction={(e) => this.customBackground(e, false, this.state.currentBackgroundIndex)}
|
||||
/>
|
||||
{this.videoCustomSettings()}
|
||||
<Modal
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import variables from "modules/variables";
|
||||
import { useState } from "react";
|
||||
import { MdAdd } from "react-icons/md";
|
||||
import { TextField } from "@mui/material";
|
||||
import variables from 'modules/variables';
|
||||
import { useState } from 'react';
|
||||
import { MdAdd } from 'react-icons/md';
|
||||
import { TextField } from '@mui/material';
|
||||
|
||||
export default function CustomURLModal({ modalClose, modalCloseOnly }) {
|
||||
const [url, setURL] = useState();
|
||||
@@ -14,18 +14,14 @@ export default function CustomURLModal({ modalClose, modalCloseOnly }) {
|
||||
<h1>
|
||||
{variables.language.getMessage(
|
||||
variables.languagecode,
|
||||
"modals.main.settings.sections.background.source.add_url"
|
||||
'modals.main.settings.sections.background.source.add_url',
|
||||
)}
|
||||
</h1>
|
||||
<TextField
|
||||
value={url}
|
||||
onChange={(e) => setURL(e.target.value)}
|
||||
varient="outlined"
|
||||
/>
|
||||
<TextField value={url} onChange={(e) => setURL(e.target.value)} varient="outlined" />
|
||||
<div className="resetFooter">
|
||||
<button
|
||||
className="round import"
|
||||
style={{ marginLeft: "5px" }}
|
||||
style={{ marginLeft: '5px' }}
|
||||
onClick={() => modalClose(url)}
|
||||
>
|
||||
<MdAdd />
|
||||
|
||||
Reference in New Issue
Block a user