diff --git a/scripts/updatetranslations.js b/scripts/updatetranslations.js index e0e54624..8127bcea 100644 --- a/scripts/updatetranslations.js +++ b/scripts/updatetranslations.js @@ -38,31 +38,30 @@ fs.readdirSync('../src/i18n/locales').forEach((file) => { fs.appendFileSync('../src/i18n/locales/' + file, '\n'); }); - // do the same with achievements -fs.readdirSync('../src/i18n/achievements').forEach((file) => { +fs.readdirSync('../src/i18n/locales/achievements').forEach((file) => { if (file === 'en_GB.json') { return; } - const en = require('../src/i18n/achievements/en_GB.json'); - const newdata = merge(en, require('../src/i18n/achievements/' + file)); + const en = require('../src/i18n/locales/achievements/en_GB.json'); + const newdata = merge(en, require('../src/i18n/locales/achievements/' + file)); // remove strings not in english file compareAndRemoveKeys(newdata, en); // write new file - fs.writeFileSync('../src/i18n/achievements/' + file, JSON.stringify(newdata, null, 2)); + fs.writeFileSync('../src/i18n/locales/achievements/' + file, JSON.stringify(newdata, null, 2)); // add new line - fs.appendFileSync('../src/i18n/achievements/' + file, '\n'); + fs.appendFileSync('../src/i18n/locales/achievements/' + file, '\n'); // if missing translations from locales/ add them to achievements/ const locales = fs.readdirSync('../src/i18n/locales'); locales.forEach((locale) => { - if (!fs.existsSync('../src/i18n/achievements/' + locale)) { - fs.writeFileSync('../src/i18n/achievements/' + locale, JSON.stringify(en, null, 2)); - fs.appendFileSync('../src/i18n/achievements/' + locale, '\n'); + if (!fs.existsSync('../src/i18n/locales/achievements/' + locale)) { + fs.writeFileSync('../src/i18n/locales/achievements/' + locale, JSON.stringify(en, null, 2)); + fs.appendFileSync('../src/i18n/locales/achievements/' + locale, '\n'); } }); -}); \ No newline at end of file +}); diff --git a/src/features/modals/welcome/Sections/Intro.jsx b/src/features/modals/welcome/Sections/Intro.jsx index e0b8a520..88abdcb2 100644 --- a/src/features/modals/welcome/Sections/Intro.jsx +++ b/src/features/modals/welcome/Sections/Intro.jsx @@ -1,80 +1,89 @@ import variables from 'config/variables'; -import { useState, useEffect } from 'react'; +import { useState, useEffect, useCallback } from 'react'; import { Header, Content } from '../components/Layout'; import { MdOutlineWavingHand, MdOpenInNew } from 'react-icons/md'; import { FaDiscord, FaGithub } from 'react-icons/fa'; +const DISCORD_LINK = 'https://discord.gg/' + variables.constants.DISCORD_SERVER; +const GITHUB_LINK = + 'https://github.com/' + variables.constants.ORG_NAME + '/' + variables.constants.REPO_NAME; + +function WelcomeNotice({ config }) { + const { icon: Icon, title, subtitle, link } = config; + return ( +
+
+ +
+
+ {title} + {subtitle} +
+ {link && ( + + + {variables.getMessage('modals.welcome.sections.intro.notices.github_open')} + + )} +
+ ); +} + function Intro() { -const [welcomeImage, setWelcomeImage] = useState(0); + const [welcomeImage, setWelcomeImage] = useState(0); -useEffect(() => { - const timer = setInterval(() => { - setWelcomeImage(prevWelcomeImage => prevWelcomeImage < 3 ? prevWelcomeImage + 1 : 0); - }, 3000); + const updateWelcomeImage = useCallback(() => { + setWelcomeImage((prevWelcomeImage) => (prevWelcomeImage < 3 ? prevWelcomeImage + 1 : 0)); + }, []); - // Cleanup function to clear the interval when the component unmounts + const ShareYourMue = ( +
+ Example Mue setup + #shareyourmue +
+ ); + + useEffect(() => { + const timer = setInterval(updateWelcomeImage, 3000); return () => clearInterval(timer); - }, [welcomeImage]); + }, [updateWelcomeImage]); return (
-
- Example Mue setup - #shareyourmue -
-
-
- -
-
- - {variables.getMessage('modals.welcome.sections.intro.title')} - - - {variables.getMessage('modals.welcome.sections.intro.description')} - -
-
-
-
- -
-
- - {variables.getMessage('modals.welcome.sections.intro.notices.discord_title')} - - - {variables.getMessage('modals.welcome.sections.intro.notices.discord_description')} - -
- - {' '} - {variables.getMessage('modals.welcome.sections.intro.notices.discord_join')} - -
-
-
- -
-
- - {variables.getMessage('modals.welcome.sections.intro.notices.github_title')} - - - {variables.getMessage('modals.welcome.sections.intro.notices.github_description')} - -
- - - {variables.getMessage('modals.welcome.sections.intro.notices.github_open')} - -
+ {ShareYourMue} + + + ); } diff --git a/src/features/modals/welcome/Welcome.jsx b/src/features/modals/welcome/Welcome.jsx index 70e6e288..3b875b1c 100644 --- a/src/features/modals/welcome/Welcome.jsx +++ b/src/features/modals/welcome/Welcome.jsx @@ -4,7 +4,7 @@ import { MdArrowBackIosNew, MdArrowForwardIos, MdOutlinePreview } from 'react-ic import EventBus from 'utils/eventbus'; -import { ProgressBar, AsideImage, Navigation } from './components/Elements'; +import { ProgressBar, AsideImage } from './components/Elements'; import { Button } from 'components/Elements'; import { Wrapper, Panel } from './components/Layout'; @@ -52,49 +52,41 @@ function WelcomeModal({ modalClose, modalSkip }) { }; }, [currentTab, finalTab]); - const changeTab = (minus) => { - localStorage.setItem('bgtransition', true); - localStorage.removeItem('welcomeTab'); - - if (minus) { - setCurrentTab(currentTab - 1); - setButtonText(variables.getMessage('modals.welcome.buttons.next')); - return; - } - - if (buttonText === variables.getMessage('modals.welcome.buttons.finish')) { - modalClose(); - return; - } - - const newTab = currentTab + 1; + const updateTabAndButtonText = (newTab) => { setCurrentTab(newTab); setButtonText( newTab !== finalTab ? variables.getMessage('modals.welcome.buttons.next') : variables.getMessage('modals.welcome.buttons.finish'), ); - }; - - const switchTab = (tab) => { - setCurrentTab(tab); - setButtonText( - tab !== finalTab + 1 - ? variables.getMessage('modals.welcome.buttons.next') - : variables.getMessage('modals.welcome.buttons.finish'), - ); localStorage.setItem('bgtransition', true); localStorage.removeItem('welcomeTab'); }; + const goBackward = () => { + updateTabAndButtonText(currentTab - 1); + }; + + const goForward = () => { + if (buttonText === variables.getMessage('modals.welcome.buttons.finish')) { + modalClose(); + return; + } + updateTabAndButtonText(currentTab + 1); + }; + + const switchToTab = (tab) => { + updateTabAndButtonText(tab); + }; + const Navigation = () => { return (
{currentTab !== 0 ? (
- ); -} - -export { Navigation as default, Navigation }; diff --git a/src/features/modals/welcome/components/Elements/Navigation/index.jsx b/src/features/modals/welcome/components/Elements/Navigation/index.jsx deleted file mode 100644 index 95e14a93..00000000 --- a/src/features/modals/welcome/components/Elements/Navigation/index.jsx +++ /dev/null @@ -1 +0,0 @@ -export * from './Navigation'; diff --git a/src/features/modals/welcome/components/Elements/index.jsx b/src/features/modals/welcome/components/Elements/index.jsx index d5dd5196..5acfbfe6 100644 --- a/src/features/modals/welcome/components/Elements/index.jsx +++ b/src/features/modals/welcome/components/Elements/index.jsx @@ -1,3 +1,2 @@ export * from './ProgressBar'; export * from './AsideImage'; -export * from './Navigation'; diff --git a/src/i18n/locales/events/en.json b/src/i18n/locales/events/en.json new file mode 100644 index 00000000..e69de29b