diff --git a/package.json b/package.json index 578cedca..8f69bf7a 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "homepage": "https://muetab.xyz", "bugs": "https://github.com/mue/mue/issues/new?assignees=&labels=bug&template=bug-report.md&title=%5BBUG%5D", "license": "BSD-3-Clause", - "version": "3.0", + "version": "3.0.0", "dependencies": { "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", diff --git a/src/App.jsx b/src/App.jsx index 7e36876f..8399948f 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -42,10 +42,14 @@ export default class App extends React.Component { localStorage.setItem('offlineMode', false); localStorage.setItem('webp', false); localStorage.setItem('events', true); + localStorage.setItem('customBackgroundColour', ''); + localStorage.setItem('customBackground', ''); + localStorage.setItem('greetingName', ''); // Set theme depending on user preferred - if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) localStorage.setItem('darkTheme', true); - else localStorage.setItem('darkTheme', false); + //if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) localStorage.setItem('darkTheme', true); + //else localStorage.setItem('darkTheme', false); + localStorage.setItem('darkTheme', false); // Finally we set this to true so it doesn't run the function on every load localStorage.setItem('firstRun', true); diff --git a/src/components/Settings.jsx b/src/components/Settings.jsx index 07243db1..c3bfffa4 100644 --- a/src/components/Settings.jsx +++ b/src/components/Settings.jsx @@ -1,3 +1,4 @@ +// eslint-disable import React from 'react'; import ExpandMore from '@material-ui/icons/ExpandMore'; @@ -25,31 +26,24 @@ export default class Settings extends React.Component { localStorage.setItem('blur', document.getElementById('blurRange').value); // this is better than inline onChange for performance localStorage.setItem('greetingName', document.getElementById('greetingName').value); localStorage.setItem('customBackground', document.getElementById('customBackground').value); - if (!document.getElementById('customBackgroundColour').enabled === 'false') localStorage.setItem('customBackgroundColour', document.getElementById('customBackgroundColour').value); + //if (!document.getElementById('customBackgroundColour').enabled === 'false') localStorage.setItem('customBackgroundColour', document.getElementById('customBackgroundColour').value); window.location.reload(); } resetItem(key) { switch (key) { - case 'greetingName': - localStorage.setItem('greetingName', ''); - document.getElementById('greetingName').value = ''; - break; + case 'greetingName': document.getElementById('greetingName').value = ''; break; case 'customBackgroundColour': localStorage.setItem('customBackgroundColour', ''); document.getElementById('customBackgroundColour').enabled = 'false'; break; - case 'customBackground': - localStorage.setItem('customBackground', ''); - document.getElementById('customBackground').value = ''; - break; + case 'customBackground': document.getElementById('customBackground').value = ''; break; case 'blur': localStorage.setItem('blur', 0); document.getElementById('blurRange').value = 0; document.getElementById('blurAmount').innerText = '0'; break; - default: - console.log('[ERROR] resetItem requires a key!'); + default: console.log('[ERROR] resetItem requires a key!'); } this.showToast(); } @@ -63,6 +57,12 @@ export default class Settings extends React.Component { componentDidMount() { document.getElementById('greetingName').value = localStorage.getItem('greetingName'); + document.getElementById('customBackground').value = localStorage.getItem('customBackground'); + /*const hex = localStorage.getItem('customBackgroundColour'); + if (!hex === '') { + document.getElementById('customBackgroundColour').value = hex; + document.getElementById('customBackgroundHex').innerText = hex; + }*/ for (const key of Object.keys(localStorage)) { let value = localStorage.getItem(key); @@ -106,11 +106,11 @@ export default class Settings extends React.Component {
Name for greeting this.resetItem('greetingName')}>Reset
+Name for greeting this.resetItem('greetingName')}>Reset
Adjust Blur (%) this.resetItem('blur')}>Reset
+Adjust Blur (%) this.resetItem('blur')}>Reset
Custom Background URL this.resetItem('customBackground')}>Reset
+Custom Background URL this.resetItem('customBackground')}>Reset
Custom Background Colour this.resetItem('customBackgroundColour')}>Reset
- -Custom Background Colour this.resetItem('customBackgroundColour')}>Reset
+ document.getElementById('customBackgroundHex').innerText = document.getElementById('customBackgroundColour').value}> + +