From 5947aa25fde78a9954b46b89cfb1b021aac134b6 Mon Sep 17 00:00:00 2001 From: David Ralph Date: Fri, 2 Apr 2021 13:24:18 +0100 Subject: [PATCH] feat: debug timeout option, translation support for many things and improve sliders --- src/components/modals/main/settings/Radio.jsx | 4 +- .../modals/main/settings/Slider.jsx | 2 +- .../modals/main/settings/sections/About.jsx | 12 +++--- .../main/settings/sections/Advanced.jsx | 6 +-- .../main/settings/sections/Appearance.jsx | 36 ++++++++-------- .../main/settings/sections/Experimental.jsx | 3 ++ .../main/settings/sections/Greeting.jsx | 2 +- .../modals/main/settings/sections/Order.jsx | 4 +- .../modals/main/settings/sections/Search.jsx | 4 +- .../modals/main/settings/sections/Time.jsx | 8 ++-- .../sections/background/Background.jsx | 7 ++- src/components/modals/main/tabs/Settings.jsx | 2 +- .../modals/main/tabs/backend/Tab.jsx | 2 +- src/modules/default_settings.json | 4 ++ src/modules/helpers/experimental.js | 10 ++++- src/translations/en_GB.json | 43 +++++++++++++++++-- src/translations/en_US.json | 12 ++++-- 17 files changed, 108 insertions(+), 53 deletions(-) diff --git a/src/components/modals/main/settings/Radio.jsx b/src/components/modals/main/settings/Radio.jsx index 93dc345a..87393273 100644 --- a/src/components/modals/main/settings/Radio.jsx +++ b/src/components/modals/main/settings/Radio.jsx @@ -29,9 +29,9 @@ export default class Radio extends React.PureComponent { {this.props.title} - {this.props.options.map(option => + {this.props.options.map(option => ( } label={option.name} key={option.name} /> - )} + ))} ); diff --git a/src/components/modals/main/settings/Slider.jsx b/src/components/modals/main/settings/Slider.jsx index bced0d5e..1976000f 100644 --- a/src/components/modals/main/settings/Slider.jsx +++ b/src/components/modals/main/settings/Slider.jsx @@ -33,7 +33,7 @@ export default class Slider extends React.PureComponent { return ( <>

{this.props.title} ({this.state.value}{this.props.display}) {this.language.buttons.reset}

- + ); } diff --git a/src/components/modals/main/settings/sections/About.jsx b/src/components/modals/main/settings/sections/About.jsx index cb8f75b5..922726f4 100644 --- a/src/components/modals/main/settings/sections/About.jsx +++ b/src/components/modals/main/settings/sections/About.jsx @@ -74,24 +74,24 @@ export default class About extends React.PureComponent {

Undraw ({this.language.resources_used.welcome_img})

{this.language.contributors}

{this.state.loading} - {this.state.contributors.map((item) => + {this.state.contributors.map((item) => ( {item.login} - )} + ))} { // for those who contributed without opening a pull request - this.state.other_contributors.map((item) => + this.state.other_contributors.map((item) => ( {item.login} - )} + ))}

{this.language.supporters}

{this.state.loading} - {this.state.sponsors.map((item) => + {this.state.sponsors.map((item) => ( {item.handle} - )} + ))}

{this.language.photographers}

{this.state.loading}

{this.state.photographers}

diff --git a/src/components/modals/main/settings/sections/Advanced.jsx b/src/components/modals/main/settings/sections/Advanced.jsx index 1a0188a9..90142274 100644 --- a/src/components/modals/main/settings/sections/Advanced.jsx +++ b/src/components/modals/main/settings/sections/Advanced.jsx @@ -41,16 +41,16 @@ export default class AdvancedSettings extends React.PureComponent { - this.settingsImport(e)} /> + this.settingsImport(e)}/>

{advanced.customisation}

- +

{this.language.sections.experimental.title}

{advanced.experimental_warning}

- + this.setState({ resetModal: false })} isOpen={this.state.resetModal} className={'Modal resetmodal'} overlayClassName={'Overlay resetoverlay'} ariaHideApp={false}> this.setState({ resetModal: false })} /> diff --git a/src/components/modals/main/settings/sections/Appearance.jsx b/src/components/modals/main/settings/sections/Appearance.jsx index b2ae9b08..55e20435 100644 --- a/src/components/modals/main/settings/sections/Appearance.jsx +++ b/src/components/modals/main/settings/sections/Appearance.jsx @@ -13,15 +13,15 @@ export default function AppearanceSettings() { const themeOptions = [ { - 'name': 'Auto', + 'name': appearance.theme.auto, 'value': 'auto' }, { - 'name': 'Light', + 'name': appearance.theme.light, 'value': 'light' }, { - 'name': 'Dark', + 'name': appearance.theme.dark, 'value': 'dark' } ]; @@ -29,7 +29,7 @@ export default function AppearanceSettings() { return ( <>

{appearance.title}

- +

{appearance.navbar.title}

@@ -39,29 +39,29 @@ export default function AppearanceSettings() {
- + {/* names are taken from https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight */} - - - - - - - - + + + + + + + +

- - - - + + + +

{appearance.accessibility.title}

{(engineName === 'Blink') ? : null} - + ); } diff --git a/src/components/modals/main/settings/sections/Experimental.jsx b/src/components/modals/main/settings/sections/Experimental.jsx index 232df307..819b0093 100644 --- a/src/components/modals/main/settings/sections/Experimental.jsx +++ b/src/components/modals/main/settings/sections/Experimental.jsx @@ -1,6 +1,7 @@ import React from 'react'; import Checkbox from '../Checkbox'; +import Slider from '../Slider'; //import Text from '../Text'; export default function ExperimentalSettings() { @@ -13,6 +14,7 @@ export default function ExperimentalSettings() {

{experimental.developer}

+ {/* @@ -22,6 +24,7 @@ export default function ExperimentalSettings() {

*/} +

); diff --git a/src/components/modals/main/settings/sections/Greeting.jsx b/src/components/modals/main/settings/sections/Greeting.jsx index ba28f265..5c10441f 100644 --- a/src/components/modals/main/settings/sections/Greeting.jsx +++ b/src/components/modals/main/settings/sections/Greeting.jsx @@ -37,7 +37,7 @@ export default class GreetingSettings extends React.PureComponent {

{greeting.birthday}

- +

{greeting.birthday_date}

diff --git a/src/components/modals/main/settings/sections/Order.jsx b/src/components/modals/main/settings/sections/Order.jsx index b2d7af30..f5d7bb75 100644 --- a/src/components/modals/main/settings/sections/Order.jsx +++ b/src/components/modals/main/settings/sections/Order.jsx @@ -49,8 +49,8 @@ export default class OrderSettings extends React.PureComponent { render() { return ( <> -

Order

- Reset +

{this.language.sections.order.title}

+ {this.language.buttons.reset} {this.state.items.map((value, index) => ( diff --git a/src/components/modals/main/settings/sections/Search.jsx b/src/components/modals/main/settings/sections/Search.jsx index 084ec2b7..d1fc42bb 100644 --- a/src/components/modals/main/settings/sections/Search.jsx +++ b/src/components/modals/main/settings/sections/Search.jsx @@ -64,9 +64,9 @@ export default class SearchSettings extends React.PureComponent { {isChrome ? : null} this.setSearchEngine(value)}> - {searchEngines.map((engine) => + {searchEngines.map((engine) => ( - )} + ))}
    diff --git a/src/components/modals/main/settings/sections/Time.jsx b/src/components/modals/main/settings/sections/Time.jsx index e71b0d4c..173029a9 100644 --- a/src/components/modals/main/settings/sections/Time.jsx +++ b/src/components/modals/main/settings/sections/Time.jsx @@ -22,11 +22,11 @@ export default class TimeSettings extends React.PureComponent { const digitalOptions = [ { - 'name': '24 hour', + 'name': time.digital.twentyfourhour, 'value': 'twentyfourhour' }, { - 'name': '12 hour', + 'name': time.digital.twelvehour, 'value': 'twelvehour' } ]; @@ -104,8 +104,8 @@ export default class TimeSettings extends React.PureComponent {

    {time.date.title}

    this.setState({ dateType: value })}> - - + +
    {dateSettings} diff --git a/src/components/modals/main/settings/sections/background/Background.jsx b/src/components/modals/main/settings/sections/background/Background.jsx index 7949a5f3..b192cd62 100644 --- a/src/components/modals/main/settings/sections/background/Background.jsx +++ b/src/components/modals/main/settings/sections/background/Background.jsx @@ -60,7 +60,6 @@ export default class BackgroundSettings extends React.PureComponent { const customSettings = ( <> -

    {background.source.title}

      {background.source.custom_url} this.resetItem('customBackground')}>{this.language.buttons.reset}

      this.setState({ customBackground: e.target.value })}> @@ -98,9 +97,9 @@ export default class BackgroundSettings extends React.PureComponent {

      this.setState({ backgroundType: value })}> - - - + + +
      diff --git a/src/components/modals/main/tabs/Settings.jsx b/src/components/modals/main/tabs/Settings.jsx index 9a7de327..44be6f7f 100644 --- a/src/components/modals/main/tabs/Settings.jsx +++ b/src/components/modals/main/tabs/Settings.jsx @@ -26,7 +26,7 @@ export default function Settings() {
      -
      +
      diff --git a/src/components/modals/main/tabs/backend/Tab.jsx b/src/components/modals/main/tabs/backend/Tab.jsx index 4cb01c63..120cb8fb 100644 --- a/src/components/modals/main/tabs/backend/Tab.jsx +++ b/src/components/modals/main/tabs/backend/Tab.jsx @@ -51,7 +51,7 @@ export default function Tab(props) { case language.background.title: icon = ; break; case language.search.title: icon = ; break; case language.appearance.title: icon = ; break; - case language.order: icon = ; break; + case language.order.title: icon = ; break; case language.language.title: icon = ; divider = true; break; case language.advanced.title: icon = ; break; case language.experimental.title: icon = ; divider = true; break; diff --git a/src/modules/default_settings.json b/src/modules/default_settings.json index 4fd963d9..2bf43aa2 100644 --- a/src/modules/default_settings.json +++ b/src/modules/default_settings.json @@ -142,5 +142,9 @@ { "name": "experimental", "value": false + }, + { + "name": "debugtimeout", + "value": 0 } ] diff --git a/src/modules/helpers/experimental.js b/src/modules/helpers/experimental.js index 17cfa1d3..2d26bdf4 100644 --- a/src/modules/helpers/experimental.js +++ b/src/modules/helpers/experimental.js @@ -10,7 +10,15 @@ export default function ExperimentalInit() { switch (code) { case 222: - debugger; + const timeout = localStorage.getItem('debugtimeout'); + + if (timeout !== '0') { + setTimeout(() => { + debugger; + }, timeout); + } else { + debugger; + } break; } }; diff --git a/src/translations/en_GB.json b/src/translations/en_GB.json index 1623eb88..f0e2b4cf 100644 --- a/src/translations/en_GB.json +++ b/src/translations/en_GB.json @@ -44,6 +44,7 @@ "title": "Digital", "seconds": "Seconds", "twentyfourhour": "24 Hour", + "twelvehour": "12 hour", "ampm": "AM/PM (12 hour)", "zero": "Zero-padded" }, @@ -60,6 +61,10 @@ "title": "Date", "day_of_week": "Day of week", "datenth": "Date nth", + "type": { + "short": "Short", + "long": "Long" + }, "short_date": "Short Date", "short_format": "Short Format", "short_separator": { @@ -89,6 +94,7 @@ "default": "Default Greeting Message", "name": "Name for greeting", "birthday": "Birthday", + "birthday_age": "Birthday Age", "birthday_date": "Birthday Date" }, "background": { @@ -104,8 +110,12 @@ "blur": "Adjust Blur", "brightness": "Adjust Brightness" }, + "type": { + "api": "API", + "custom_image": "Custom Image", + "custom_colour": "Custom Colour/Gradient" + }, "source": { - "title": "Source", "api": "Background API", "custom_url": "Custom Background URL", "custom_background": "Custom Background", @@ -123,7 +133,12 @@ }, "appearance": { "title": "Appearance", - "dark_theme": "Dark Theme", + "theme": { + "title": "Theme", + "auto": "Auto", + "light": "Light", + "dark": "Dark" + }, "night_mode": "Night Mode", "animations": "Animations", "navbar": { @@ -134,7 +149,24 @@ "font": { "title": "Font", "custom": "Custom Font", - "google": "Import from Google Fonts" + "google": "Import from Google Fonts", + "weight": { + "title": "Font Weight", + "thin": "Thin", + "extra_light": "Extra Light", + "light": "Light", + "normal": "Normal", + "medium": "Medium", + "semi_bold": "Semi-Bold", + "bold": "Bold", + "extra_bold": "Extra-Bold" + }, + "style": { + "title": "Font Style", + "normal": "Normal", + "italic": "Italic", + "oblique": "Oblique" + } }, "accessibility": { "title": "Accessibility", @@ -143,7 +175,9 @@ "milliseconds": "milliseconds" } }, - "order": "Widget Order", + "order": { + "title": "Widget Order" + }, "advanced": { "title": "Advanced", "offline_mode": "Offline Mode", @@ -151,6 +185,7 @@ "customisation": "Customisation", "custom_css": "Custom CSS", "custom_js": "Custom JS", + "tab_name": "Tab Name", "experimental_warning": "Please note that the Mue team cannot provide support if you have experimental mode on. Please disable it first and see if the issue continues to occur before contacting support." }, "experimental": { diff --git a/src/translations/en_US.json b/src/translations/en_US.json index 043760f2..7f896d4f 100644 --- a/src/translations/en_US.json +++ b/src/translations/en_US.json @@ -9,9 +9,15 @@ "custom_author": "Custom Author" }, "background": { - "custom_colour": "Custom Background Color", - "add_colour": "Add color", - "favourite": "Favorite" + "buttons": { + "favourite": "Favorite" + }, + "type": { + "custom_colour": "Custom Color/Gradient" + }, + "source": { + "add_colour": "Add color" + } }, "time": { "analogue": {