diff --git a/src/components/modals/tabs/Marketplace.jsx b/src/components/modals/tabs/Marketplace.jsx
index c0997f64..738de35f 100644
--- a/src/components/modals/tabs/Marketplace.jsx
+++ b/src/components/modals/tabs/Marketplace.jsx
@@ -104,42 +104,11 @@ export default class Marketplace extends React.PureComponent {
}
install() {
- let installed = JSON.parse(localStorage.getItem('installed'));
let button;
-
- const installStuff = () => {
- installed.push(this.state.current_data);
- localStorage.setItem('installed', JSON.stringify(installed));
- toast(this.props.toastLanguage.installed);
- button =
;
- this.setState({ button: button });
- }
-
- switch (this.state.current_data.type) {
- case 'settings':
- localStorage.removeItem('backup_settings');
- let oldSettings = [];
- for (const key of Object.keys(localStorage)) oldSettings.push({name: key, value: localStorage.getItem(key)});
- localStorage.setItem('backup_settings', JSON.stringify(oldSettings));
- this.state.current_data.content.data.settings.forEach(element => localStorage.setItem(element.name, element.value));
- installStuff();
- break;
- case 'photo_packs':
- localStorage.setItem('photo_packs', JSON.stringify(this.state.current_data.content.data.photos));
- installStuff();
- break;
- case 'theme':
- localStorage.setItem('theme', this.state.current_data.content.data.theme);
- installStuff();
- break;
- case 'quote_packs':
- if (this.state.current_data.content.data.quote_api) localStorage.setItem('quote_api', JSON.stringify(this.state.current_data.content.data.quote_api));
- localStorage.setItem('quote_packs', JSON.stringify(this.state.current_data.content.data.quotes));
- installStuff();
- break;
- default:
- break;
- }
+ MarketplaceFunctions.install(this.state.current_data.type, this.state.current_data.content.data);
+ toast(this.props.toastLanguage.installed);
+ button =
;
+ this.setState({ button: button });
}
uninstall() {
@@ -160,15 +129,15 @@ export default class Marketplace extends React.PureComponent {
if (this.state.done === false) {
return (
-
+
{this.props.updateLanguage.loading}
+
-
- )
+ );
}
return (
-
+
{this.state.featured.title}
@@ -193,12 +162,6 @@ export default class Marketplace extends React.PureComponent {
items={this.state.quote_packs.slice(0, 3)}
toggleFunction={(input) => this.toggle('item', 'quote_packs', input)}
seeMoreFunction={() => this.toggle('seemore', 'quote_packs')} />
- {/*
this.toggle('item', 'theme', input)}
- seeMoreFunction={() => this.toggle('seemore', 'themes')} /> */ }
-
+
)
}
}
\ No newline at end of file
diff --git a/src/components/modals/tabs/Settings.jsx b/src/components/modals/tabs/Settings.jsx
index c2674c54..0bd1de47 100644
--- a/src/components/modals/tabs/Settings.jsx
+++ b/src/components/modals/tabs/Settings.jsx
@@ -7,7 +7,6 @@ import { toast } from 'react-toastify';
import BackgroundSettings from '../settings/sections/BackgroundSettings';
import SearchSettings from '../settings/sections/SearchSettings';
import LanguageSettings from '../settings/sections/LanguageSettings';
-import DateSettings from '../settings/sections/DateSettings';
export default class Settings extends React.PureComponent {
resetGreeting() {
diff --git a/src/components/widgets/Date.jsx b/src/components/widgets/Date.jsx
index d8bc130c..879a3e1f 100644
--- a/src/components/widgets/Date.jsx
+++ b/src/components/widgets/Date.jsx
@@ -28,7 +28,7 @@ export default class DateWidget extends React.PureComponent {
day = dateYear;
year = dateDay;
break;
- default:
+ default: // DMY
break;
}
@@ -49,7 +49,7 @@ export default class DateWidget extends React.PureComponent {
const lang = localStorage.getItem('language');
const day = date.toLocaleDateString(lang, { weekday: 'long' });
- const nth = dtf.nth(date.getDate());
+ const nth = (localStorage.getItem('datenth') === 'true') ? dtf.nth(date.getDate()) : date.getDate();
const month = date.toLocaleDateString(lang, { month: 'long' });
const year = date.getFullYear();
diff --git a/src/modules/helpers/marketplace.js b/src/modules/helpers/marketplace.js
index 5e7ca23b..aa4a6e64 100644
--- a/src/modules/helpers/marketplace.js
+++ b/src/modules/helpers/marketplace.js
@@ -41,4 +41,39 @@ export default class MarketplaceFunctions {
}
}
}
+
+ static install(type, input, sideload) {
+ switch (type) {
+ case 'settings':
+ localStorage.removeItem('backup_settings');
+ let oldSettings = [];
+ for (const key of Object.keys(localStorage)) oldSettings.push({ name: key, value: localStorage.getItem(key) });
+ localStorage.setItem('backup_settings', JSON.stringify(oldSettings));
+ input.settings.forEach(element => localStorage.setItem(element.name, element.value));
+ break;
+ case 'photo_packs':
+ localStorage.setItem('photo_packs', JSON.stringify(input.photos));
+ break;
+ case 'theme':
+ localStorage.setItem('theme', input.theme);
+ break;
+ case 'quote_packs':
+ if (input.quote_api) localStorage.setItem('quote_api', JSON.stringify(input.quote_api));
+ localStorage.setItem('quote_packs', JSON.stringify(input.quotes));
+ break;
+ default:
+ break;
+ }
+
+ let installed = JSON.parse(localStorage.getItem('installed'));
+ if (sideload) {
+ installed.push({
+ content: {
+ updated: 'Unpublished',
+ data: input
+ }
+ });
+ } else installed.push(input);
+ localStorage.setItem('installed', JSON.stringify(installed));
+ }
}
\ No newline at end of file