diff --git a/package.json b/package.json index df27b166..aeb6c8c9 100644 --- a/package.json +++ b/package.json @@ -19,27 +19,27 @@ "react": "17.0.1", "react-clock": "^3.0.0", "react-color-gradient-picker": "^0.1.2", - "react-date-picker": "^8.0.7", + "react-date-picker": "^8.1.0", "react-dom": "17.0.1", "react-modal": "3.12.1", "react-toastify": "7.0.3" }, "devDependencies": { - "@babel/core": "^7.12.10", - "@babel/plugin-proposal-class-properties": "^7.12.1", - "@babel/plugin-transform-runtime": "^7.12.10", - "@babel/preset-env": "^7.12.11", - "@babel/preset-react": "^7.12.10", + "@babel/core": "^7.13.10", + "@babel/plugin-proposal-class-properties": "^7.13.0", + "@babel/plugin-transform-runtime": "^7.13.10", + "@babel/preset-env": "^7.13.10", + "@babel/preset-react": "^7.12.13", "babel-loader": "^8.2.2", - "copy-webpack-plugin": "^7.0.0", - "css-loader": "^5.0.1", + "copy-webpack-plugin": "^8.0.0", + "css-loader": "^5.1.3", "file-loader": "^6.2.0", - "html-webpack-plugin": "^5.0.0-beta.5", - "mini-css-extract-plugin": "^1.3.4", - "sass": "^1.32.4", - "sass-loader": "^10.1.1", - "webpack": "^5.15.0", - "webpack-cli": "^4.3.1", + "html-webpack-plugin": "^5.3.1", + "mini-css-extract-plugin": "^1.3.9", + "sass": "^1.32.8", + "sass-loader": "^11.0.1", + "webpack": "^5.27.0", + "webpack-cli": "^4.5.0", "webpack-dev-server": "^3.11.2" }, "scripts": { diff --git a/src/components/modals/main/scss/index.scss b/src/components/modals/main/scss/index.scss index 585b7467..950d047e 100644 --- a/src/components/modals/main/scss/index.scss +++ b/src/components/modals/main/scss/index.scss @@ -50,25 +50,6 @@ } } -.dark { - background-color: #2f3542 !important; - color: white !important; - - .sidebar { - background-color: #2a303b !important; - } - - .tab-list-active { - background: rgba(161, 159, 159, 0.8); - } - - .tab-list-item { - &:hover { - background: rgba(161, 159, 159, 0.8); - } - } -} - .ReactModal__Html--open, .ReactModal__Body--open { overflow: hidden; diff --git a/src/components/modals/main/scss/settings/_main.scss b/src/components/modals/main/scss/settings/_main.scss index dad31e99..1184dc85 100644 --- a/src/components/modals/main/scss/settings/_main.scss +++ b/src/components/modals/main/scss/settings/_main.scss @@ -5,11 +5,11 @@ input { &[type=text] { width: 200px; - padding: 0.5rem 1rem; - box-sizing: border-box; - border-image-slice: 1; - border-image-source: map-get($theme-colours, 'gradient'); - background: transparent; + color: black; + background: #f0f0f0; + border: none; + padding: 10px 10px; + border-radius: 5px; } &:checked+.slider { @@ -47,7 +47,7 @@ h4 { } ul { - padding-left: 5px; + padding-left: 0px; margin: 0; >label { @@ -196,3 +196,8 @@ input[type=color]::-moz-color-swatch { font-size: 1em; } } + +.radio-title { + text-transform: uppercase; + font-weight: bold; +} \ No newline at end of file diff --git a/src/components/modals/main/settings/Checkbox.jsx b/src/components/modals/main/settings/Checkbox.jsx index aaed5f51..56e80f22 100644 --- a/src/components/modals/main/settings/Checkbox.jsx +++ b/src/components/modals/main/settings/Checkbox.jsx @@ -13,8 +13,8 @@ export default class Checkbox extends React.PureComponent { }; } - handleChange(name) { - SettingsFunctions.setItem(name); + handleChange() { + SettingsFunctions.setItem(this.props.name); this.setState({ checked: (this.state.checked === true) ? false : true @@ -33,7 +33,7 @@ export default class Checkbox extends React.PureComponent { return ( this.handleChange(this.props.name)} />} + control={ this.handleChange()} />} label={text} />
diff --git a/src/components/modals/main/settings/Radio.jsx b/src/components/modals/main/settings/Radio.jsx new file mode 100644 index 00000000..34991758 --- /dev/null +++ b/src/components/modals/main/settings/Radio.jsx @@ -0,0 +1,37 @@ +import React from 'react'; + +import RadioUI from '@material-ui/core/Radio'; +import RadioGroup from '@material-ui/core/RadioGroup'; +import FormControlLabel from '@material-ui/core/FormControlLabel'; +import FormControl from '@material-ui/core/FormControl'; +import FormLabel from '@material-ui/core/FormLabel'; + +export default class Radio extends React.PureComponent { + constructor(...args) { + super(...args); + this.state = { + value: localStorage.getItem(this.props.name) + }; + } + + handleChange(value) { + localStorage.setItem(this.props.name, value); + + this.setState({ + value: value + }); + } + + render() { + return ( + + {this.props.title} + this.handleChange(e.target.value)} value={this.state.value}> + {this.props.options.map(option => + } label={option.name} /> + )} + + + ); + } +} diff --git a/src/components/modals/main/settings/sections/About.jsx b/src/components/modals/main/settings/sections/About.jsx index b3350db8..e51329fe 100644 --- a/src/components/modals/main/settings/sections/About.jsx +++ b/src/components/modals/main/settings/sections/About.jsx @@ -3,7 +3,6 @@ import React from 'react'; import Tooltip from '@material-ui/core/Tooltip'; const other_contributors = require('../../../../../modules/other_contributors.json'); -const { version } = require('../../../../../../package.json'); export default class About extends React.PureComponent { constructor(...args) { @@ -25,7 +24,7 @@ export default class About extends React.PureComponent { const newVersion = versionData[0].tag_name; let updateMsg = this.language.version.no_update; - if (version < newVersion) { + if (window.constants.VERSION < newVersion) { updateMsg = `${this.language.version.update_available}: ${newVersion}`; } @@ -54,7 +53,7 @@ export default class About extends React.PureComponent {

{this.language.title}

Mue logo

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

-

{this.language.version.title} {version} ({this.state.update})

+

{this.language.version.title} {window.constants.VERSION} ({this.state.update})

{this.language.resources_used.title}

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

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

diff --git a/src/components/modals/main/settings/sections/Appearance.jsx b/src/components/modals/main/settings/sections/Appearance.jsx index bd7a5760..1f207e5e 100644 --- a/src/components/modals/main/settings/sections/Appearance.jsx +++ b/src/components/modals/main/settings/sections/Appearance.jsx @@ -2,6 +2,7 @@ import React from 'react'; import Checkbox from '../Checkbox'; import Dropdown from '../Dropdown'; +import Radio from '../Radio'; import { toast } from 'react-toastify'; @@ -55,11 +56,24 @@ export default class AppearanceSettings extends React.PureComponent { render() { const { appearance } = this.language.sections; + let themeOptions = [ + { + 'name': 'Auto', + 'value': 'auto' + }, + { + 'name': 'Light', + 'value': 'light' + }, { + 'name': 'Dark', + 'value': 'dark' + } + ] + return (

{appearance.title}

- - +

{appearance.navbar.title}

@@ -70,7 +84,7 @@ export default class AppearanceSettings extends React.PureComponent {

{appearance.font.custom} this.resetItem('font')}>{this.language.buttons.reset}

this.setState({ font: e.target.value })}> -
+

{language.title}

- localStorage.setItem('language', document.getElementById('language').value)}> - {languages.map(language => - - )} - +
localStorage.setItem('quotelanguage', document.getElementById('quotelanguage').value)}> diff --git a/src/components/widgets/background/Background.jsx b/src/components/widgets/background/Background.jsx index f26a3530..78780bb0 100644 --- a/src/components/widgets/background/Background.jsx +++ b/src/components/widgets/background/Background.jsx @@ -100,10 +100,10 @@ export default class Background extends React.PureComponent { if (customBackgroundColour !== 'Disabled' && customBackgroundColour !== '') { let gradientSettings = ''; try { - gradientSettings = JSON.parse(colour); + gradientSettings = JSON.parse(customBackgroundColour); } catch (e) { const hexColorRegex = /#[0-9a-fA-F]{6}/s; - if (hexColorRegex.exec(colour)) { + if (hexColorRegex.exec(customBackgroundColour)) { // Colour use to be simply a hex colour or a NULL value before it was a JSON object. This automatically upgrades the hex colour value to the new standard. (NULL would not trigger an exception) gradientSettings = { "type": "linear", "angle": "180", "gradient": [{ "colour": colour, "stop": 0 }] }; localStorage.setItem('customBackgroundColour', JSON.stringify(gradientSettings)); diff --git a/src/components/widgets/quote/Quote.jsx b/src/components/widgets/quote/Quote.jsx index cd0dda92..0423c7aa 100644 --- a/src/components/widgets/quote/Quote.jsx +++ b/src/components/widgets/quote/Quote.jsx @@ -57,6 +57,10 @@ export default class Quote extends React.PureComponent { } async getQuote() { + if (localStorage.getItem('offlineMode') === 'true') { + return this.doOffline(); + } + const quotePackAPI = JSON.parse(localStorage.getItem('quoteAPI')); if (quotePackAPI) { try { @@ -86,10 +90,6 @@ export default class Quote extends React.PureComponent { }); } - if (localStorage.getItem('offlineMode') === 'true') { - return this.doOffline(); - } - // First we try and get a quote from the API... try { const data = await (await fetch(window.constants.API_URL + '/getQuote?language=' + localStorage.getItem('quotelanguage'))).json(); diff --git a/src/modules/constants.js b/src/modules/constants.js index dbfc7784..6fdcbed8 100644 --- a/src/modules/constants.js +++ b/src/modules/constants.js @@ -5,3 +5,4 @@ export const WEBSITE_URL = 'https://muetab.com'; export const SPONSORS_URL = 'https://sponsors.muetab.com'; export const OFFLINE_IMAGES = 20; export const BETA_VERSION = false; +export const VERSION = 5.0; diff --git a/src/modules/languages.json b/src/modules/languages.json index 10ab0f1d..7a0523d2 100644 --- a/src/modules/languages.json +++ b/src/modules/languages.json @@ -1,30 +1,30 @@ [ { - "text": "English (UK)", - "code": "en-GB" + "name": "English (UK)", + "value": "en-GB" }, { - "text": "English (US)", - "code": "en-US" + "name": "English (US)", + "value": "en-US" }, { - "text": "Español", - "code": "es" + "name": "Español", + "value": "es" }, { - "text": "Français", - "code": "fr" + "name": "Français", + "value": "fr" }, { - "text": "Nederlands", - "code": "nl" + "name": "Nederlands", + "value": "nl" }, { - "text": "Norsk", - "code": "no" + "name": "Norsk", + "value": "no" }, { - "text": "Pусский", - "code": "ru" + "name": "Pусский", + "value": "ru" } ] diff --git a/src/scss/_variables.scss b/src/scss/_variables.scss index b7a01bc7..aa72d24f 100644 --- a/src/scss/_variables.scss +++ b/src/scss/_variables.scss @@ -9,6 +9,7 @@ $theme-colours: ( $modal: ( 'background': #fff, + 'background-dark': #2f3542, 'text': rgba(0, 0, 0, 1), 'tab-underline': rgba(204, 204, 204, 1), 'tab-underline-active': rgba(0, 0, 0, 1), diff --git a/src/scss/index.scss b/src/scss/index.scss index 95ab314f..cb176a3f 100644 --- a/src/scss/index.scss +++ b/src/scss/index.scss @@ -5,6 +5,18 @@ @import 'modules/marketplace'; @import 'modules/buttons'; +:root { + --main-text: map-get($theme-colours, 'main'); + --modal-text: map-get($modal, 'text'); + --background: map-get($modal, 'background'); +} + +.dark { + --main-text: map-get($theme-colours, 'secondary'); + --modal-text: map-get($theme-colours, 'main'); + --background: map-get($modal, 'background-dark'); +} + body { background: #2f3640; margin: 0;