From f58d74146d4e810ee99ff896d1519282bfd79ccb Mon Sep 17 00:00:00 2001 From: David Ralph Date: Thu, 7 Apr 2022 21:49:43 +0100 Subject: [PATCH] fix: icon fixes, react 18 support --- babel.config.js | 2 +- package.json | 38 +++++++++---------- src/components/modals/Modals.jsx | 15 +++----- .../main/scss/marketplace/modules/_item.scss | 2 +- .../modals/main/scss/settings/_buttons.scss | 4 ++ .../scss/settings/modules/tabs/_about.scss | 4 ++ .../modals/main/settings/sections/About.jsx | 13 +++---- .../modals/welcome/WelcomeSections.jsx | 36 ++++++++---------- .../background/scss/_photoinformation.scss | 2 +- src/components/widgets/navbar/Notes.jsx | 4 +- src/components/widgets/search/search.scss | 2 +- .../widgets/weather/WeatherIcon.jsx | 2 +- .../widgets/weather/WindDirectionIcon.jsx | 2 +- src/index.js | 10 ++--- src/modules/constants.js | 5 ++- src/translations/de_DE.json | 4 +- src/translations/en_GB.json | 4 +- src/translations/en_US.json | 4 +- src/translations/es.json | 4 +- src/translations/fr.json | 4 +- src/translations/id_ID.json | 4 +- src/translations/nl.json | 4 +- src/translations/no.json | 4 +- src/translations/ru.json | 4 +- src/translations/zh_CN.json | 4 +- 25 files changed, 80 insertions(+), 101 deletions(-) diff --git a/babel.config.js b/babel.config.js index 9bcb792a..0f2c9a3f 100644 --- a/babel.config.js +++ b/babel.config.js @@ -2,5 +2,5 @@ module.exports = { presets: ['@babel/preset-env', ['@babel/preset-react', { runtime: 'automatic' }]], - plugins: ['@babel/plugin-proposal-class-properties', '@babel/transform-runtime', '@babel/plugin-transform-react-inline-elements', 'babel-plugin-transform-react-class-to-function', '@babel/plugin-transform-react-constant-elements'] + plugins: ['@babel/transform-runtime', '@babel/plugin-transform-react-inline-elements', '@babel/plugin-transform-react-constant-elements'] }; diff --git a/package.json b/package.json index 7f35cfeb..adf84388 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,10 @@ "@fontsource/lexend-deca": "4.4.5", "@fontsource/montserrat": "4.4.5", "@mui/material": "5.6.0", - "react": "17.0.2", + "react": "18.0.0", "react-clock": "3.1.0", "react-color-gradient-picker": "0.1.2", - "react-dom": "17.0.2", + "react-dom": "18.0.0", "react-hot-keys": "2.7.1", "react-icons": "^4.3.1", "react-modal": "3.14.4", @@ -29,28 +29,26 @@ }, "devDependencies": { "@babel/core": "^7.17.9", - "@babel/eslint-parser": "^7.16.3", - "@babel/plugin-proposal-class-properties": "^7.16.0", - "@babel/plugin-transform-react-constant-elements": "^7.16.0", - "@babel/plugin-transform-react-inline-elements": "^7.16.0", - "@babel/plugin-transform-runtime": "^7.16.0", - "@babel/preset-env": "^7.16.0", - "@babel/preset-react": "^7.16.0", + "@babel/eslint-parser": "^7.17.0", + "@babel/plugin-transform-react-constant-elements": "^7.17.6", + "@babel/plugin-transform-react-inline-elements": "^7.16.7", + "@babel/plugin-transform-runtime": "^7.17.0", + "@babel/preset-env": "^7.16.11", + "@babel/preset-react": "^7.16.7", "@eartharoid/deep-merge": "^0.0.2", - "babel-loader": "^8.2.3", - "babel-plugin-transform-react-class-to-function": "^1.2.2", + "babel-loader": "^8.2.4", "copy-webpack-plugin": "9.1.0", - "css-loader": "^6.5.1", - "eslint": "^8.2.0", + "css-loader": "^6.7.1", + "eslint": "^8.12.0", "eslint-config-react-app": "^7.0.0", "html-webpack-plugin": "^5.5.0", - "mini-css-extract-plugin": "^2.4.4", - "sass": "^1.43.4", - "sass-loader": "^12.3.0", - "source-map-loader": "^3.0.0", - "webpack": "^5.63.0", - "webpack-cli": "^4.9.1", - "webpack-dev-server": "^4.4.0" + "mini-css-extract-plugin": "^2.6.0", + "sass": "^1.50.0", + "sass-loader": "^12.6.0", + "source-map-loader": "^3.0.1", + "webpack": "^5.71.0", + "webpack-cli": "^4.9.2", + "webpack-dev-server": "^4.8.1" }, "scripts": { "start": "webpack serve", diff --git a/src/components/modals/Modals.jsx b/src/components/modals/Modals.jsx index 42fd466e..0fa347a2 100644 --- a/src/components/modals/Modals.jsx +++ b/src/components/modals/Modals.jsx @@ -1,5 +1,5 @@ import variables from 'modules/variables'; -import { PureComponent, Suspense, lazy } from 'react'; +import { PureComponent } from 'react'; import Modal from 'react-modal'; //import Hotkeys from 'react-hot-keys'; @@ -11,8 +11,7 @@ import EventBus from 'modules/helpers/eventbus'; // Welcome modal is lazy loaded as the user won't use it every time they open a tab // We used to lazy load the main and feedback modals, but doing so broke the modal open animation on first click -const Welcome = lazy(() => import('./welcome/Welcome')); -const renderLoader = () => <>; +import Welcome from './welcome/Welcome'; export default class Modals extends PureComponent { constructor() { @@ -27,7 +26,7 @@ export default class Modals extends PureComponent { } componentDidMount() { - if (localStorage.getItem('showWelcome') === 'true' && window.location.search !== '?nointro=true') { + if (localStorage.getItem('showWelcome') === 'true' && window.location.search !== '?nointro=true' && this.state.welcomeModal === false) { this.setState({ welcomeModal: true }); @@ -83,11 +82,9 @@ export default class Modals extends PureComponent { this.toggleModal('mainModal', false)} isOpen={this.state.mainModal} className='Modal mainModal' overlayClassName='Overlay' ariaHideApp={false}>
this.toggleModal('mainModal', false)}/> - - this.closeWelcome()} isOpen={this.state.welcomeModal} className='Modal welcomemodal mainModal' overlayClassName='Overlay welcomeoverlay' shouldCloseOnOverlayClick={false} ariaHideApp={false}> - this.closeWelcome()} modalSkip={() => this.previewWelcome()}/> - - + this.closeWelcome()} isOpen={this.state.welcomeModal} className='Modal welcomemodal mainModal' overlayClassName='Overlay welcomeoverlay' shouldCloseOnOverlayClick={false} ariaHideApp={false}> + this.closeWelcome()} modalSkip={() => this.previewWelcome()}/> + {this.state.preview ? window.location.reload()}/> : null} {/*variables.keybinds.toggleModal && variables.keybinds.toggleModal !== '' ? this.toggleModal('mainModal', (this.state.mainModal === true ? false : true))}/> : null*/} diff --git a/src/components/modals/main/scss/marketplace/modules/_item.scss b/src/components/modals/main/scss/marketplace/modules/_item.scss index 37810059..2f6937a5 100644 --- a/src/components/modals/main/scss/marketplace/modules/_item.scss +++ b/src/components/modals/main/scss/marketplace/modules/_item.scss @@ -24,7 +24,7 @@ } #item>h1, -#item>.MuiSvgIcon-root { +#item>svg { display: inline; } diff --git a/src/components/modals/main/scss/settings/_buttons.scss b/src/components/modals/main/scss/settings/_buttons.scss index 31f29631..ca4976e3 100644 --- a/src/components/modals/main/scss/settings/_buttons.scss +++ b/src/components/modals/main/scss/settings/_buttons.scss @@ -103,6 +103,10 @@ align-items: center; color: var(--modal-text); + svg { + font-size: 2em; + } + &:hover { background: var(--tab-active); cursor: pointer; diff --git a/src/components/modals/main/scss/settings/modules/tabs/_about.scss b/src/components/modals/main/scss/settings/modules/tabs/_about.scss index 3758b047..ba8c3892 100644 --- a/src/components/modals/main/scss/settings/modules/tabs/_about.scss +++ b/src/components/modals/main/scss/settings/modules/tabs/_about.scss @@ -5,6 +5,10 @@ &:hover { opacity: 0.8; } + + svg { + font-size: 1.5em; + } } .aboutLink { diff --git a/src/components/modals/main/settings/sections/About.jsx b/src/components/modals/main/settings/sections/About.jsx index 2c7bab6e..088097ba 100644 --- a/src/components/modals/main/settings/sections/About.jsx +++ b/src/components/modals/main/settings/sections/About.jsx @@ -2,6 +2,7 @@ import variables from 'modules/variables'; import { PureComponent } from 'react'; import { MdEmail } from 'react-icons/md'; import { FaDiscord, FaTwitter } from 'react-icons/fa'; +import { SiGithubsponsors, SiLiberapay, SiKofi, SiPatreon } from 'react-icons/si'; import Tooltip from 'components/helpers/tooltip/Tooltip'; @@ -99,19 +100,17 @@ export default class About extends PureComponent { -

{this.getMessage('modals.main.settings.sections.about.support_mue')}

-

- GitHub Sponsors -   •  Ko-Fi -   •  Patreon -

+

{this.getMessage('modals.main.settings.sections.about.support_mue')}

+ + + +

{this.getMessage('modals.main.settings.sections.about.resources_used.title')}

Pexels , Unsplash ({this.getMessage('modals.main.settings.sections.about.resources_used.bg_images')})

-

Undraw ({this.getMessage('modals.main.settings.sections.about.resources_used.welcome_img')})

{this.getMessage('modals.main.settings.sections.about.contributors')}

{this.state.loading}

diff --git a/src/components/modals/welcome/WelcomeSections.jsx b/src/components/modals/welcome/WelcomeSections.jsx index b0d3ca28..40aa4f9f 100644 --- a/src/components/modals/welcome/WelcomeSections.jsx +++ b/src/components/modals/welcome/WelcomeSections.jsx @@ -28,7 +28,7 @@ export default class WelcomeSections extends PureComponent { importedSettings: [] }; this.changeWelcomeImg = this.changeWelcomeImg.bind(this); - this.welcomeImages = ['./welcome-images/example1.webp', './welcome-images/example2.webp', './welcome-images/example3.webp', './welcome-images/example4.webp']; + this.welcomeImages = 4; } changeTheme(type) { @@ -50,7 +50,7 @@ export default class WelcomeSections extends PureComponent { importSettings(e) { importSettings(e); - let settings = []; + const settings = []; const data = JSON.parse(e.target.result); Object.keys(data).forEach((setting) => { // language and theme already shown, the others are only used internally @@ -82,14 +82,14 @@ export default class WelcomeSections extends PureComponent { let welcomeImage = this.state.welcomeImage; this.setState({ - welcomeImage: ++welcomeImage % this.welcomeImages.length + welcomeImage: ++welcomeImage % this.welcomeImages }); - this.timeout = setTimeout(this.changeWelcomeImg, 3 * 1000); + this.timeout = setTimeout(this.changeWelcomeImg, 3000); } componentDidMount() { - this.timeout = setTimeout(this.changeWelcomeImg, 3 * 1000); + this.timeout = setTimeout(this.changeWelcomeImg, 3000); } componentWillUnmount() { @@ -106,23 +106,19 @@ export default class WelcomeSections extends PureComponent { clearTimeout(this.timeout); this.timeout = null; } - } else { - if (!this.timeout) { - this.timeout = setTimeout(this.changeWelcomeImg, 3 * 1000); - } + } else if (!this.timeout) { + this.timeout = setTimeout(this.changeWelcomeImg, 3000); } } - render() { - let tabContent; - + render() { const intro = ( <>

{this.getMessage('modals.welcome.sections.intro.title')}

{this.getMessage('modals.welcome.sections.intro.description')}

#shareyourmue

- Example Mue setup + Example Mue setup
); @@ -206,15 +202,13 @@ export default class WelcomeSections extends PureComponent { ); switch (this.props.currentTab) { - case 1: tabContent = chooseLanguage; break; - case 2: tabContent = settings; break; - case 3: tabContent = theme; break; - case 4: tabContent = privacy; break; - case 5: tabContent = final; break; + case 1: return chooseLanguage; + case 2: return settings; + case 3: return theme; + case 4: return privacy; + case 5: return final; // 0 - default: tabContent = intro; + default: return intro; } - - return tabContent; } } diff --git a/src/components/widgets/background/scss/_photoinformation.scss b/src/components/widgets/background/scss/_photoinformation.scss index 4e5003aa..53ebe583 100644 --- a/src/components/widgets/background/scss/_photoinformation.scss +++ b/src/components/widgets/background/scss/_photoinformation.scss @@ -78,7 +78,7 @@ } h1, - .MuiSvgIcon-root { + svg { user-select: none; cursor: initial; } diff --git a/src/components/widgets/navbar/Notes.jsx b/src/components/widgets/navbar/Notes.jsx index 35f193e6..95b50921 100644 --- a/src/components/widgets/navbar/Notes.jsx +++ b/src/components/widgets/navbar/Notes.jsx @@ -1,6 +1,6 @@ import variables from 'modules/variables'; import { PureComponent } from 'react'; -import { MdContentCopy, MdAssignment, MdPushPin } from 'react-icons/md'; +import { MdFileCopy, MdAssignment, MdPushPin } from 'react-icons/md'; import TextareaAutosize from '@mui/material/TextareaAutosize'; import { toast } from 'react-toastify'; //import Hotkeys from 'react-hot-keys'; @@ -53,7 +53,7 @@ export default class Notes extends PureComponent { - + {/*variables.keybinds.pinNotes && variables.keybinds.pinNotes !== '' ? this.pin()}/> : null*/} {/*variables.keybinds.copyNotes && variables.keybinds.copyNotes !== '' ? this.copy()}/> : null*/} diff --git a/src/components/widgets/search/search.scss b/src/components/widgets/search/search.scss index 17c75774..4d081cb5 100644 --- a/src/components/widgets/search/search.scss +++ b/src/components/widgets/search/search.scss @@ -35,7 +35,7 @@ } } - .MuiSvgIcon-root { + svg { position: absolute; margin-top: 6px; font-size: 30px; diff --git a/src/components/widgets/weather/WeatherIcon.jsx b/src/components/widgets/weather/WeatherIcon.jsx index 8aa6eea2..5df3db5c 100644 --- a/src/components/widgets/weather/WeatherIcon.jsx +++ b/src/components/widgets/weather/WeatherIcon.jsx @@ -10,7 +10,7 @@ import { WiRain, WiThunderstorm, WiSnow, - WiFog, + WiFog } from 'react-icons/wi'; export default function WeatherIcon({ name }) { diff --git a/src/components/widgets/weather/WindDirectionIcon.jsx b/src/components/widgets/weather/WindDirectionIcon.jsx index 99653cee..2df8a9e8 100644 --- a/src/components/widgets/weather/WindDirectionIcon.jsx +++ b/src/components/widgets/weather/WindDirectionIcon.jsx @@ -6,7 +6,7 @@ import { WiDirectionRight, WiDirectionUpLeft, WiDirectionUpRight, - WiDirectionUp, + WiDirectionUp } from 'react-icons/wi'; // degrees is imported because of a potential bug, idk what causes it but now it is fixed diff --git a/src/index.js b/src/index.js index 5833f594..8f1f67dc 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ -import { render } from 'react-dom'; +import { createRoot } from 'react-dom/client'; import App from './App'; import variables from 'modules/variables'; @@ -47,7 +47,7 @@ if (localStorage.getItem('stats') === 'true') { variables.keybinds = JSON.parse(localStorage.getItem('keybinds') || '{}'); }*/ -render( - , - document.getElementById('root') -); +const container = document.getElementById('root'); +const root = createRoot(container); + +root.render(); diff --git a/src/modules/constants.js b/src/modules/constants.js index ffb46e78..566eec74 100644 --- a/src/modules/constants.js +++ b/src/modules/constants.js @@ -23,7 +23,10 @@ export const DISCORD_SERVER = 'zv8C9F8'; export const COPYRIGHT_NAME = 'The Mue Authors'; export const COPYRIGHT_YEAR = '2018'; export const COPYRIGHT_LICENSE = 'BSD-3-Clause License'; -export const DONATE_USERNAME = 'davidcralph'; // this only works if you use the same username for Patreon, GitHub and Ko-Fi +export const SPONSORS_USERNAME = 'davidcralph'; +export const LIBERAPAY_USERNAME = 'mue'; +export const KOFI_USERNAME = 'davidcralph'; +export const PATREON_USERNAME = 'davidcralph'; export const OFFLINE_IMAGES = 20; diff --git a/src/translations/de_DE.json b/src/translations/de_DE.json index 2cd221af..c4f837ca 100644 --- a/src/translations/de_DE.json +++ b/src/translations/de_DE.json @@ -377,9 +377,7 @@ "support_mue": "Mue unterstützen", "resources_used": { "title": "Verwendete Ressourcen", - "bg_images": "Offline Hintergrundbilder", - "welcome_img": "Willkommensbild", - "pin_icon": "Icon Anheften" + "bg_images": "Offline Hintergrundbilder" }, "contributors": "Mitwirkende", "supporters": "Unterstützer", diff --git a/src/translations/en_GB.json b/src/translations/en_GB.json index ff14bd9e..86d51601 100644 --- a/src/translations/en_GB.json +++ b/src/translations/en_GB.json @@ -376,9 +376,7 @@ "support_mue": "Support Mue", "resources_used": { "title": "Resources used", - "bg_images": "Offline background images", - "welcome_img": "Welcome image", - "pin_icon": "Pin icon" + "bg_images": "Offline background images" }, "contributors": "Contributors", "supporters": "Supporters", diff --git a/src/translations/en_US.json b/src/translations/en_US.json index b9ee983b..7a136303 100644 --- a/src/translations/en_US.json +++ b/src/translations/en_US.json @@ -376,9 +376,7 @@ "support_mue": "Support Mue", "resources_used": { "title": "Resources used", - "bg_images": "Offline background images", - "welcome_img": "Welcome image", - "pin_icon": "Pin icon" + "bg_images": "Offline background images" }, "contributors": "Contributors", "supporters": "Supporters", diff --git a/src/translations/es.json b/src/translations/es.json index 81c495d1..70942b77 100644 --- a/src/translations/es.json +++ b/src/translations/es.json @@ -376,9 +376,7 @@ "support_mue": "Apoya Mue", "resources_used": { "title": "Recursos usados", - "bg_images": "Imágenes de fondo sin conexión", - "welcome_img": "Imagen de bienvenida", - "pin_icon": "Icono de chincheta" + "bg_images": "Imágenes de fondo sin conexión" }, "contributors": "Contribuyentes", "supporters": "Partidarios", diff --git a/src/translations/fr.json b/src/translations/fr.json index 1e410d6d..332c0cc8 100644 --- a/src/translations/fr.json +++ b/src/translations/fr.json @@ -376,9 +376,7 @@ "support_mue": "Soutenir Mue", "resources_used": { "title": "Ressources utilisées", - "bg_images": "Images d'arrière-plan hors ligne", - "welcome_img": "Image de bienvenue", - "pin_icon": "Icône de broche" + "bg_images": "Images d'arrière-plan hors ligne" }, "contributors": "Collaborateurs", "supporters": "Partisans", diff --git a/src/translations/id_ID.json b/src/translations/id_ID.json index dd929120..40b05616 100644 --- a/src/translations/id_ID.json +++ b/src/translations/id_ID.json @@ -376,9 +376,7 @@ "support_mue": "Dukung Mue", "resources_used": { "title": "Resources yang kami gunakan", - "bg_images": "Offline background images", - "welcome_img": "Welcome image", - "pin_icon": "Ikon pin" + "bg_images": "Offline background images" }, "contributors": "Kontributor", "supporters": "Suporter", diff --git a/src/translations/nl.json b/src/translations/nl.json index 43b09cc5..fb94565a 100644 --- a/src/translations/nl.json +++ b/src/translations/nl.json @@ -376,9 +376,7 @@ "support_mue": "Support Mue", "resources_used": { "title": "Resources used", - "bg_images": "Offline background images", - "welcome_img": "Welcome image", - "pin_icon": "Pin icon" + "bg_images": "Offline background images" }, "contributors": "Contributors", "supporters": "Supporters", diff --git a/src/translations/no.json b/src/translations/no.json index d6521191..fa6c01eb 100644 --- a/src/translations/no.json +++ b/src/translations/no.json @@ -376,9 +376,7 @@ "support_mue": "Support Mue", "resources_used": { "title": "Resources used", - "bg_images": "Offline background images", - "welcome_img": "Welcome image", - "pin_icon": "Pin icon" + "bg_images": "Offline background images" }, "contributors": "Contributors", "supporters": "Supporters", diff --git a/src/translations/ru.json b/src/translations/ru.json index bc63548a..b66044ee 100644 --- a/src/translations/ru.json +++ b/src/translations/ru.json @@ -376,9 +376,7 @@ "support_mue": "Support Mue", "resources_used": { "title": "Resources used", - "bg_images": "Offline background images", - "welcome_img": "Welcome image", - "pin_icon": "Pin icon" + "bg_images": "Offline background images" }, "contributors": "Contributors", "supporters": "Supporters", diff --git a/src/translations/zh_CN.json b/src/translations/zh_CN.json index 868edadc..536ac011 100644 --- a/src/translations/zh_CN.json +++ b/src/translations/zh_CN.json @@ -376,9 +376,7 @@ "support_mue": "支持 Mue", "resources_used": { "title": "使用资源", - "bg_images": "离线背景", - "welcome_img": "欢迎图像", - "pin_icon": "便签图标" + "bg_images": "离线背景" }, "contributors": "贡献者", "supporters": "支持者",