From 04fb389d59ddf8775584fac2143416378a87936a Mon Sep 17 00:00:00 2001 From: David Ralph Date: Wed, 17 Mar 2021 22:01:07 +0000 Subject: [PATCH] fix: error boundary bugs and some translation issues with modal --- src/components/ErrorBoundary.jsx | 8 +-- .../modals/settings/sections/About.jsx | 20 ++++---- .../modals/settings/sections/Time.jsx | 28 +++++------ src/components/modals/tabs/Settings.jsx | 2 +- src/scss/modules/modals/_main.scss | 2 +- src/translations/en-GB.json | 50 +++++++++++-------- src/translations/en-US.json | 5 ++ 7 files changed, 65 insertions(+), 50 deletions(-) diff --git a/src/components/ErrorBoundary.jsx b/src/components/ErrorBoundary.jsx index f3efcf82..4c5cac3c 100644 --- a/src/components/ErrorBoundary.jsx +++ b/src/components/ErrorBoundary.jsx @@ -10,16 +10,18 @@ export default class ErrorBoundary extends React.PureComponent { static getDerivedStateFromError(error) { console.log(error); - return { error: true }; + return { + error: true + }; } render() { if (this.state.error) { return ( -
+

Error

Failed to load this component of Mue.

- +
) } diff --git a/src/components/modals/settings/sections/About.jsx b/src/components/modals/settings/sections/About.jsx index 7e5c40ad..40db0d49 100644 --- a/src/components/modals/settings/sections/About.jsx +++ b/src/components/modals/settings/sections/About.jsx @@ -19,10 +19,10 @@ export default class About extends React.PureComponent { const contributors = await (await fetch('https://api.github.com/repos/mue/mue/contributors')).json(); const versionData = await (await fetch('https://api.github.com/repos/mue/mue/releases')).json(); - let updateMsg = 'No update available'; + let updateMsg = this.props.language.version.no_update; let version = versionData[0].tag_name; if (version !== '5.0' && version !== '4.1') { - updateMsg = 'Update available: ' + version; + updateMsg = `${this.props.language.version.update_available}: ${version}`; } // TODO: REMOVE BOTS AND MAKE IT ACTUALLY WORK @@ -39,14 +39,14 @@ export default class About extends React.PureComponent { render() { return (
-

About

+

{this.props.language.title}

Mue logo -

Copyright 2018-{new Date().getFullYear()} Mue Tab (BSD-3 License)

-

Version {Constants.VERSION} ({this.state.update})

-

Resources Used

-

Pexels (Background Images)

-

Google (Pin Icon)

-

Contributors

+

{this.props.language.copyright} 2018-{new Date().getFullYear()} Mue Tab (BSD-3 License)

+

{this.props.language.version.title} {Constants.VERSION} ({this.state.update})

+

{this.props.language.resources_used.title}

+

Pexels ({this.props.language.resources_used.bg_images})

+

Google ({this.props.language.resources_used.pin_icon})

+

{this.props.language.contributors}

{this.state.contributors.map((item) => {item.login} @@ -58,7 +58,7 @@ export default class About extends React.PureComponent { {item.login} )} -

Supporters

+

{this.props.language.supporters}

to be implemented

); diff --git a/src/components/modals/settings/sections/Time.jsx b/src/components/modals/settings/sections/Time.jsx index 4a5a32a5..1d8e9eb6 100644 --- a/src/components/modals/settings/sections/Time.jsx +++ b/src/components/modals/settings/sections/Time.jsx @@ -27,22 +27,22 @@ export default class TimeSettings extends React.PureComponent { render() { let digitalSettings = ( -

Digital

- - - - +

{this.props.language.digital.title}

+ + + +
); let analogSettings = ( -

Analog

- - - - - +

{this.props.language.analogue.title}

+ + + + +
); @@ -57,9 +57,9 @@ export default class TimeSettings extends React.PureComponent {

{this.props.language.title}

this.changeType()}> - - - + + + {digitalSettings}

{this.props.language.date.title}

diff --git a/src/components/modals/tabs/Settings.jsx b/src/components/modals/tabs/Settings.jsx index 49b7cc94..4cffcc89 100644 --- a/src/components/modals/tabs/Settings.jsx +++ b/src/components/modals/tabs/Settings.jsx @@ -47,7 +47,7 @@ export default function Settings (props) {
- +
diff --git a/src/scss/modules/modals/_main.scss b/src/scss/modules/modals/_main.scss index cebe4e74..d5be3f3e 100644 --- a/src/scss/modules/modals/_main.scss +++ b/src/scss/modules/modals/_main.scss @@ -323,4 +323,4 @@ li { height: auto; border-radius: 50%; padding-right: 5px; -} \ No newline at end of file +} diff --git a/src/translations/en-GB.json b/src/translations/en-GB.json index 1fdffb13..688a4036 100644 --- a/src/translations/en-GB.json +++ b/src/translations/en-GB.json @@ -37,12 +37,22 @@ "sections": { "time": { "title": "Time", - "seconds": "Seconds", - "twentyfourhour": "24 Hour", - "ampm": "AM/PM (12 hour)", - "zero": "Zero-padded", - "analog": "Analog", - "percentageComplete": "Percentage of the Day Complete", + "digital": { + "title": "Digital", + "seconds": "Seconds", + "twentyfourhour": "24 Hour", + "ampm": "AM/PM (12 hour)", + "zero": "Zero-padded" + }, + "analogue": { + "title": "Analogue", + "second_hand": "Seconds Hand", + "minute_hand": "Minutes Hand", + "hour_hand": "Hours Hand", + "hour_marks": "Hour Marks", + "minute_marks": "Minute Marks" + }, + "percentage_complete": "Percentage of the Day Complete", "date": { "title": "Date", "short_date": "Short Date", @@ -94,21 +104,19 @@ "changelog": "Change Log", "about": { "title": "About", - "about": { - "copyright": "Copyright", - "version": { - "title": "Version", - "update_available": "Update available", - "no_update": "No update available" - }, - "resources_used": { - "title": "Resources Used", - "bg_images": "Background Images", - "pin_icon": "Pin Icon" - }, - "contributors": "Contributors", - "supporters": "Supporters" - } + "copyright": "Copyright", + "version": { + "title": "Version", + "update_available": "Update available", + "no_update": "No update available" + }, + "resources_used": { + "title": "Resources Used", + "bg_images": "Background Images", + "pin_icon": "Pin Icon" + }, + "contributors": "Contributors", + "supporters": "Supporters" } }, "buttons": { diff --git a/src/translations/en-US.json b/src/translations/en-US.json index a3eb0ec7..cba3f472 100644 --- a/src/translations/en-US.json +++ b/src/translations/en-US.json @@ -10,6 +10,11 @@ "custom_colour": "Custom Background Color", "add_colour": "Add color", "favourite": "Favorite" + }, + "time": { + "analogue": { + "title": "Analog" + } } } }