From 1b4b37d4b183137f506b27053faf8aaddab6a945 Mon Sep 17 00:00:00 2001 From: David Ralph Date: Mon, 1 Nov 2021 13:24:09 +0000 Subject: [PATCH] feat: improved settings and marketplace ui, better custom background support, fix webpack Co-authored-by: Alex Sparkes --- package.json | 2 +- src/components/modals/Modals.jsx | 1 + .../modals/main/scss/marketplace/_main.scss | 4 +- .../modals/main/scss/modules/_navbar.scss | 31 +++++----- .../modals/main/scss/modules/_sidebar.scss | 2 +- .../main/scss/modules/_tab-content.scss | 6 +- .../modals/main/scss/settings/_buttons.scss | 48 +++++++++++---- .../modals/main/scss/settings/_main.scss | 2 +- .../scss/settings/modules/_material-ui.scss | 2 - .../scss/settings/modules/tabs/_order.scss | 25 ++++++++ src/components/modals/main/settings/Text.jsx | 2 +- .../main/settings/sections/Advanced.jsx | 23 ++++++-- .../main/settings/sections/Appearance.jsx | 1 - .../settings/sections/background/Custom.jsx | 58 ++++++++++++------- .../sections/background/CustomURLModal.jsx | 19 ++++++ src/components/modals/welcome/welcome.scss | 2 + 16 files changed, 164 insertions(+), 64 deletions(-) create mode 100644 src/components/modals/main/settings/sections/background/CustomURLModal.jsx diff --git a/package.json b/package.json index 2260e4a3..3f30400f 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "sass": "^1.42.1", "sass-loader": "^12.1.0", "source-map-loader": "^3.0.0", - "webpack": "^5.54.0", + "webpack": "^5.61.0", "webpack-cli": "^4.8.0", "webpack-dev-server": "^4.3.0" }, diff --git a/src/components/modals/Modals.jsx b/src/components/modals/Modals.jsx index 2c543304..f093fcc0 100644 --- a/src/components/modals/Modals.jsx +++ b/src/components/modals/Modals.jsx @@ -58,6 +58,7 @@ export default class Modals extends PureComponent { previewWelcome() { localStorage.setItem('showWelcome', false); + localStorage.setItem('welcomePreview', true); this.setState({ welcomeModal: false, preview: true diff --git a/src/components/modals/main/scss/marketplace/_main.scss b/src/components/modals/main/scss/marketplace/_main.scss index ca55385a..eee052f6 100644 --- a/src/components/modals/main/scss/marketplace/_main.scss +++ b/src/components/modals/main/scss/marketplace/_main.scss @@ -14,11 +14,9 @@ height: 80px; width: 260px; background: var(--sidebar); - transition: 0.5s; cursor: pointer; margin-right: 20px; margin-top: 20px; - box-shadow: 0 0 6px rgb(0 0 0 / 30%); img { height: 80px; @@ -55,7 +53,7 @@ } &:hover { - transform: scale(1.1); + background: var(--tab-active); } } } diff --git a/src/components/modals/main/scss/modules/_navbar.scss b/src/components/modals/main/scss/modules/_navbar.scss index c0c6f5bd..8a7cf0cf 100644 --- a/src/components/modals/main/scss/modules/_navbar.scss +++ b/src/components/modals/main/scss/modules/_navbar.scss @@ -1,11 +1,17 @@ .navbar-item { font-size: 22px; font-weight: 500; - display: inline-flex; + display: flex; + flex-direction: column; + align-items: center; + color: var(--photo-info); &:hover { - color: grey; - background: none; + svg { + background: var(--tab-active); + } + + color: var(--modal-text) } span, @@ -15,6 +21,10 @@ svg { font-size: 1.2em !important; + width: 60px; + padding: 5px; + border-radius: 20px; + color: var(--photo-info); } } @@ -30,6 +40,7 @@ left: 20rem; top: 1rem; justify-content: center; + display: flex; svg { margin-right: 0.5rem; @@ -53,19 +64,9 @@ } .navbar-item-active { - background: map-get($theme-colours, 'gradient'); - -webkit-background-clip: text; - background-clip: text; - color: transparent; + color: var(--modal-text); svg { - color: orange; - } - - &:hover { - background: map-get($theme-colours, 'gradient'); - -webkit-background-clip: text; - background-clip: text; - color: transparent; + background: var(--sidebar); } } diff --git a/src/components/modals/main/scss/modules/_sidebar.scss b/src/components/modals/main/scss/modules/_sidebar.scss index 55c35140..35670a29 100644 --- a/src/components/modals/main/scss/modules/_sidebar.scss +++ b/src/components/modals/main/scss/modules/_sidebar.scss @@ -8,7 +8,7 @@ ul.sidebar { border-radius: 12px 0 0 12px; text-align: left; font-size: 24px; - min-height: 100vh; + min-height: 110vh; h1 { text-align: center; diff --git a/src/components/modals/main/scss/modules/_tab-content.scss b/src/components/modals/main/scss/modules/_tab-content.scss index 42f26e98..b15659a5 100644 --- a/src/components/modals/main/scss/modules/_tab-content.scss +++ b/src/components/modals/main/scss/modules/_tab-content.scss @@ -17,14 +17,14 @@ @media only screen and (max-width: 1920px) { .tab-content { left: 120px; - top: 50px; + top: 60px; } } @media only screen and (min-width: 1920px) { .tab-content { left: 350px; - top: 7%; + top: 9%; } } @@ -38,6 +38,6 @@ @media only screen and (max-width: 1200px) { .tab-content { left: 125px; - top: 75px; + top: 90px; } } diff --git a/src/components/modals/main/scss/settings/_buttons.scss b/src/components/modals/main/scss/settings/_buttons.scss index c444d533..7d6beee9 100644 --- a/src/components/modals/main/scss/settings/_buttons.scss +++ b/src/components/modals/main/scss/settings/_buttons.scss @@ -24,7 +24,8 @@ } } -.add, .close { +.add, +.close { @extend %settingsButton; background-color: map-get($button-colours, 'other'); @@ -43,16 +44,15 @@ .export, .uploadbg, .import { - @extend %settingsButton; - - background-color: map-get($button-colours, 'other'); - color: map-get($theme-colours, 'primary'); - border: 2px solid map-get($button-colours, 'other'); - - &:hover { - color: map-get($button-colours, 'other'); - border: 2px solid map-get($button-colours, 'other'); - } + width: 440px; + height: 60px; + background-color: var(--sidebar); + border: none; + outline: none; + color: var(--modal-text); + border-radius: 12px; + margin-right: 25px; + width: 220px; } .export, @@ -64,3 +64,29 @@ height: 10px !important; width: 10px !important; } + +.data-buttons-row { + width: 350px; + display: flex; + flex-direction: row; + + button { + background: var(--sidebar); + text-align: center; + border-radius: 20px; + padding: 20px; + border: 3px solid var(--tab-active); + height: 40px; + font-size: 1rem; + margin: 0 10px 10px 0; + display: flex; + flex-direction: column-reverse; + align-items: center; + color: var(--modal-text); + + &:hover { + background: var(--tab-active); + cursor: pointer; + } + } +} diff --git a/src/components/modals/main/scss/settings/_main.scss b/src/components/modals/main/scss/settings/_main.scss index 1428844c..f241fa89 100644 --- a/src/components/modals/main/scss/settings/_main.scss +++ b/src/components/modals/main/scss/settings/_main.scss @@ -54,7 +54,7 @@ input { width: 280px; color: var(--modal-text); background: var(--background); - border: solid white 1px; + border: solid var(--modal-text) 1px; padding: 15px 20px; border-radius: 4px; display: flex !important; diff --git a/src/components/modals/main/scss/settings/modules/_material-ui.scss b/src/components/modals/main/scss/settings/modules/_material-ui.scss index 18dd75ce..4b6eff43 100644 --- a/src/components/modals/main/scss/settings/modules/_material-ui.scss +++ b/src/components/modals/main/scss/settings/modules/_material-ui.scss @@ -37,13 +37,11 @@ legend { } .radio-title { - text-transform: uppercase; font-weight: bold; font-size: 1.17rem; } .radio-title-small { - text-transform: uppercase; font-weight: bold; font-size: 1rem; } diff --git a/src/components/modals/main/scss/settings/modules/tabs/_order.scss b/src/components/modals/main/scss/settings/modules/tabs/_order.scss index 14c887e6..42af1508 100644 --- a/src/components/modals/main/scss/settings/modules/tabs/_order.scss +++ b/src/components/modals/main/scss/settings/modules/tabs/_order.scss @@ -27,3 +27,28 @@ ul { vertical-align: middle; } } + +.images-row { + display: flex; + flex-wrap: wrap; + width: 500px; + + div { + width: 100px; + height: 100px; + background-repeat: no-repeat; + background-size: cover; + background-position: center; + background-color: var(--sidebar); + border: 20px solid var(--sidebar); + border-radius: 20px; + margin: 0 20px 20px 0; + display: flex; + align-items: flex-end; + justify-content: center; + + svg { + font-size: 1.9em; + } + } +} diff --git a/src/components/modals/main/settings/Text.jsx b/src/components/modals/main/settings/Text.jsx index b3d488ba..0a66a36c 100644 --- a/src/components/modals/main/settings/Text.jsx +++ b/src/components/modals/main/settings/Text.jsx @@ -49,7 +49,7 @@ export default class Text extends PureComponent { return ( <> {(this.props.textarea === true) ? - + : } {variables.language.getMessage(variables.languagecode, 'modals.main.settings.buttons.reset')} diff --git a/src/components/modals/main/settings/sections/Advanced.jsx b/src/components/modals/main/settings/sections/Advanced.jsx index d55b8eb1..5cea2e2e 100644 --- a/src/components/modals/main/settings/sections/Advanced.jsx +++ b/src/components/modals/main/settings/sections/Advanced.jsx @@ -2,6 +2,7 @@ import variables from 'modules/variables'; import { PureComponent } from 'react'; import Modal from 'react-modal'; import { MenuItem } from '@mui/material'; +import { Upload as ImportIcon, Download as ExportIcon, RestartAlt as ResetIcon } from '@mui/icons-material'; import { exportSettings, importSettings } from 'modules/helpers/settings/modals'; @@ -36,11 +37,23 @@ export default class AdvancedSettings extends PureComponent { ))} -

{getMessage('modals.main.settings.sections.advanced.data')}

-
- - - + {localStorage.getItem('welcomePreview') !== 'true' ? + <> +

{getMessage('modals.main.settings.sections.advanced.data')}

+
+
+ + + +
+ + : null} importSettings(e)}/>

{getMessage('modals.main.settings.sections.advanced.customisation')}

diff --git a/src/components/modals/main/settings/sections/Appearance.jsx b/src/components/modals/main/settings/sections/Appearance.jsx index 952c2193..7805bf04 100644 --- a/src/components/modals/main/settings/sections/Appearance.jsx +++ b/src/components/modals/main/settings/sections/Appearance.jsx @@ -46,7 +46,6 @@ export default function AppearanceSettings() { -

diff --git a/src/components/modals/main/settings/sections/background/Custom.jsx b/src/components/modals/main/settings/sections/background/Custom.jsx index 3dcf2cbe..c8eef8dd 100644 --- a/src/components/modals/main/settings/sections/background/Custom.jsx +++ b/src/components/modals/main/settings/sections/background/Custom.jsx @@ -1,19 +1,23 @@ import variables from 'modules/variables'; import { PureComponent, Fragment } from 'react'; import { toast } from 'react-toastify'; -import { Cancel } from '@mui/icons-material'; -import { TextField } from '@mui/material'; +import { Cancel, AddLink, AddPhotoAlternate } from '@mui/icons-material'; import Checkbox from '../../Checkbox'; import FileUpload from '../../FileUpload'; +import Modal from 'react-modal'; + +import CustomURLModal from './CustomURLModal'; + export default class CustomSettings extends PureComponent { getMessage = (text) => variables.language.getMessage(variables.languagecode, text); constructor() { super(); this.state = { - customBackground: this.getCustom() + customBackground: this.getCustom(), + customURLModal: false }; } @@ -44,7 +48,7 @@ export default class CustomSettings extends PureComponent { modifyCustomBackground(type, index) { const customBackground = this.state.customBackground; if (type === 'add') { - customBackground.push(''); + customBackground.push(''); } else { customBackground.splice(index, 1); } @@ -82,34 +86,48 @@ export default class CustomSettings extends PureComponent { return data; } - uploadCustombackground(index) { - document.getElementById('bg-input').setAttribute('index', index); + uploadCustomBackground() { + document.getElementById('bg-input').setAttribute('index', this.state.customBackground.length); document.getElementById('bg-input').click(); // to fix loadFunction this.setState({ - currentBackgroundIndex: index + currentBackgroundIndex: this.state.customBackground.length }); } + addCustomURL(e) { + this.setState({ + customURLModal: false, + currentBackgroundIndex: this.state.customBackground.length + }); + this.customBackground({ target: { value: e }}, true, this.state.customBackground.length); + } + render() { return (

    {this.getMessage('modals.main.settings.sections.background.source.custom_background')} {this.getMessage('modals.main.settings.buttons.reset')}

    - {this.state.customBackground.map((_url, index) => ( - - this.customBackground(e, true, index)} autoComplete='off' autoCorrect='off' autoCapitalize='off' spellCheck={false} varient='outlined' /> - {this.state.customBackground.length > 1 ? : null} - this.uploadCustombackground(index)}>{this.getMessage('modals.main.settings.sections.background.source.upload')} - {this.videoCustomSettings(index)} - - ))} -

    - -

    +
    + {this.state.customBackground.map((_url, index) => ( + +
    + {this.state.customBackground.length > 0 ? : null} +
    + {this.videoCustomSettings(index)} +
    + ))} +
    +
    + + +
    this.customBackground(e, false, this.state.currentBackgroundIndex)} /> {this.props.interval} + + this.addCustomURL(e)} /> +
); } diff --git a/src/components/modals/main/settings/sections/background/CustomURLModal.jsx b/src/components/modals/main/settings/sections/background/CustomURLModal.jsx new file mode 100644 index 00000000..badc92c7 --- /dev/null +++ b/src/components/modals/main/settings/sections/background/CustomURLModal.jsx @@ -0,0 +1,19 @@ +import { useState } from 'react'; +import { Add } from '@mui/icons-material'; +import { TextField } from '@mui/material'; + +export default function CustomURLModal({ modalClose }) { + const [url, setURL] = useState('URL'); + + return ( + <> +

Add URL

+ setURL(e.target.value)} varient='outlined' /> +
+ +
+ + ); +} diff --git a/src/components/modals/welcome/welcome.scss b/src/components/modals/welcome/welcome.scss index 7d1696b5..af065f1b 100644 --- a/src/components/modals/welcome/welcome.scss +++ b/src/components/modals/welcome/welcome.scss @@ -88,6 +88,7 @@ border-radius: 40px; padding: 20px; margin: 10px; + border: 3px solid var(--tab-active); &:hover { background: var(--tab-active); @@ -132,6 +133,7 @@ background: var(--sidebar); color: var(--modal-text); cursor: pointer; + border: 3px solid var(--tab-active); &:hover { background: var(--tab-active);