From cdddffbe79692d24032b711d0306443641687b8f Mon Sep 17 00:00:00 2001
From: David Ralph
Date: Fri, 2 Oct 2020 21:31:58 +0100
Subject: [PATCH] update modal fixes
---
src/components/modals/Settings.jsx | 4 ++--
src/components/modals/Update.jsx | 21 +++++++++++++--------
src/translations/en.json | 6 ++++--
3 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/src/components/modals/Settings.jsx b/src/components/modals/Settings.jsx
index e5cbdee6..f5656217 100644
--- a/src/components/modals/Settings.jsx
+++ b/src/components/modals/Settings.jsx
@@ -90,11 +90,11 @@ export default class Settings extends React.PureComponent {
-
{this.props.language.offline}
+ {this.props.language.offline}
-
{this.props.language.experimental.dark}
+ {this.props.language.experimental.dark}
diff --git a/src/components/modals/Update.jsx b/src/components/modals/Update.jsx
index f0db00e3..e423c504 100644
--- a/src/components/modals/Update.jsx
+++ b/src/components/modals/Update.jsx
@@ -8,31 +8,36 @@ export default class Update extends React.PureComponent {
title: this.props.language.title,
date: '???',
content: this.props.language.title,
- url: '',
- author: 'Mue'
+ author: 'Mue',
+ html: this.props.language.loading
};
}
async getUpdate() {
+ let supportText = `
${this.props.language.contactsupport}: https://muetab.xyz/contact
`;
+
if (localStorage.getItem('offlineMode') === 'true') return this.setState({
title: this.props.language.offline.title,
- content: this.props.language.offline.description
+ html: this.props.language.offline.description
});
try { // Get update log from the API
const data = await (await fetch(Constants.API_URL + '/getUpdate')).json();
+ if (data.statusCode === 500) return this.setState({
+ title: this.props.language.error.title,
+ html: this.props.language.error.description + supportText
+ });
this.setState({
title: data.title,
- content: data.content,
date: data.published,
image: data.image,
- url: data.url,
- author: data.author
+ author: data.author,
+ html: data.content + `
${this.props.language.readblog}: ${data.url}
`
});
} catch (e) { // If it fails, we send an error
this.setState({
title: this.props.language.error.title,
- content: this.props.language.error.description
+ html: this.props.language.error.description + supportText
});
}
}
@@ -47,7 +52,7 @@ export default class Update extends React.PureComponent {
{this.state.title}
By {this.state.author} • {this.state.date}
- Read on the blog here: ${this.state.url}
`}}>
+
;
}
}
\ No newline at end of file
diff --git a/src/translations/en.json b/src/translations/en.json
index 70c71fc2..dde4bd31 100644
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -75,9 +75,11 @@
},
"error": {
"title": "Error",
- "content": "Could not connect to the server"
+ "description": "Could not connect to the server"
},
- "loading": "Loading..."
+ "loading": "Loading...",
+ "readblog": "Read on the blog here",
+ "contactsupport": "Contact us here"
},
"toasts": {
"quote": "Quote Copied",