From 80a7b6a56ca542c304efc150be7bc59679108e7f Mon Sep 17 00:00:00 2001 From: David Ralph Date: Tue, 28 Sep 2021 23:04:04 +0100 Subject: [PATCH] refactor: cleanup --- src/App.jsx | 3 +- .../helpers/autocomplete/Autocomplete.jsx | 20 +++------- src/components/modals/ErrorBoundary.jsx | 2 +- src/components/modals/Modals.jsx | 7 ++-- src/components/modals/feedback/Feedback.jsx | 4 +- .../modals/main/marketplace/Item.jsx | 2 +- .../modals/main/marketplace/Items.jsx | 2 +- .../modals/main/marketplace/Lightbox.jsx | 2 +- .../main/marketplace/SideloadFailedModal.jsx | 10 +++-- .../main/marketplace/sections/Added.jsx | 8 ++-- .../main/marketplace/sections/Marketplace.jsx | 16 ++++---- .../main/marketplace/sections/Sideload.jsx | 16 ++++---- .../modals/main/settings/Checkbox.jsx | 3 +- .../modals/main/settings/Dropdown.jsx | 2 +- src/components/modals/main/settings/Radio.jsx | 2 +- .../modals/main/settings/ResetModal.jsx | 2 +- .../modals/main/settings/Switch.jsx | 3 +- .../modals/main/settings/sections/About.jsx | 32 +++++++-------- .../main/settings/sections/Appearance.jsx | 3 +- .../main/settings/sections/Changelog.jsx | 2 +- .../main/settings/sections/Experimental.jsx | 9 ++--- .../main/settings/sections/Keybinds.jsx | 35 ++++++++--------- .../main/settings/sections/Language.jsx | 15 ++++--- .../modals/main/settings/sections/Order.jsx | 2 +- .../modals/main/settings/sections/Quote.jsx | 2 +- .../modals/main/settings/sections/Search.jsx | 3 -- .../modals/main/settings/sections/Weather.jsx | 2 +- .../sections/background/Background.jsx | 2 +- .../settings/sections/background/Colour.jsx | 2 +- .../settings/sections/background/Custom.jsx | 2 +- src/components/modals/main/tabs/Addons.jsx | 2 +- src/components/modals/main/tabs/Settings.jsx | 30 +++++++------- .../modals/main/tabs/backend/Tab.jsx | 39 ++++++++++--------- .../modals/main/tabs/backend/Tabs.jsx | 2 +- .../modals/welcome/WelcomeSections.jsx | 6 +-- .../widgets/background/Background.jsx | 8 ++-- .../widgets/background/Favourite.jsx | 6 +-- .../widgets/background/Maximise.jsx | 6 +-- .../widgets/background/PhotoInformation.jsx | 14 +++---- src/components/widgets/navbar/Navbar.jsx | 2 +- src/components/widgets/navbar/Notes.jsx | 8 ++-- .../widgets/quicklinks/QuickLinks.jsx | 6 +-- src/components/widgets/quote/Quote.jsx | 14 +++---- src/components/widgets/search/Search.jsx | 6 +-- src/components/widgets/time/Date.jsx | 2 - src/components/widgets/weather/Weather.jsx | 2 +- src/index.js | 13 +------ src/modules/helpers/settings/modals.js | 6 +-- src/modules/variables.js | 12 +++++- src/translations/de_DE.json | 12 +++++- src/translations/en_GB.json | 12 +++++- src/translations/en_US.json | 12 +++++- src/translations/es.json | 12 +++++- src/translations/fr.json | 12 +++++- src/translations/nl.json | 12 +++++- src/translations/no.json | 12 +++++- src/translations/ru.json | 12 +++++- src/translations/zh_CN.json | 12 +++++- 58 files changed, 295 insertions(+), 212 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 1fe312c7..fafea95e 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,3 +1,4 @@ +import variables from 'modules/variables'; import { PureComponent } from 'react'; import { ToastContainer } from 'react-toastify'; @@ -27,7 +28,7 @@ export default class App extends PureComponent { } }); - window.stats.tabLoad(); + variables.stats.tabLoad(); } render() { diff --git a/src/components/helpers/autocomplete/Autocomplete.jsx b/src/components/helpers/autocomplete/Autocomplete.jsx index 92fde74b..157f7f57 100644 --- a/src/components/helpers/autocomplete/Autocomplete.jsx +++ b/src/components/helpers/autocomplete/Autocomplete.jsx @@ -59,26 +59,18 @@ export default class Autocomplete extends PureComponent { if (this.state.filtered.length > 0 && this.state.input.length > 0) { autocomplete = ( ); } return ( <> - + {autocomplete} ); diff --git a/src/components/modals/ErrorBoundary.jsx b/src/components/modals/ErrorBoundary.jsx index f48bc7da..0060c614 100644 --- a/src/components/modals/ErrorBoundary.jsx +++ b/src/components/modals/ErrorBoundary.jsx @@ -12,7 +12,7 @@ export default class ErrorBoundary extends PureComponent { static getDerivedStateFromError(error) { console.log(error); - window.stats.postEvent('modal', 'Error occurred'); + variables.stats.postEvent('modal', 'Error occurred'); return { error: true }; diff --git a/src/components/modals/Modals.jsx b/src/components/modals/Modals.jsx index 618e2690..3389f702 100644 --- a/src/components/modals/Modals.jsx +++ b/src/components/modals/Modals.jsx @@ -1,3 +1,4 @@ +import variables from 'modules/variables'; import { PureComponent, Suspense, lazy } from 'react'; import Modal from 'react-modal'; import Hotkeys from 'react-hot-keys'; @@ -29,7 +30,7 @@ export default class Modals extends PureComponent { this.setState({ welcomeModal: true }); - window.stats.postEvent('modal', 'Opened welcome'); + variables.stats.postEvent('modal', 'Opened welcome'); } if (window.location.search === '?nointro=true') { @@ -59,7 +60,7 @@ export default class Modals extends PureComponent { }); if (action !== false) { - window.stats.postEvent('modal', `Opened ${type.replace('Modal', '')}`); + variables.stats.postEvent('modal', `Opened ${type.replace('Modal', '')}`); } } @@ -78,7 +79,7 @@ export default class Modals extends PureComponent { this.toggleModal('feedbackModal', false)}/> - {window.keybinds.toggleModal && window.keybinds.toggleModal !== '' ? this.toggleModal('mainModal', (this.state.mainModal === true ? false : true))}/> : null} + {variables.keybinds.toggleModal && variables.keybinds.toggleModal !== '' ? this.toggleModal('mainModal', (this.state.mainModal === true ? false : true))}/> : null} ); } diff --git a/src/components/modals/feedback/Feedback.jsx b/src/components/modals/feedback/Feedback.jsx index 98fb0126..0334b2b0 100644 --- a/src/components/modals/feedback/Feedback.jsx +++ b/src/components/modals/feedback/Feedback.jsx @@ -55,7 +55,7 @@ export default class FeedbackModal extends PureComponent { } }); - await fetch(window.constants.FEEDBACK_FORM, { + await fetch(variables.constants.FEEDBACK_FORM, { method: 'POST' }); @@ -75,7 +75,7 @@ export default class FeedbackModal extends PureComponent {

{this.getMessage('modals.feedback.title')}

×
- +


diff --git a/src/components/modals/main/marketplace/Item.jsx b/src/components/modals/main/marketplace/Item.jsx index e0cd1a77..123ecf61 100644 --- a/src/components/modals/main/marketplace/Item.jsx +++ b/src/components/modals/main/marketplace/Item.jsx @@ -46,7 +46,7 @@ export default class Item extends PureComponent { } // prevent console error - let iconsrc = window.constants.DDG_IMAGE_PROXY + this.props.data.icon; + let iconsrc = variables.constants.DDG_IMAGE_PROXY + this.props.data.icon; if (!this.props.data.icon) { iconsrc = null; } diff --git a/src/components/modals/main/marketplace/Items.jsx b/src/components/modals/main/marketplace/Items.jsx index 384339bc..8f875825 100644 --- a/src/components/modals/main/marketplace/Items.jsx +++ b/src/components/modals/main/marketplace/Items.jsx @@ -3,7 +3,7 @@ export default function Items({ items, toggleFunction }) {
{items.map((item) => (
toggleFunction(item.name)} key={item.name}> - icon + icon

{item.display_name || item.name}

{item.author}

diff --git a/src/components/modals/main/marketplace/Lightbox.jsx b/src/components/modals/main/marketplace/Lightbox.jsx index 884fb981..8185b564 100644 --- a/src/components/modals/main/marketplace/Lightbox.jsx +++ b/src/components/modals/main/marketplace/Lightbox.jsx @@ -1,5 +1,5 @@ export default function Lightbox({ modalClose, img }) { - window.stats.postEvent('modal', 'Opened lightbox'); + variables.stats.postEvent('modal', 'Opened lightbox'); return ( <> diff --git a/src/components/modals/main/marketplace/SideloadFailedModal.jsx b/src/components/modals/main/marketplace/SideloadFailedModal.jsx index b55cc187..1d769f74 100644 --- a/src/components/modals/main/marketplace/SideloadFailedModal.jsx +++ b/src/components/modals/main/marketplace/SideloadFailedModal.jsx @@ -1,12 +1,16 @@ +import variables from 'modules/variables'; + export default function SideloadFailedModal({ modalClose, reason }) { + const getMessage = (text) => variables.language.getMessage(variables.languagecode, text); + return ( <> -

Error

- Failed to sideload addon +

{getMessage('modals.main.error_boundary.error')}

+ {getMessage('modals.main.addons.sideload.failed')}

{reason}
- +
); diff --git a/src/components/modals/main/marketplace/sections/Added.jsx b/src/components/modals/main/marketplace/sections/Added.jsx index f40c2946..687634b8 100644 --- a/src/components/modals/main/marketplace/sections/Added.jsx +++ b/src/components/modals/main/marketplace/sections/Added.jsx @@ -43,7 +43,7 @@ export default class Added extends PureComponent { }, button: this.buttons.uninstall }); - window.stats.postEvent('marketplace', 'Item viewed'); + variables.stats.postEvent('marketplace', 'Item viewed'); } else { this.setState({ item: {} @@ -61,7 +61,7 @@ export default class Added extends PureComponent { installed: JSON.parse(localStorage.getItem('installed')) }); - window.stats.postEvent('marketplace', 'Uninstall'); + variables.stats.postEvent('marketplace', 'Uninstall'); } sortAddons(value, sendEvent) { @@ -88,14 +88,14 @@ export default class Added extends PureComponent { }); if (sendEvent) { - window.stats.postEvent('marketplace', 'Sort'); + variables.stats.postEvent('marketplace', 'Sort'); } } updateCheck() { let updates = 0; this.state.installed.forEach(async (item) => { - const data = await (await fetch(window.constants.MARKETPLACE_URL + '/item/' + item.name)).json(); + const data = await (await fetch(variables.constants.MARKETPLACE_URL + '/item/' + item.name)).json(); if (data.version !== item.version) { updates++; } diff --git a/src/components/modals/main/marketplace/sections/Marketplace.jsx b/src/components/modals/main/marketplace/sections/Marketplace.jsx index d0c46cb3..457c93b2 100644 --- a/src/components/modals/main/marketplace/sections/Marketplace.jsx +++ b/src/components/modals/main/marketplace/sections/Marketplace.jsx @@ -33,7 +33,7 @@ export default class Marketplace extends PureComponent { let info; // get item info try { - info = await (await fetch(`${window.constants.MARKETPLACE_URL}/item/${this.props.type}/${data}`, { signal: this.controller.signal })).json(); + info = await (await fetch(`${variables.constants.MARKETPLACE_URL}/item/${this.props.type}/${data}`, { signal: this.controller.signal })).json(); } catch (e) { if (this.controller.signal.aborted === false) { return toast(this.getMessage('toasts.error')); @@ -78,7 +78,7 @@ export default class Marketplace extends PureComponent { button: button }); - window.stats.postEvent('marketplace-item', `${this.state.item.display_name} viewed`); + variables.stats.postEvent('marketplace-item', `${this.state.item.display_name} viewed`); } else { this.setState({ item: {} @@ -87,8 +87,8 @@ export default class Marketplace extends PureComponent { } async getItems() { - const { data } = await (await fetch(window.constants.MARKETPLACE_URL + '/items/' + this.props.type, { signal: this.controller.signal })).json(); - const featured = await (await fetch(window.constants.MARKETPLACE_URL + '/featured', { signal: this.controller.signal })).json(); + const { data } = await (await fetch(variables.constants.MARKETPLACE_URL + '/items/' + this.props.type, { signal: this.controller.signal })).json(); + const featured = await (await fetch(variables.constants.MARKETPLACE_URL + '/featured', { signal: this.controller.signal })).json(); if (this.controller.signal.aborted === true) { return; @@ -116,8 +116,8 @@ export default class Marketplace extends PureComponent { button: (type === 'install') ? this.buttons.uninstall : this.buttons.install }); - window.stats.postEvent('marketplace-item', `${this.state.item.display_name} ${(type === 'install' ? 'installed': 'uninstalled')}`); - window.stats.postEvent('marketplace', (type === 'install' ? 'Install': 'Uninstall')); + variables.stats.postEvent('marketplace-item', `${this.state.item.display_name} ${(type === 'install' ? 'installed': 'uninstalled')}`); + variables.stats.postEvent('marketplace', (type === 'install' ? 'Install': 'Uninstall')); } sortMarketplace(value, sendEvent) { @@ -144,7 +144,7 @@ export default class Marketplace extends PureComponent { }); if (sendEvent) { - window.stats.postEvent('marketplace', 'Sort'); + variables.stats.postEvent('marketplace', 'Sort'); } } @@ -186,7 +186,7 @@ export default class Marketplace extends PureComponent { const featured = () => { const openFeatured = () => { - window.stats.postEvent('marketplace', 'Featured clicked'); + variables.stats.postEvent('marketplace', 'Featured clicked'); window.open(this.state.featured.buttonLink); }; diff --git a/src/components/modals/main/marketplace/sections/Sideload.jsx b/src/components/modals/main/marketplace/sections/Sideload.jsx index ce7769cf..96f3e47b 100644 --- a/src/components/modals/main/marketplace/sections/Sideload.jsx +++ b/src/components/modals/main/marketplace/sections/Sideload.jsx @@ -24,17 +24,17 @@ export default class Sideload extends PureComponent { installAddon(input) { let failedReason = ''; if (!input.name) { - failedReason = 'No name provided'; + failedReason = getMessage('modals.main.addons.sideload.errors.no_name'); } else if (!input.author) { - failedReason = 'No author provided'; + failedReason = getMessage('modals.main.addons.sideload.errors.no_author'); } else if (!input.type) { - failedReason = 'No type provided'; + failedReason = getMessage('modals.main.addons.sideload.errors.no_type'); } else if (!input.version) { - failedReason = 'No version provided'; + failedReason = getMessage('modals.main.addons.sideload.errors.no_version'); } else if (input.type === 'photos' && (!input.photos || !input.photos.length || !input.photos[0].url.default || !input.photos[0].photographer || !input.photos[0].location)) { - failedReason = 'Invalid photos object'; + failedReason = getMessage('modals.main.addons.sideload.errors.invalid_photos'); } else if (input.type === 'quotes' && (!input.quotes || !input.quotes.length || !input.quotes[0].quote || !input.quotes[0].author)) { - failedReason = 'Invalid quotes object'; + failedReason = getMessage('modals.main.addons.sideload.errors.invalid_quotes'); } if (failedReason !== '') { @@ -46,7 +46,7 @@ export default class Sideload extends PureComponent { install(input.type, input); toast(this.getMessage('toasts.installed')); - window.stats.postEvent('marketplace', 'Sideload'); + variables.stats.postEvent('marketplace', 'Sideload'); } render() { @@ -55,7 +55,7 @@ export default class Sideload extends PureComponent {
this.installAddon(JSON.parse(e.target.result))} /> -

{this.getMessage('modals.main.addons.sideload')}

+

{this.getMessage('modals.main.addons.sideload.title')}

this.setState({ showFailed: false })} isOpen={this.state.showFailed} className='Modal resetmodal mainModal sideloadModal' overlayClassName='Overlay resetoverlay' ariaHideApp={false}> diff --git a/src/components/modals/main/settings/Checkbox.jsx b/src/components/modals/main/settings/Checkbox.jsx index e056e03f..0c2c4746 100644 --- a/src/components/modals/main/settings/Checkbox.jsx +++ b/src/components/modals/main/settings/Checkbox.jsx @@ -1,3 +1,4 @@ +import variables from 'modules/variables'; import { PureComponent } from 'react'; import { Checkbox as CheckboxUI, FormControlLabel } from '@mui/material'; @@ -19,7 +20,7 @@ export default class Checkbox extends PureComponent { checked: value }); - window.stats.postEvent('setting', `${this.props.name} ${(this.state.checked === true) ? 'enabled' : 'disabled'}`); + variables.stats.postEvent('setting', `${this.props.name} ${(this.state.checked === true) ? 'enabled' : 'disabled'}`); if (this.props.element) { if (!document.querySelector(this.props.element)) { diff --git a/src/components/modals/main/settings/Dropdown.jsx b/src/components/modals/main/settings/Dropdown.jsx index 0a736756..921cf46d 100644 --- a/src/components/modals/main/settings/Dropdown.jsx +++ b/src/components/modals/main/settings/Dropdown.jsx @@ -24,7 +24,7 @@ export default class Dropdown extends PureComponent { return; } - window.stats.postEvent('setting', `${this.props.name} from ${this.state.value} to ${value}`); + variables.stats.postEvent('setting', `${this.props.name} from ${this.state.value} to ${value}`); this.setState({ value, diff --git a/src/components/modals/main/settings/Radio.jsx b/src/components/modals/main/settings/Radio.jsx index 00d8c20e..09cf52d7 100644 --- a/src/components/modals/main/settings/Radio.jsx +++ b/src/components/modals/main/settings/Radio.jsx @@ -32,7 +32,7 @@ export default class Radio extends PureComponent { value }); - window.stats.postEvent('setting', `${this.props.name} from ${this.state.value} to ${value}`); + variables.stats.postEvent('setting', `${this.props.name} from ${this.state.value} to ${value}`); if (this.props.element) { if (!document.querySelector(this.props.element)) { diff --git a/src/components/modals/main/settings/ResetModal.jsx b/src/components/modals/main/settings/ResetModal.jsx index 5bed136a..f846c4b5 100644 --- a/src/components/modals/main/settings/ResetModal.jsx +++ b/src/components/modals/main/settings/ResetModal.jsx @@ -4,7 +4,7 @@ import { setDefaultSettings } from 'modules/helpers/settings'; export default function ResetModal({ modalClose }) { const reset = () => { - window.stats.postEvent('setting', 'Reset'); + variables.stats.postEvent('setting', 'Reset'); setDefaultSettings('reset'); window.location.reload(); }; diff --git a/src/components/modals/main/settings/Switch.jsx b/src/components/modals/main/settings/Switch.jsx index d95cd5e9..0ea404ac 100644 --- a/src/components/modals/main/settings/Switch.jsx +++ b/src/components/modals/main/settings/Switch.jsx @@ -1,3 +1,4 @@ +import variables from 'modules/variables'; import { PureComponent } from 'react'; import { Switch as SwitchUI, FormControlLabel } from '@mui/material'; @@ -19,7 +20,7 @@ export default class Switch extends PureComponent { checked: value }); - window.stats.postEvent('setting', `${this.props.name} ${(this.state.checked === true) ? 'enabled' : 'disabled'}`); + variables.stats.postEvent('setting', `${this.props.name} ${(this.state.checked === true) ? 'enabled' : 'disabled'}`); if (this.props.element) { if (!document.querySelector(this.props.element)) { diff --git a/src/components/modals/main/settings/sections/About.jsx b/src/components/modals/main/settings/sections/About.jsx index 5f302531..f61e8cb3 100644 --- a/src/components/modals/main/settings/sections/About.jsx +++ b/src/components/modals/main/settings/sections/About.jsx @@ -26,10 +26,10 @@ export default class About extends PureComponent { let contributors, sponsors, photographers, versionData; try { - versionData = await (await fetch(window.constants.GITHUB_URL + '/repos/' + window.constants.ORG_NAME + '/' + window.constants.REPO_NAME + '/releases', { signal: this.controller.signal })).json(); - contributors = await (await fetch(window.constants.GITHUB_URL + '/repos/'+ window.constants.ORG_NAME + '/' + window.constants.REPO_NAME + '/contributors', { signal: this.controller.signal })).json(); - sponsors = (await (await fetch(window.constants.SPONSORS_URL + '/list', { signal: this.controller.signal })).json()).sponsors; - photographers = await (await fetch(window.constants.API_URL + '/images/photographers', { signal: this.controller.signal })).json(); + versionData = await (await fetch(variables.constants.GITHUB_URL + '/repos/' + variables.constants.ORG_NAME + '/' + variables.constants.REPO_NAME + '/releases', { signal: this.controller.signal })).json(); + contributors = await (await fetch(variables.constants.GITHUB_URL + '/repos/'+ variables.constants.ORG_NAME + '/' + variables.constants.REPO_NAME + '/contributors', { signal: this.controller.signal })).json(); + sponsors = (await (await fetch(variables.constants.SPONSORS_URL + '/list', { signal: this.controller.signal })).json()).sponsors; + photographers = await (await fetch(variables.constants.API_URL + '/images/photographers', { signal: this.controller.signal })).json(); } catch (e) { if (this.controller.signal.aborted === true) { return; @@ -48,7 +48,7 @@ export default class About extends PureComponent { const newVersion = versionData[0].tag_name; let update = this.getMessage('modals.main.settings.sections.about.version.no_update'); - if (Number(window.constants.VERSION.replaceAll('.', '')) < Number(newVersion.replaceAll('.', ''))) { + if (Number(variables.constants.VERSION.replaceAll('.', '')) < Number(newVersion.replaceAll('.', ''))) { update = `${this.getMessage('modals.main.settings.sections.about.version.update_available')}: ${newVersion}`; } @@ -85,22 +85,22 @@ export default class About extends PureComponent { <>

{this.getMessage('modals.main.settings.sections.about.title')}

Logo -

{this.getMessage('modals.main.settings.sections.about.copyright')} {window.constants.COPYRIGHT_YEAR}-{new Date().getFullYear()} {window.constants.COPYRIGHT_NAME} ({window.constants.COPYRIGHT_LICENSE})

-

{this.getMessage('modals.main.settings.sections.about.version.title')} {window.constants.VERSION} ({this.state.update})

- {this.getMessage('modals.welcome.sections.privacy.links.privacy_policy')} +

{this.getMessage('modals.main.settings.sections.about.copyright')} {variables.constants.COPYRIGHT_YEAR}-{new Date().getFullYear()} {variables.constants.COPYRIGHT_NAME} ({variables.constants.COPYRIGHT_LICENSE})

+

{this.getMessage('modals.main.settings.sections.about.version.title')} {variables.constants.VERSION} ({this.state.update})

+ {this.getMessage('modals.welcome.sections.privacy.links.privacy_policy')}

{this.getMessage('modals.main.settings.sections.about.contact_us')}

- - - - - + + + + +

{this.getMessage('modals.main.settings.sections.about.support_mue')}

- GitHub Sponsors -   •  Ko-Fi -   •  Patreon + GitHub Sponsors +   •  Ko-Fi +   •  Patreon

{this.getMessage('modals.main.settings.sections.about.resources_used.title')}

diff --git a/src/components/modals/main/settings/sections/Appearance.jsx b/src/components/modals/main/settings/sections/Appearance.jsx index 21df549f..ebb820d8 100644 --- a/src/components/modals/main/settings/sections/Appearance.jsx +++ b/src/components/modals/main/settings/sections/Appearance.jsx @@ -54,7 +54,8 @@ export default function AppearanceSettings() {

{getMessage('modals.main.settings.sections.appearance.accessibility.title')}

- + ); } diff --git a/src/components/modals/main/settings/sections/Changelog.jsx b/src/components/modals/main/settings/sections/Changelog.jsx index ea3f79cf..0c35fd3a 100644 --- a/src/components/modals/main/settings/sections/Changelog.jsx +++ b/src/components/modals/main/settings/sections/Changelog.jsx @@ -19,7 +19,7 @@ export default class Changelog extends PureComponent { } async getUpdate() { - const data = await (await fetch(window.constants.BLOG_POST + '/index.json', { signal: this.controller.signal })).json(); + const data = await (await fetch(variables.constants.BLOG_POST + '/index.json', { signal: this.controller.signal })).json(); if (this.controller.signal.aborted === true) { return; diff --git a/src/components/modals/main/settings/sections/Experimental.jsx b/src/components/modals/main/settings/sections/Experimental.jsx index 153cd4b1..41f19a82 100644 --- a/src/components/modals/main/settings/sections/Experimental.jsx +++ b/src/components/modals/main/settings/sections/Experimental.jsx @@ -5,14 +5,13 @@ import Slider from '../Slider'; import EventBus from 'modules/helpers/eventbus'; export default function ExperimentalSettings() { - const getMessage = (languagecode, text) => variables.language.getMessage(languagecode, text); - const languagecode = variables.languagecode; + const getMessage = (text) => variables.language.getMessage(variables.languagecode, text); return ( <> -

{getMessage(languagecode, 'modals.main.settings.sections.experimental.title')}

-

{getMessage(languagecode, 'modals.main.settings.sections.experimental.warning')}

-

{getMessage(languagecode, 'modals.main.settings.sections.experimental.developer')}

+

{getMessage('modals.main.settings.sections.experimental.title')}

+

{getMessage('modals.main.settings.sections.experimental.warning')}

+

{getMessage('modals.main.settings.sections.experimental.developer')}


diff --git a/src/components/modals/main/settings/sections/Keybinds.jsx b/src/components/modals/main/settings/sections/Keybinds.jsx index fe57b3a4..2a8c6f8b 100644 --- a/src/components/modals/main/settings/sections/Keybinds.jsx +++ b/src/components/modals/main/settings/sections/Keybinds.jsx @@ -5,8 +5,7 @@ import Switch from '../Switch'; import KeybindInput from '../KeybindInput'; export default class KeybindSettings extends PureComponent { - getMessage = (languagecode, text) => variables.language.getMessage(languagecode, text); - languagecode = variables.languagecode; + getMessage = (text) => variables.language.getMessage(variables.languagecode, text); constructor() { super(); @@ -22,7 +21,7 @@ export default class KeybindSettings extends PureComponent { listen(type) { const currentKeybinds = this.state.keybinds; - currentKeybinds[type] = this.getMessage(this.languagecode, 'modals.main.settings.sections.keybinds.recording'); + currentKeybinds[type] = this.getMessage('modals.main.settings.sections.keybinds.recording'); this.setState({ keybinds: currentKeybinds }); @@ -98,32 +97,30 @@ export default class KeybindSettings extends PureComponent { } render() { - const { getMessage, languagecode } = this; - return ( <> -

{getMessage(languagecode, 'modals.main.settings.sections.keybinds.title')}

- +

{this.getMessage('modals.main.settings.sections.keybinds.title')}

+ - - - + + + - - - + + + - - - + + + - - - + + +
this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/>
this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/>
this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/>
this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/> this.action(type, e)}/>
diff --git a/src/components/modals/main/settings/sections/Language.jsx b/src/components/modals/main/settings/sections/Language.jsx index 0c2cdd3f..dc8e1537 100644 --- a/src/components/modals/main/settings/sections/Language.jsx +++ b/src/components/modals/main/settings/sections/Language.jsx @@ -5,15 +5,14 @@ import Radio from '../Radio'; const languages = require('modules/languages.json'); -export default class BackgroundSettings extends PureComponent { - getMessage = (languagecode, text) => variables.language.getMessage(languagecode, text); - languagecode = variables.languagecode; +export default class LanguageSettings extends PureComponent { + getMessage = (text) => variables.language.getMessage(variables.languagecode, text); constructor() { super(); this.state = { quoteLanguages: [{ - name: this.getMessage(this.languagecode, 'modals.main.loading'), + name: this.getMessage('modals.main.loading'), value: 'loading' }] }; @@ -21,7 +20,7 @@ export default class BackgroundSettings extends PureComponent { } async getQuoteLanguages() { - const data = await (await fetch(window.constants.API_URL + '/quotes/languages', { signal: this.controller.signal })).json(); + const data = await (await fetch(variables.constants.API_URL + '/quotes/languages', { signal: this.controller.signal })).json(); if (this.controller.signal.aborted === true) { return; @@ -44,7 +43,7 @@ export default class BackgroundSettings extends PureComponent { if (navigator.onLine === false || localStorage.getItem('offlineMode') === 'true') { return this.setState({ quoteLanguages: [{ - name: this.getMessage(this.languagecode, 'modals.main.marketplace.offline.description'), + name: this.getMessage('modals.main.marketplace.offline.description'), value: 'loading' }] }); @@ -61,9 +60,9 @@ export default class BackgroundSettings extends PureComponent { render() { return ( <> -

{this.getMessage(this.languagecode, 'modals.main.settings.sections.language.title')}

+

{this.getMessage('modals.main.settings.sections.language.title')}

-

{this.getMessage(this.languagecode, 'modals.main.settings.sections.language.quote')}

+

{this.getMessage('modals.main.settings.sections.language.quote')}

); diff --git a/src/components/modals/main/settings/sections/Order.jsx b/src/components/modals/main/settings/sections/Order.jsx index ea585147..03b1b98e 100644 --- a/src/components/modals/main/settings/sections/Order.jsx +++ b/src/components/modals/main/settings/sections/Order.jsx @@ -70,7 +70,7 @@ export default class OrderSettings extends PureComponent { componentDidUpdate() { localStorage.setItem('order', JSON.stringify(this.state.items)); - window.stats.postEvent('setting', 'Widget order'); + variables.stats.postEvent('setting', 'Widget order'); EventBus.dispatch('refresh', 'widgets'); } diff --git a/src/components/modals/main/settings/sections/Quote.jsx b/src/components/modals/main/settings/sections/Quote.jsx index f2d3c0c0..71ba7eca 100644 --- a/src/components/modals/main/settings/sections/Quote.jsx +++ b/src/components/modals/main/settings/sections/Quote.jsx @@ -88,7 +88,7 @@ export default class QuoteSettings extends PureComponent {

{this.getMessage('modals.main.settings.sections.quote.custom')} {this.getMessage('modals.main.settings.buttons.reset')}

{this.state.customQuote.map((_url, index) => ( - this.customQuote(e, true, index, 'quote')}> + this.customQuote(e, true, index, 'quote')}> this.customQuote(e, true, index, 'author')}> {this.state.customQuote.length > 1 ? : null} diff --git a/src/components/modals/main/tabs/Addons.jsx b/src/components/modals/main/tabs/Addons.jsx index e070af45..204f7f52 100644 --- a/src/components/modals/main/tabs/Addons.jsx +++ b/src/components/modals/main/tabs/Addons.jsx @@ -11,7 +11,7 @@ export default function Addons() { return (
-
+
); diff --git a/src/components/modals/main/tabs/Settings.jsx b/src/components/modals/main/tabs/Settings.jsx index 8ff80910..ef054d04 100644 --- a/src/components/modals/main/tabs/Settings.jsx +++ b/src/components/modals/main/tabs/Settings.jsx @@ -1,25 +1,25 @@ import variables from 'modules/variables'; import Tabs from './backend/Tabs'; -import About from '../settings/sections/About'; -import Language from '../settings/sections/Language'; -import Search from '../settings/sections/Search'; +import Navbar from '../settings/sections/Navbar'; import Greeting from '../settings/sections/Greeting'; import Time from '../settings/sections/Time'; -import Quote from '../settings/sections/Quote'; -import Appearance from '../settings/sections/Appearance'; -import Background from '../settings/sections/background/Background'; -import Advanced from '../settings/sections/Advanced'; -import Changelog from '../settings/sections/Changelog'; -import Order from '../settings/sections/Order'; -import Experimental from '../settings/sections/Experimental'; import QuickLinks from '../settings/sections/QuickLinks'; -import Weather from '../settings/sections/Weather'; -import Stats from '../settings/sections/Stats'; -import Keybinds from '../settings/sections/Keybinds'; -import Message from '../settings/sections/Message'; +import Quote from '../settings/sections/Quote'; import Date from '../settings/sections/Date'; -import Navbar from '../settings/sections/Navbar'; +import Message from '../settings/sections/Message'; +import Background from '../settings/sections/background/Background'; +import Search from '../settings/sections/Search'; +import Weather from '../settings/sections/Weather'; +import Order from '../settings/sections/Order'; +import Appearance from '../settings/sections/Appearance'; +import Language from '../settings/sections/Language'; +import Advanced from '../settings/sections/Advanced'; +import Keybinds from '../settings/sections/Keybinds'; +import Stats from '../settings/sections/Stats'; +import Experimental from '../settings/sections/Experimental'; +import Changelog from '../settings/sections/Changelog'; +import About from '../settings/sections/About'; export default function Settings() { const getMessage = (text) => variables.language.getMessage(variables.languagecode, text); diff --git a/src/components/modals/main/tabs/backend/Tab.jsx b/src/components/modals/main/tabs/backend/Tab.jsx index a2c33a93..064d5a52 100644 --- a/src/components/modals/main/tabs/backend/Tab.jsx +++ b/src/components/modals/main/tabs/backend/Tab.jsx @@ -4,28 +4,30 @@ import { SettingsRounded as Settings, Widgets as Addons, ShoppingBasket as Marketplace, - AccessAlarm as Time, + MenuOutlined as Navbar, + EmojiPeopleOutlined as Greeting, + AccessAlarm as Time, FormatQuoteOutlined as Quote, + Link as QuickLinks, + DateRangeOutlined as Date, + SmsOutlined as Message, PhotoOutlined as Background, Search, + CloudOutlined as Weather, + List as Order, FormatPaintOutlined as Appearance, Translate as Language, + SettingsOutlined as Advanced, + BugReportOutlined as Experimental, + KeyboardAltOutlined as Keybinds, + AssessmentOutlined as Stats, NewReleasesOutlined as Changelog, InfoOutlined as About, - BugReportOutlined as Experimental, - List as Order, - CloudOutlined as Weather, - SettingsOutlined as Advanced, - Link as QuickLinks, - SmsOutlined as Message, - AssessmentOutlined as Stats, + Code as Sideload, AddCircleOutline as Added, - CreateNewFolderOutlined as Create, - KeyboardAltOutlined as Keybinds, - DateRangeOutlined as Date, - MenuOutlined as Navbar + CreateNewFolderOutlined as Create } from '@mui/icons-material'; function Tab({ label, currentTab, onClick, navbarTab }) { @@ -50,17 +52,18 @@ function Tab({ label, currentTab, onClick, navbarTab }) { case getMessage('modals.main.navbar.marketplace'): icon = ; break; case getMessage('modals.main.settings.sections.appearance.navbar.title'): icon = ; break; - case getMessage('modals.main.settings.sections.time.title'): icon =
- {window.keybinds.downloadBackground && window.keybinds.downloadBackground !== '' ? downloadBackground()} /> : null} - {window.keybinds.showBackgroundInformation && window.keybinds.showBackgroundInformation !== '' ? showBackgroundInformation()} /> : null} + {variables.keybinds.downloadBackground && variables.keybinds.downloadBackground !== '' ? downloadBackground()} /> : null} + {variables.keybinds.showBackgroundInformation && variables.keybinds.showBackgroundInformation !== '' ? showBackgroundInformation()} /> : null}
); } diff --git a/src/components/widgets/navbar/Navbar.jsx b/src/components/widgets/navbar/Navbar.jsx index a027e824..8a9d8655 100644 --- a/src/components/widgets/navbar/Navbar.jsx +++ b/src/components/widgets/navbar/Navbar.jsx @@ -67,7 +67,7 @@ export default class Navbar extends PureComponent {
: null} - {(window.constants.BETA_VERSION === true) ? + {(variables.constants.BETA_VERSION === true) ? this.props.openModal('feedbackModal')}/> diff --git a/src/components/widgets/navbar/Notes.jsx b/src/components/widgets/navbar/Notes.jsx index 7ff1beb5..7d5befc9 100644 --- a/src/components/widgets/navbar/Notes.jsx +++ b/src/components/widgets/navbar/Notes.jsx @@ -23,7 +23,7 @@ export default class Notes extends PureComponent { }; pin() { - window.stats.postEvent('feature', 'Notes pin'); + variables.stats.postEvent('feature', 'Notes pin'); if (localStorage.getItem('notesPinned') === 'true') { localStorage.setItem('notesPinned', false); @@ -39,7 +39,7 @@ export default class Notes extends PureComponent { } copy() { - window.stats.postEvent('feature', 'Notes copied'); + variables.stats.postEvent('feature', 'Notes copied'); navigator.clipboard.writeText(this.state.notes); toast(variables.language.getMessage(variables.languagecode, 'toasts.notes')); } @@ -54,8 +54,8 @@ export default class Notes extends PureComponent { - {window.keybinds.pinNotes && window.keybinds.pinNotes !== '' ? this.pin()}/> : null} - {window.keybinds.copyNotes && window.keybinds.copyNotes !== '' ? this.copy()}/> : null} + {variables.keybinds.pinNotes && variables.keybinds.pinNotes !== '' ? this.pin()}/> : null} + {variables.keybinds.copyNotes && variables.keybinds.copyNotes !== '' ? this.copy()}/> : null} ); } diff --git a/src/components/widgets/quicklinks/QuickLinks.jsx b/src/components/widgets/quicklinks/QuickLinks.jsx index 37b02dfa..1e6b0ff5 100644 --- a/src/components/widgets/quicklinks/QuickLinks.jsx +++ b/src/components/widgets/quicklinks/QuickLinks.jsx @@ -36,7 +36,7 @@ export default class QuickLinks extends PureComponent { items: data }); - window.stats.postEvent('feature', 'Quicklink delete'); + variables.stats.postEvent('feature', 'Quicklink delete'); } addLink = () => { @@ -80,7 +80,7 @@ export default class QuickLinks extends PureComponent { url: '' }); - window.stats.postEvent('feature', 'Quicklink add'); + variables.stats.postEvent('feature', 'Quicklink add'); this.toggleAdd(); @@ -191,7 +191,7 @@ export default class QuickLinks extends PureComponent {
- {window.keybinds.toggleQuicklinks && window.keybinds.toggleQuicklinks !== '' ? : null} + {variables.keybinds.toggleQuicklinks && variables.keybinds.toggleQuicklinks !== '' ? : null} ); } diff --git a/src/components/widgets/quote/Quote.jsx b/src/components/widgets/quote/Quote.jsx index 364e1f8c..0263b0e9 100644 --- a/src/components/widgets/quote/Quote.jsx +++ b/src/components/widgets/quote/Quote.jsx @@ -146,7 +146,7 @@ export default class Quote extends PureComponent { // First we try and get a quote from the API... try { const quotelanguage = localStorage.getItem('quotelanguage'); - const data = await (await fetch(window.constants.API_URL + '/quotes/random?language=' + quotelanguage)).json(); + const data = await (await fetch(variables.constants.API_URL + '/quotes/random?language=' + quotelanguage)).json(); // If we hit the ratelimit, we fallback to local quotes if (data.statusCode === 429) { @@ -173,13 +173,13 @@ export default class Quote extends PureComponent { } copyQuote() { - window.stats.postEvent('feature', 'Quote copied'); + variables.stats.postEvent('feature', 'Quote copied'); navigator.clipboard.writeText(`${this.state.quote} - ${this.state.author}`); toast(variables.language.getMessage(variables.languagecode, 'toasts.quote')); } tweetQuote() { - window.stats.postEvent('feature', 'Quote tweet'); + variables.stats.postEvent('feature', 'Quote tweet'); window.open(`https://twitter.com/intent/tweet?text=${this.state.quote} - ${this.state.author} on @getmue`, '_blank').focus(); } @@ -196,7 +196,7 @@ export default class Quote extends PureComponent { }); } - window.stats.postEvent('feature', 'Quote favourite'); + variables.stats.postEvent('feature', 'Quote favourite'); } init() { @@ -277,9 +277,9 @@ export default class Quote extends PureComponent {
{this.state.copy} {this.state.tweet} {this.state.favourited} - {window.keybinds.favouriteQuote && window.keybinds.favouriteQuote !== '' ? this.favourite()} /> : null} - {window.keybinds.tweetQuote && window.keybinds.tweetQuote !== '' ? this.tweetQuote()} /> : null} - {window.keybinds.copyQuote && window.keybinds.copyQuote !== '' ? this.copyQuote()} /> : null} + {variables.keybinds.favouriteQuote && variables.keybinds.favouriteQuote !== '' ? this.favourite()} /> : null} + {variables.keybinds.tweetQuote && variables.keybinds.tweetQuote !== '' ? this.tweetQuote()} /> : null} + {variables.keybinds.copyQuote && variables.keybinds.copyQuote !== '' ? this.copyQuote()} /> : null} ); } diff --git a/src/components/widgets/search/Search.jsx b/src/components/widgets/search/Search.jsx index 0b80fb31..037ab30c 100644 --- a/src/components/widgets/search/Search.jsx +++ b/src/components/widgets/search/Search.jsx @@ -43,7 +43,7 @@ export default class Search extends PureComponent { } setTimeout(() => { - window.stats.postEvent('feature', 'Voice search'); + variables.stats.postEvent('feature', 'Voice search'); window.location.href = this.state.url + `?${this.state.query}=` + searchText.value; }, 1000); }; @@ -52,7 +52,7 @@ export default class Search extends PureComponent { searchButton = (e) => { e.preventDefault(); const value = e.target.value || document.getElementById('searchtext').value || 'mue fast'; - window.stats.postEvent('feature', 'Search'); + variables.stats.postEvent('feature', 'Search'); window.location.href = this.state.url + `?${this.state.query}=` + value; } @@ -195,7 +195,7 @@ export default class Search extends PureComponent { {this.state.microphone} this.getSuggestions(e)} onClick={this.searchButton}/> - {window.keybinds.focusSearch && window.keybinds.focusSearch !== '' ? document.getElementById('searchtext').focus()}/> : null} + {variables.keybinds.focusSearch && variables.keybinds.focusSearch !== '' ? document.getElementById('searchtext').focus()}/> : null} ); } diff --git a/src/components/widgets/time/Date.jsx b/src/components/widgets/time/Date.jsx index 45bba4ca..59dbb744 100644 --- a/src/components/widgets/time/Date.jsx +++ b/src/components/widgets/time/Date.jsx @@ -112,7 +112,6 @@ export default class DateWidget extends PureComponent { componentDidMount() { EventBus.on('refresh', (data) => { if (data === 'date' || data === 'timezone') { - if (localStorage.getItem('date') === 'false') { return this.date.current.style.display = 'none'; } @@ -124,7 +123,6 @@ export default class DateWidget extends PureComponent { }); this.date.current.style.fontSize = `${Number((localStorage.getItem('zoomDate') || 100) / 100)}em`; - this.getDate(); } diff --git a/src/components/widgets/weather/Weather.jsx b/src/components/widgets/weather/Weather.jsx index 7eb90708..0b256bf3 100644 --- a/src/components/widgets/weather/Weather.jsx +++ b/src/components/widgets/weather/Weather.jsx @@ -60,7 +60,7 @@ export default class Weather extends PureComponent { }; if (!this.state.weather.temp) { - data = await (await fetch(window.constants.PROXY_URL + `/weather/current?city=${this.state.location}&lang=${variables.languagecode}`)).json(); + data = await (await fetch(variables.constants.PROXY_URL + `/weather/current?city=${this.state.location}&lang=${variables.languagecode}`)).json(); } if (data.cod === '404') { diff --git a/src/index.js b/src/index.js index 9d57a02e..b7575c98 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,6 @@ import { render } from 'react-dom'; import App from './App'; -import * as Constants from 'modules/constants'; import variables from 'modules/variables'; import './scss/index.scss'; @@ -32,20 +31,12 @@ import('./translations/' + variables.languagecode + '.json').then((language) => document.documentElement.lang = variables.languagecode.split('_')[0]; } - window.constants = Constants; if (localStorage.getItem('stats') === 'true') { - window.stats = Stats; - } else { - window.stats = { - tabLoad: () => '', - postEvent: () => '' - }; + variables.stats = Stats; } if (localStorage.getItem('keybindsEnabled') === 'true') { - window.keybinds = JSON.parse(localStorage.getItem('keybinds') || '{}'); - } else { - window.keybinds = {}; + variables.keybinds = JSON.parse(localStorage.getItem('keybinds') || '{}'); } render( diff --git a/src/modules/helpers/settings/modals.js b/src/modules/helpers/settings/modals.js index ab2de433..6a867771 100644 --- a/src/modules/helpers/settings/modals.js +++ b/src/modules/helpers/settings/modals.js @@ -25,11 +25,11 @@ export function exportSettings() { settings[key] = localStorage.getItem(key); }); saveFile(settings, 'mue-settings.json'); - window.stats.postEvent('tab', 'Settings exported'); + variables.stats.postEvent('tab', 'Settings exported'); } export function importSettings(e) { - const getMessage = (languagecode, text) => variables.language.getMessage(variables.languagecode, text); + const getMessage = (text) => variables.language.getMessage(variables.languagecode, text); const content = JSON.parse(e.target.result); Object.keys(content).forEach((key) => { @@ -37,5 +37,5 @@ export function importSettings(e) { }); toast(getMessage('toasts.imported')); - window.stats.postEvent('tab', 'Settings imported'); + variables.stats.postEvent('tab', 'Settings imported'); } diff --git a/src/modules/variables.js b/src/modules/variables.js index e30db229..ee24f216 100644 --- a/src/modules/variables.js +++ b/src/modules/variables.js @@ -1,6 +1,14 @@ +import * as Constants from 'modules/constants'; + const variables = { - language: {}, - languagecode: '' + language: {}, + languagecode: '', + stats: { + tabLoad: () => '', + postEvent: () => '' + }, + keybinds: {}, + constants: Constants }; export default variables; diff --git a/src/translations/de_DE.json b/src/translations/de_DE.json index b2472426..01c3b730 100644 --- a/src/translations/de_DE.json +++ b/src/translations/de_DE.json @@ -422,7 +422,17 @@ "title": "Hier ist es leer", "description": "Gehen Sie zum Marktplatz, um einige hinzuzufügen" }, - "sideload": "Hochladen", + "sideload": { + "title": "Hochladen", + "failed": "Failed to sideload addon", + "errors": { + "no_name": "No name provided", + "no_author": "No author provided", + "no_type": "No type provided", + "invalid_photos": "Invalid photos object", + "invalid_quotes": "Invalid quotes object" + } + }, "sort": { "title": "Sortieren", "newest": "Installiert (Neueste)", diff --git a/src/translations/en_GB.json b/src/translations/en_GB.json index d8be8d1e..7ae4cbb9 100644 --- a/src/translations/en_GB.json +++ b/src/translations/en_GB.json @@ -421,7 +421,17 @@ "title": "Empty", "description": "No addons are installed" }, - "sideload": "Sideload", + "sideload": { + "title": "Sideload", + "failed": "Failed to sideload addon", + "errors": { + "no_name": "No name provided", + "no_author": "No author provided", + "no_type": "No type provided", + "invalid_photos": "Invalid photos object", + "invalid_quotes": "Invalid quotes object" + } + }, "sort": { "title": "Sort", "newest": "Installed (Newest)", diff --git a/src/translations/en_US.json b/src/translations/en_US.json index 6cb359d1..be619ab3 100644 --- a/src/translations/en_US.json +++ b/src/translations/en_US.json @@ -421,7 +421,17 @@ "title": "Empty", "description": "No addons are installed" }, - "sideload": "Sideload", + "sideload": { + "title": "Sideload", + "failed": "Failed to sideload addon", + "errors": { + "no_name": "No name provided", + "no_author": "No author provided", + "no_type": "No type provided", + "invalid_photos": "Invalid photos object", + "invalid_quotes": "Invalid quotes object" + } + }, "sort": { "title": "Sort", "newest": "Installed (Newest)", diff --git a/src/translations/es.json b/src/translations/es.json index 9c0dfde3..e88666ac 100644 --- a/src/translations/es.json +++ b/src/translations/es.json @@ -421,7 +421,17 @@ "title": "Vacío", "description": "Dirígete a la tienda para agregar algunos." }, - "sideload": "Cargar localmente", + "sideload": { + "title": "Cargar localmente", + "failed": "Failed to sideload addon", + "errors": { + "no_name": "No name provided", + "no_author": "No author provided", + "no_type": "No type provided", + "invalid_photos": "Invalid photos object", + "invalid_quotes": "Invalid quotes object" + } + }, "sort": { "title": "Ordenar", "newest": "Instalado (Nuevos)", diff --git a/src/translations/fr.json b/src/translations/fr.json index 43e5d25e..941fd23b 100644 --- a/src/translations/fr.json +++ b/src/translations/fr.json @@ -421,7 +421,17 @@ "title": "C'est vide par ici", "description": "Dirigez vous vers le marché pour ajouter des options" }, - "sideload": "Charger", + "sideload": { + "title": "Charger", + "failed": "Failed to sideload addon", + "errors": { + "no_name": "No name provided", + "no_author": "No author provided", + "no_type": "No type provided", + "invalid_photos": "Invalid photos object", + "invalid_quotes": "Invalid quotes object" + } + }, "sort": { "title": "Sort", "newest": "Installed (Newest)", diff --git a/src/translations/nl.json b/src/translations/nl.json index 2caa0fb2..f3ff0f89 100644 --- a/src/translations/nl.json +++ b/src/translations/nl.json @@ -421,7 +421,17 @@ "title": "Het is hier erg leeg", "description": "Ga naar de marktplaats om een paar extensies toe te voegen" }, - "sideload": "Sideloaden", + "sideload": { + "title": "Sideloaden", + "failed": "Failed to sideload addon", + "errors": { + "no_name": "No name provided", + "no_author": "No author provided", + "no_type": "No type provided", + "invalid_photos": "Invalid photos object", + "invalid_quotes": "Invalid quotes object" + } + }, "sort": { "title": "Sort", "newest": "Installed (Newest)", diff --git a/src/translations/no.json b/src/translations/no.json index 74391672..f43dcb76 100644 --- a/src/translations/no.json +++ b/src/translations/no.json @@ -421,7 +421,17 @@ "title": "Det er tomt her.", "description": "Gå til markedsplassen å legg til noe" }, - "sideload": "Sideload", + "sideload": { + "title": "Sideload", + "failed": "Failed to sideload addon", + "errors": { + "no_name": "No name provided", + "no_author": "No author provided", + "no_type": "No type provided", + "invalid_photos": "Invalid photos object", + "invalid_quotes": "Invalid quotes object" + } + }, "sort": { "title": "Sort", "newest": "Installed (Newest)", diff --git a/src/translations/ru.json b/src/translations/ru.json index cbb4e5c2..48feeeb8 100644 --- a/src/translations/ru.json +++ b/src/translations/ru.json @@ -421,7 +421,17 @@ "title": "Здесь пусто", "description": "Зайдите в магазин, чтобы найти что-то интересное" }, - "sideload": "Загрузить", + "sideload": { + "title": "Загрузить", + "failed": "Failed to sideload addon", + "errors": { + "no_name": "No name provided", + "no_author": "No author provided", + "no_type": "No type provided", + "invalid_photos": "Invalid photos object", + "invalid_quotes": "Invalid quotes object" + } + }, "sort": { "title": "Sort", "newest": "Installed (Newest)", diff --git a/src/translations/zh_CN.json b/src/translations/zh_CN.json index 6a174bef..66121916 100644 --- a/src/translations/zh_CN.json +++ b/src/translations/zh_CN.json @@ -421,7 +421,17 @@ "title": "这里空空如也", "description": "请访问插件市场来添加插件。" }, - "sideload": "上传插件", + "sideload": { + "title": "上传插件", + "failed": "Failed to sideload addon", + "errors": { + "no_name": "No name provided", + "no_author": "No author provided", + "no_type": "No type provided", + "invalid_photos": "Invalid photos object", + "invalid_quotes": "Invalid quotes object" + } + }, "sort": { "title": "排序", "newest": "安装过 (从新到旧)",