fix: commence work on welcome modal

This commit is contained in:
alexsparkes
2022-08-07 18:36:56 +01:00
parent 4db25439c9
commit 77a6bbc7c5
18 changed files with 1125 additions and 1150 deletions

626
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,13 @@
import React, { useState, useEffect, useCallback, useRef } from "react"; import React, { useState, useEffect, useCallback, useRef } from 'react';
import { PrevButton, NextButton } from "./EmblaCarouselButtons"; import { PrevButton, NextButton } from './CarouselButtons';
import useEmblaCarousel from "embla-carousel-react"; import useEmblaCarousel from 'embla-carousel-react';
import Autoplay from "embla-carousel-autoplay"; import Autoplay from 'embla-carousel-autoplay';
import { FaPhotoVideo } from "react-icons/fa"; import './carousel.scss';
import { FaPhotoVideo } from 'react-icons/fa';
const EmblaCarousel = ({ data, options = { loop: false } }) => { const EmblaCarousel = ({ data, options = { loop: false } }) => {
const autoplay = useRef( const autoplay = useRef(
Autoplay( Autoplay({ delay: 3000, stopOnInteraction: false }, (emblaRoot) => emblaRoot.parentElement),
{ delay: 3000, stopOnInteraction: false },
(emblaRoot) => emblaRoot.parentElement
)
); );
const [emblaRef, emblaApi] = useEmblaCarousel(options, [autoplay.current]); const [emblaRef, emblaApi] = useEmblaCarousel(options, [autoplay.current]);
@@ -37,7 +35,7 @@ const EmblaCarousel = ({ data, options = { loop: false } }) => {
useEffect(() => { useEffect(() => {
if (!emblaApi) return; if (!emblaApi) return;
onSelect(); onSelect();
emblaApi.on("select", onSelect); emblaApi.on('select', onSelect);
}, [emblaApi, onSelect]); }, [emblaApi, onSelect]);
return ( return (
@@ -47,11 +45,7 @@ const EmblaCarousel = ({ data, options = { loop: false } }) => {
{data.map((photo, index) => ( {data.map((photo, index) => (
<div className="embla__slide" key={index}> <div className="embla__slide" key={index}>
<div className="embla__slide__inner"> <div className="embla__slide__inner">
<img <img className="embla__slide__img" src={photo.url.default} alt="A cool cat." />
className="embla__slide__img"
src={photo.url.default}
alt="A cool cat."
/>
</div> </div>
</div> </div>
))} ))}

View File

@@ -0,0 +1,14 @@
import React from 'react';
import { MdOutlineArrowForwardIos, MdOutlineArrowBackIos } from 'react-icons/md';
export const PrevButton = ({ enabled, onClick }) => (
<button className="embla__button embla__button--prev" onClick={onClick} disabled={!enabled}>
<MdOutlineArrowBackIos />
</button>
);
export const NextButton = ({ enabled, onClick }) => (
<button className="embla__button embla__button--next" onClick={onClick} disabled={!enabled}>
<MdOutlineArrowForwardIos />
</button>
);

View File

@@ -0,0 +1,88 @@
.embla {
position: relative;
width: 350px;
margin-left: 5px;
}
.embla__viewport {
overflow: hidden;
width: 100%;
}
.embla__viewport.is-draggable {
cursor: move;
cursor: grab;
}
.embla__viewport.is-dragging {
cursor: grabbing;
}
.embla__container {
display: flex;
user-select: none;
-webkit-touch-callout: none;
-khtml-user-select: none;
-webkit-tap-highlight-color: transparent;
margin-left: -10px;
}
.embla__slide {
position: relative;
min-width: 100%;
padding-left: 10px;
}
.embla__slide__inner {
position: relative;
overflow: hidden;
height: 190px;
}
.embla__slide__img {
position: absolute;
display: block;
top: 50%;
left: 50%;
width: auto;
min-height: 100%;
min-width: 100%;
max-width: none;
transform: translate(-50%, -50%);
}
.embla__button {
outline: 0;
cursor: pointer;
touch-action: manipulation;
position: absolute;
z-index: 1;
top: 50%;
transform: translateY(-50%);
border: 0;
width: 30px !important;
height: 30px !important;
display: grid;
place-items: center;
justify-content: center;
align-items: center;
padding: 0;
}
.embla__button:disabled {
cursor: default;
opacity: 0.3;
}
.embla__button__svg {
width: 100%;
height: 100%;
}
.embla__button--prev {
left: 27px;
}
.embla__button--next {
right: 27px;
}

View File

@@ -97,7 +97,7 @@ export default class Modals extends PureComponent {
onRequestClose={() => this.closeWelcome()} onRequestClose={() => this.closeWelcome()}
isOpen={this.state.welcomeModal} isOpen={this.state.welcomeModal}
className="Modal welcomemodal mainModal" className="Modal welcomemodal mainModal"
overlayClassName="Overlay welcomeoverlay" overlayClassName="Overlay mainModal"
shouldCloseOnOverlayClick={false} shouldCloseOnOverlayClick={false}
ariaHideApp={false} ariaHideApp={false}
> >

View File

@@ -1,8 +1,6 @@
import variables from 'modules/variables'; import variables from 'modules/variables';
export default function Collection({ export default function Collection({ items }) {
items,
}) {
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text); const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
return ( return (

View File

@@ -1,22 +0,0 @@
import React from "react";
import { MdOutlineArrowForwardIos, MdOutlineArrowBackIos } from 'react-icons/md';
export const PrevButton = ({ enabled, onClick }) => (
<button
className="embla__button embla__button--prev"
onClick={onClick}
disabled={!enabled}
>
<MdOutlineArrowBackIos/>
</button>
);
export const NextButton = ({ enabled, onClick }) => (
<button
className="embla__button embla__button--next"
onClick={onClick}
disabled={!enabled}
>
<MdOutlineArrowForwardIos/>
</button>
);

View File

@@ -1,6 +1,7 @@
import variables from 'modules/variables'; import variables from 'modules/variables';
import { PureComponent, Fragment } from 'react'; import { PureComponent, Fragment } from 'react';
import Tooltip from '../../../helpers/tooltip/Tooltip'; import Tooltip from '../../../helpers/tooltip/Tooltip';
import ImageCarousel from '../../../helpers/carousel/Carousel';
import { toast } from 'react-toastify'; import { toast } from 'react-toastify';
import { import {
MdArrowBack, MdArrowBack,
@@ -17,7 +18,6 @@ import {
MdOutlineKeyboardArrowRight, MdOutlineKeyboardArrowRight,
MdExpandMore, MdExpandMore,
} from 'react-icons/md'; } from 'react-icons/md';
import ImageCarousel from './imageCarousel';
import Modal from 'react-modal'; import Modal from 'react-modal';
import { install, uninstall } from 'modules/helpers/marketplace'; import { install, uninstall } from 'modules/helpers/marketplace';
@@ -151,20 +151,18 @@ export default class Item extends PureComponent {
</div> </div>
</> </>
) : null} ) : null}
{this.props.data.data.settings ? ( {this.props.data.data.settings ? (
<img <img
alt="product" alt="product"
draggable="false" draggable="false"
src={iconsrc} src={iconsrc}
onClick={() => this.setState({ showLightbox: true })} onClick={() => this.setState({ showLightbox: true })}
/> />
) : null} ) : null}
<span className="title"> <span className="title">
{getMessage('modals.main.marketplace.product.description')} {getMessage('modals.main.marketplace.product.description')}
</span> </span>
<span <span dangerouslySetInnerHTML={{ __html: this.props.data.description }} />
dangerouslySetInnerHTML={{ __html: this.props.data.description }}
/>
{/* {/*
{this.props.data.description.length > 100 ? ( {this.props.data.description.length > 100 ? (
<div className="showMore" onClick={() => this.toggleShowMore()}> <div className="showMore" onClick={() => this.toggleShowMore()}>

View File

@@ -82,6 +82,9 @@
#modal { #modal {
height: 80vh; height: 80vh;
width: clamp(60vw, 1200px, 90vw); width: clamp(60vw, 1200px, 90vw);
@include themed() {
background-color: t($modal-background);
}
} }
/* fixes for font size on extension */ /* fixes for font size on extension */

View File

@@ -476,91 +476,3 @@ p.author {
font-size: 30px; font-size: 30px;
} }
} }
.embla {
position: relative;
width: 350px;
margin-left: 5px;
}
.embla__viewport {
overflow: hidden;
width: 100%;
}
.embla__viewport.is-draggable {
cursor: move;
cursor: grab;
}
.embla__viewport.is-dragging {
cursor: grabbing;
}
.embla__container {
display: flex;
user-select: none;
-webkit-touch-callout: none;
-khtml-user-select: none;
-webkit-tap-highlight-color: transparent;
margin-left: -10px;
}
.embla__slide {
position: relative;
min-width: 100%;
padding-left: 10px;
}
.embla__slide__inner {
position: relative;
overflow: hidden;
height: 190px;
}
.embla__slide__img {
position: absolute;
display: block;
top: 50%;
left: 50%;
width: auto;
min-height: 100%;
min-width: 100%;
max-width: none;
transform: translate(-50%, -50%);
}
.embla__button {
outline: 0;
cursor: pointer;
touch-action: manipulation;
position: absolute;
z-index: 1;
top: 50%;
transform: translateY(-50%);
border: 0;
width: 30px !important;
height: 30px !important;
display: grid;
place-items: center;
justify-content: center;
align-items: center;
padding: 0;
}
.embla__button:disabled {
cursor: default;
opacity: 0.3;
}
.embla__button__svg {
width: 100%;
height: 100%;
}
.embla__button--prev {
left: 27px;
}
.embla__button--next {
right: 27px;
}

View File

@@ -20,7 +20,7 @@ const widget_name = {
quicklinks: getMessage('modals.main.settings.sections.quicklinks.title'), quicklinks: getMessage('modals.main.settings.sections.quicklinks.title'),
quote: getMessage('modals.main.settings.sections.quote.title'), quote: getMessage('modals.main.settings.sections.quote.title'),
date: getMessage('modals.main.settings.sections.date.title'), date: getMessage('modals.main.settings.sections.date.title'),
message: getMessage('modals.main.settings.sections.message.title') message: getMessage('modals.main.settings.sections.message.title'),
}; };
const SortableItem = sortableElement(({ value }) => ( const SortableItem = sortableElement(({ value }) => (

View File

@@ -20,7 +20,7 @@ export default function Marketplace(props) {
<div label={getMessage('modals.main.marketplace.preset_settings')} name="preset_settings"> <div label={getMessage('modals.main.marketplace.preset_settings')} name="preset_settings">
<MarketplaceTab type="preset_settings" /> <MarketplaceTab type="preset_settings" />
</div> </div>
<div label='Collections' name="collection"> <div label="Collections" name="collection">
<MarketplaceTab type="collection" /> <MarketplaceTab type="collection" />
</div> </div>
</Tabs> </Tabs>

View File

@@ -145,7 +145,7 @@ function Tab({ label, currentTab, onClick, navbarTab }) {
icon = <Advanced />; icon = <Advanced />;
break; break;
case 'Collections': case 'Collections':
icon = <Collections />; icon = <Collections />;
break; break;
default: default:
@@ -160,7 +160,7 @@ function Tab({ label, currentTab, onClick, navbarTab }) {
return ( return (
<> <>
{mue === true ? <span className='mainTitle'>Mue</span> : null} {mue === true ? <span className="mainTitle">Mue</span> : null}
<button className={className} onClick={() => onClick(label)}> <button className={className} onClick={() => onClick(label)}>
{icon} <span>{label}</span> {icon} <span>{label}</span>
</button> </button>

View File

@@ -121,7 +121,9 @@ export default class WelcomeSections extends PureComponent {
const intro = ( const intro = (
<> <>
<span className="mainTitle">{this.getMessage('modals.welcome.sections.intro.title')}</span> <span className="mainTitle">{this.getMessage('modals.welcome.sections.intro.title')}</span>
<p>{this.getMessage('modals.welcome.sections.intro.description')}</p> <span className="subtitle">
{this.getMessage('modals.welcome.sections.intro.description')}
</span>
<h3 className="quicktip">#shareyourmue</h3> <h3 className="quicktip">#shareyourmue</h3>
<div className="examples"> <div className="examples">
<img <img
@@ -138,7 +140,7 @@ export default class WelcomeSections extends PureComponent {
<span className="mainTitle"> <span className="mainTitle">
{this.getMessage('modals.welcome.sections.language.title')} {this.getMessage('modals.welcome.sections.language.title')}
</span> </span>
<p> <span className="subtitle">
{this.getMessage('modals.welcome.sections.language.description')}{' '} {this.getMessage('modals.welcome.sections.language.description')}{' '}
<a <a
href={variables.constants.TRANSLATIONS_URL} href={variables.constants.TRANSLATIONS_URL}
@@ -149,8 +151,10 @@ export default class WelcomeSections extends PureComponent {
GitHub GitHub
</a> </a>
! !
</p> </span>
<Radio name="language" options={languages} category="welcomeLanguage" /> <div className="languageSettings">
<Radio name="language" options={languages} category="welcomeLanguage" />
</div>
</> </>
); );

View File

@@ -2,76 +2,49 @@
@import 'scss/variables'; @import 'scss/variables';
.welcomeContent { .welcomeContent {
height: 100%; @include themed() {
} background-color: t($modal-background);
.welcomemodal {
position: absolute;
margin: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
height: 80vh;
width: clamp(70vw, 1200px, 90vw);
padding: 0;
overflow-x: hidden !important;
section {
width: 50%;
display: inline;
height: 100%;
} }
@extend %tabText;
height: 80vh;
width: clamp(60vw, 1200px, 90vw);
display: grid;
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(1, 1fr);
grid-column-gap: 0px;
grid-row-gap: 0px;
section:nth-child(1) { section:nth-child(1) {
float: left;
@include themed() {
background: t($modal-sidebar);
}
display: flex; display: flex;
justify-content: center;
align-items: center; align-items: center;
} justify-content: center;
section:nth-child(2) {
float: right;
@include themed() { @include themed() {
background: t($modal-background); background-color: t($modal-sidebar);
} }
.content { }
padding: 20px; section:nth-child(2) {
.mainTitle {
font-size: 38px;
font-weight: 600;
margin-bottom: 15px;
}
}
.buttons { .buttons {
position: absolute; backdrop-filter: blur(2px);
bottom: 2rem; position: sticky;
right: 2rem; bottom: 0;
padding: 25px;
display: flex; display: flex;
justify-content: flex-end;
button { button {
@include modal-button(standard); @include modal-button(standard);
width: 150px; width: 150px;
} }
} }
.content {
h1 { display: flex;
font-size: 2.5rem; flex-flow: column;
} padding: 25px;
h3.quicktip {
text-transform: uppercase;
color: #5352ed;
} }
} }
} }
.welcomeoverlay {
background-color: rgba(0, 0, 0, 0.4);
}
.progressbar { .progressbar {
position: fixed; position: fixed;
@@ -242,3 +215,15 @@ a.privacy {
opacity: 1; opacity: 1;
} }
} }
.light {
.toggle.lightTheme {
background-color: rgba(219, 219, 219, 0.72);
}
}
.dark {
.toggle.darkTheme {
background-color: rgba(65, 71, 84, 0.9);
}
}

View File

@@ -32,7 +32,7 @@ export default class Widgets extends PureComponent {
quote: this.enabled('quote') ? <Quote /> : null, quote: this.enabled('quote') ? <Quote /> : null,
date: this.enabled('date') ? <Date /> : null, date: this.enabled('date') ? <Date /> : null,
quicklinks: this.enabled('quicklinksenabled') && this.online ? <QuickLinks /> : null, quicklinks: this.enabled('quicklinksenabled') && this.online ? <QuickLinks /> : null,
message: this.enabled('message') ? <Message /> : null message: this.enabled('message') ? <Message /> : null,
}; };
} }
@@ -75,14 +75,7 @@ export default class Widgets extends PureComponent {
// allow for re-ordering widgets // allow for re-ordering widgets
// we have a default to prevent errors // we have a default to prevent errors
let elements = [ let elements = [<Greeting />, <Clock />, <QuickLinks />, <Quote />, <Date />, <Message />];
<Greeting />,
<Clock />,
<QuickLinks />,
<Quote />,
<Date />,
<Message />
];
if (this.state.order) { if (this.state.order) {
elements = []; elements = [];

File diff suppressed because it is too large Load Diff