improve loader

pull/2233/head
Mikael Finstad 1 year ago
parent bcf80b82ff
commit 34bb73fe50
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

@ -0,0 +1,24 @@
.wrapper {
background: var(--whiteA4);
}
:global(.dark-theme) .wrapper {
background: var(--blackA4);
}
.loader-box {
max-width: 16em;
min-width: 13em;
border-radius: 1.5em;
padding: 2.5% 1% 1.7% 1%;
color: white;
font-size: 14px;
display: flex;
flex-direction: column;
align-items: center;
background: var(--blackA6);
box-shadow: var(--blackA6) 0 0 .7em 0;
border: 1px solid var(--whiteA5);
backdrop-filter: blur(7px);
}

@ -3,9 +3,9 @@ import { motion } from 'framer-motion';
import Lottie from 'react-lottie-player/dist/LottiePlayerLight'; import Lottie from 'react-lottie-player/dist/LottiePlayerLight';
import { Trans } from 'react-i18next'; import { Trans } from 'react-i18next';
import { primaryColor } from '../colors';
import loadingLottie from '../7077-magic-flow.json'; import loadingLottie from '../7077-magic-flow.json';
import Button from './Button'; import Button from './Button';
import styles from './Working.module.css';
function Working({ text, progress, onAbortClick }: { function Working({ text, progress, onAbortClick }: {
@ -14,9 +14,9 @@ function Working({ text, progress, onAbortClick }: {
onAbortClick: () => void onAbortClick: () => void
}) { }) {
return ( return (
<div style={{ position: 'absolute', bottom: 0, top: 0, left: 0, right: 0, display: 'flex', justifyContent: 'center', alignItems: 'center' }}> <div className={styles['wrapper']} style={{ position: 'absolute', bottom: 0, top: 0, left: 0, right: 0, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<motion.div <motion.div
style={{ background: primaryColor, boxShadow: `${primaryColor} 0px 0px 20px 25px`, borderRadius: 60, paddingBottom: 5, color: 'white', fontSize: 14, display: 'flex', flexDirection: 'column', alignItems: 'center' }} className={styles['loader-box']}
initial={{ opacity: 0, scale: 0 }} initial={{ opacity: 0, scale: 0 }}
animate={{ opacity: 1, scale: 1 }} animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0 }} exit={{ opacity: 0, scale: 0 }}
@ -30,18 +30,18 @@ function Working({ text, progress, onAbortClick }: {
/> />
</div> </div>
<div style={{ marginTop: 5 }}> <div style={{ marginTop: '.7em', textAlign: 'center' }}>
{text}... {text}...
</div> </div>
{(progress != null) && ( {(progress != null) && (
<div style={{ marginTop: 5 }}> <div style={{ marginTop: '.5em' }}>
{`${(progress * 100).toFixed(1)} %`} {`${(progress * 100).toFixed(1)} %`}
</div> </div>
)} )}
<div style={{ marginTop: 5 }}> <div style={{ marginTop: '1.5em' }}>
<Button onClick={onAbortClick} style={{ padding: '.5em 1em' }}><Trans>Abort</Trans></Button> <Button onClick={onAbortClick} style={{ fontSize: '1.1em', padding: '.2em 1em' }}><Trans>Abort</Trans></Button>
</div> </div>
</motion.div> </motion.div>
</div> </div>

@ -6,7 +6,7 @@ import { abortFfmpegs } from '../ffmpeg';
export default () => { export default () => {
const { t } = useTranslation(); const { t } = useTranslation();
const [working, setWorkingState] = useState<{ text: string, abortController?: AbortController | undefined }>(); const [working, setWorkingState] = useState<{ text: string, abortController?: AbortController | undefined } | undefined>();
// Store "working" in a ref so we can avoid race conditions // Store "working" in a ref so we can avoid race conditions
const workingRef = useRef(!!working); const workingRef = useRef(!!working);

Loading…
Cancel
Save