style cleanup + tweaks

Title <> Subtitle relationships
Animat ein
This commit is contained in:
cv
2021-04-26 13:38:30 +02:00
parent 9f0f9752ae
commit 004b31b5e7
19 changed files with 404 additions and 254 deletions
@@ -0,0 +1,14 @@
import style from './TitleCard.module.css';
export default function TitleCard(props) {
const { label, title, subtitle, presenter } = props;
return (
<>
<div className={style.label}>{label}</div>
<div className={style.title}>{title}</div>
<div className={style.presenter}>{presenter}</div>
<div className={style.subtitle}>{subtitle}</div>
</>
);
}
@@ -0,0 +1,41 @@
.label {
font-size: 1.3vw;
color: #ff7597;
}
.title,
.subtitle,
.presenter {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.title {
color: #ddd;
font-size: 2.5vw;
flex: 1;
font-weight: 600;
}
.subtitle,
.presenter {
color: #aaa;
}
.subtitle {
font-size: 1.5vw;
font-weight: 200;
margin-top: -0.8vh;
}
.presenter {
font-size: 2vw;
}
.title:after,
.presenter:after,
.subtitle:after {
content: '\200b';
}
@@ -0,0 +1,18 @@
import style from './TitleSide.module.css';
export default function TitleSide(props) {
const { type, label, title, subtitle, presenter } = props;
const titleStyle = type === 'next' ? style.nextTitle : style.nowTitle;
const subStyle = type === 'next' ? style.nextSubtitle : style.nowSubtitle;
const presStyle = type === 'next' ? style.nextPresenter : style.nowPresenter;
return (
<>
<div className={style.label}>{label}</div>
<div className={titleStyle}>{title}</div>
<div className={presStyle}>{presenter}</div>
<div className={subStyle}>{subtitle}</div>
</>
);
}
@@ -0,0 +1,54 @@
.label {
font-size: 1.3vw;
color: #ff7597;
}
.nowTitle,
.nextTitle {
color: #ddd;
font-weight: 600;
}
.nowSubtitle,
.nowPresenter,
.nextSubtitle,
.nextPresenter {
color: #aaa;
}
.nowTitle {
font-size: 2.5vw;
}
.nowPresenter {
font-size: 2vw;
font-weight: 400;
}
.nowSubtitle {
font-size: 1.2vw;
margin-top: -1vh;
}
.nextTitle {
font-size: 2vw;
}
.nextSubtitle {
margin-top: -0.8vh;
font-size: 1.1vw;
}
.nextPresenter {
font-weight: 400;
font-size: 1.5vw;
}
.nowTitle:after,
.nowSubtitle:after,
.nowPresenter:after,
.nextTitle:after,
.nextSubtitle:after,
.nextPresenter:after {
content: '\200b';
}
+6 -5
View File
@@ -1,16 +1,17 @@
.emptyContainer {
text-align: center;
color: rgba(0, 0, 0, 0.17);
font-weight: 600;
font-size: 2em;
width: 100%;
text-align: center;
}
.empty {
width: 100%;
margin: auto 0;
margin-top: 10vh;
opacity: 0.3;
}
.text {
text-align: center;
color: rgba(0, 0, 0, 0.17);
font-weight: 600;
font-size: 2em;
}
+5 -61
View File
@@ -19,7 +19,7 @@ export default function Editor() {
<div className={styles.mainContainer}>
<Box className={styles.editor}>
<Heading size='lg' style={{ paddingBottom: '0.25em' }}>
<Heading size='lg' paddingBottom={'0.25em'}>
Event List
</Heading>
<NumberedText number={1} text={'Manage and select event to run'} />
@@ -29,7 +29,7 @@ export default function Editor() {
</Box>
<Box className={styles.preview} borderRadius='0.5em' overflowX='auto'>
<Heading size='lg' style={{ paddingBottom: '0.25em' }}>
<Heading size='lg' paddingBottom={'0.25em'}>
Preview Displays
</Heading>
<NumberedText number={4} text={'Realtime screen preview'} />
@@ -39,7 +39,7 @@ export default function Editor() {
</Box>
<Box className={styles.messages}>
<Heading size='lg' style={{ paddingBottom: '0.25em' }}>
<Heading size='lg' paddingBottom={'0.25em'}>
Display Messages
</Heading>
<NumberedText
@@ -52,7 +52,7 @@ export default function Editor() {
</Box>
<Box className={styles.playback}>
<Heading size='lg' style={{ paddingBottom: '0.25em' }}>
<Heading size='lg' paddingBottom={'0.25em'}>
Time Control
</Heading>
<NumberedText number={3} text={'Control Timer'} />
@@ -62,64 +62,8 @@ export default function Editor() {
</Box>
<Box className={styles.settings}>
<div
style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
gap: '2em',
paddingTop: '3em',
}}
>
<div className={styles.content}>
<SettingsIconBtn size='md' clickhandler={onOpen} />
<div
style={{
width: 35,
height: 35,
backgroundColor: '#3b8cd8',
borderRadius: '50%',
}}
/>
<div
style={{
width: 35,
height: 35,
backgroundColor: '#3182ce',
borderRadius: '50%',
}}
/>
<div
style={{
width: 35,
height: 35,
backgroundColor: '#2778c4',
borderRadius: '50%',
}}
/>
<div
style={{
width: 35,
height: 35,
backgroundColor: '#1d6eba',
borderRadius: '50%',
}}
/>
<div
style={{
width: 35,
height: 35,
backgroundColor: '#1364b0',
borderRadius: '50%',
}}
/>
<div
style={{
width: 35,
height: 35,
backgroundColor: '#095aa6',
borderRadius: '50%',
}}
/>
</div>
</Box>
</div>
@@ -92,6 +92,10 @@
.settings {
grid-area: sett;
display: flex;
flex-direction: column;
align-items: center;
gap: 2.6em;
}
.content {
@@ -1,13 +1,13 @@
import { Menu, MenuButton, MenuItem, MenuList } from '@chakra-ui/menu';
import { IconButton } from '@chakra-ui/button';
import { FiZap, FiPlus, FiMinus, FiMinusCircle, FiClock } from 'react-icons/fi';
import { FiZap, FiPlus, FiMinusCircle, FiClock } from 'react-icons/fi';
export default function ActionButtons(props) {
const { showDel, showAdd, showDelay, showBlock } = props;
const { showAdd, showDelay, showBlock } = props;
const menuStyle = {
color: '#000000',
backgroundColor: 'rgba(255,255,255,0.67)',
backgroundColor: 'rgba(255,255,255,1)',
};
return (
@@ -23,26 +23,28 @@ export default function ActionButtons(props) {
color={'orange.500'}
/>
<MenuList style={menuStyle}>
{showDel && (
<MenuItem icon={<FiMinus />} onClick={props.deleteHandler}>
Delete
</MenuItem>
)}
{showAdd && (
<MenuItem icon={<FiPlus />} onClick={props.addHandler}>
Event next
</MenuItem>
)}
{showDelay && (
<MenuItem icon={<FiClock />} onClick={props.delayHandler}>
Delay next
</MenuItem>
)}
{showBlock && (
<MenuItem icon={<FiMinusCircle />} onClick={props.blockHandler}>
Block next
</MenuItem>
)}
<MenuItem
icon={<FiPlus />}
onClick={props.addHandler}
isDisabled={!showAdd}
>
Event next
</MenuItem>
<MenuItem
icon={<FiClock />}
onClick={props.delayHandler}
isDisabled={!showDelay}
>
Delay next
</MenuItem>
<MenuItem
icon={<FiMinusCircle />}
onClick={props.blockHandler}
isDisabled={!showBlock}
>
Block next
</MenuItem>
</MenuList>
</Menu>
);
@@ -11,7 +11,6 @@ import DeleteIconBtn from '../../../common/components/buttons/DeleteIconBtn';
export default function EventBlock(props) {
const { data, selected, next, delay, index, eventsHandler } = props;
const [visible, setVisible] = useState(false);
const [more, setMore] = useState(false);
@@ -53,6 +52,11 @@ export default function EventBlock(props) {
updateValues('presenter', v);
};
const handleVisibleToggle = (v) => {
// setVisible(previousState => !previousState);
updateValues('isPublic', !data.isPublic);
};
return (
<div className={selected ? style.eventRowActive : style.eventRow}>
<span className={style.drag}>
@@ -110,8 +114,8 @@ export default function EventBlock(props) {
</div>
<div className={style.actionOverlay}>
<VisibleIconBtn
clickhandler={() => setVisible(!visible)}
active={visible || undefined}
clickhandler={handleVisibleToggle}
active={data.isPublic}
/>
<DeleteIconBtn clickhandler={deleteHandler} />
<ActionButtons
+39 -4
View File
@@ -5,6 +5,7 @@ import { useSocket } from '../../../app/context/socketContext';
import tinykeys from 'tinykeys';
import Empty from '../../../common/state/Empty';
import EventListItem from './EventListItem';
import { AnimatePresence, motion } from 'framer-motion';
export default function EventList(props) {
const { events, eventsHandler } = props;
@@ -78,14 +79,38 @@ export default function EventList(props) {
return <Empty text='No Events' />;
}
// motion
const cursorVariants = {
hidden: {
scale: 0,
},
visible: {
scale: 1,
transition: {
duration: 0.3,
},
},
exit: {
scale: 0,
},
};
console.log('EventList: events in event list', events);
let cumulativeDelay = 0;
console.log('debug next id', next)
return (
<div className={style.eventContainer}>
{cursor === -1 && <div className={style.cursor} />}
<AnimatePresence>
{cursor === -1 && (
<motion.div
className={style.cursor}
variants={cursorVariants}
initial='hidden'
animate='visible'
exit='exit'
/>
)}
</AnimatePresence>
{events.map((e, index) => {
if (e.type === 'delay') cumulativeDelay += e.duration;
@@ -101,7 +126,17 @@ export default function EventList(props) {
eventsHandler={eventsHandler}
delay={cumulativeDelay}
/>
{cursor === index && <div className={style.cursor} />}
<AnimatePresence>
{cursor === index && (
<motion.div
className={style.cursor}
variants={cursorVariants}
initial='hidden'
animate='visible'
exit='exit'
/>
)}
</AnimatePresence>
</div>
);
})}
@@ -21,6 +21,7 @@ export default function EventListWrapper() {
eventsNamespace,
fetchAllEvents
);
const addEvent = useMutation(requestPost, {
// we optimistically update here
onMutate: async (newEvent) => {
@@ -29,10 +30,13 @@ export default function EventListWrapper() {
// Snapshot the previous value
let previousEvents = queryClient.getQueryData(eventsNamespace);
console.log('debug', previousEvents)
if (previousEvents == null) {
await queryClient.refetchQueries();
refetch();
previousEvents = queryClient.getQueryData(eventsNamespace);
}
console.log('debug 2', previousEvents)
// optimistically update object, temp ID until refetch
let optimistic = [...previousEvents];
optimistic.splice(newEvent.order, 0, {
@@ -22,4 +22,6 @@
background-color: #ff7597;
border-radius: 2px;
margin: 0 auto;
/* transition: 1s;
transition-property: all; */
}
@@ -21,7 +21,14 @@ export default function PreviewContainer() {
<div className={styles.previewItem}>
<IFrameLoader title='Audience' src={`${serverURL}/public`} />
<div className={styles.label}>Audience</div>
<a
href={`${serverURL}/public`}
target='_blank'
rel='noreferrer'
className={styles.label}
>
Audience
</a>
</div>
<div className={styles.previewItem}>
@@ -4,6 +4,8 @@ import style from './StageManager.module.css';
import Paginator from '../../../common/components/views/Paginator';
import NavLogo from '../../../common/components/nav/NavLogo';
import { useEffect, useState } from 'react';
import { AnimatePresence, motion } from 'framer-motion';
import TitleSide from '../../../common/components/views/TitleSide';
export default function StageManager(props) {
const { publ, title, time, backstageEvents, selectedId, general } = props;
@@ -39,28 +41,69 @@ export default function StageManager(props) {
? formatDisplay(time.currentSeconds, true)
: '';
// motion
const titleVariants = {
hidden: {
x: -1500,
},
visible: {
x: 0,
transition: {
duration: 1,
},
},
exit: {
x: -1500,
},
};
return (
<div className={style.container__gray}>
<NavLogo />
<div className={style.eventTitle}>{general.title}</div>
{title.showNow && (
<div className={style.nowContainer}>
<div className={style.label}>Now</div>
<div className={style.nowTitle}>{title.titleNow}</div>
<div className={style.nowSubtitle}>{title.subtitleNow}</div>
<div className={style.nowPresenter}>{title.presenterNow}</div>
</div>
)}
{title.showNext && (
<div className={style.nextContainer}>
<div className={style.label}>Next</div>
<div className={style.nextTitle}>{title.titleNext}</div>
<div className={style.nextSubtitle}>{title.subtitleNext}</div>
<div className={style.nextPresenter}>{title.presenterNext}</div>
</div>
)}
<AnimatePresence>
{title.showNow && (
<motion.div
className={style.nowContainer}
key='now'
variants={titleVariants}
initial='hidden'
animate='visible'
exit='exit'
>
<TitleSide
label='Now'
type='now'
title={title.titleNow}
subtitle={title.subtitleNow}
presenter={title.presenterNow}
/>
</motion.div>
)}
</AnimatePresence>
<AnimatePresence>
{title.showNext && (
<motion.div
className={style.nextContainer}
key='next'
variants={titleVariants}
initial='hidden'
animate='visible'
exit='exit'
>
<TitleSide
label='Next'
type='next'
title={title.titleNext}
subtitle={title.subtitleNext}
presenter={title.presenterNext}
/>
</motion.div>
)}
</AnimatePresence>
<div className={style.todayContainer}>
<div className={style.label}>Today</div>
@@ -113,47 +113,6 @@
border-radius: 0 2vw 2vw 0;
}
.nowTitle,
.nextTitle {
color: #ddd;
font-weight: 400;
}
.nowSubtitle,
.nowPresenter,
.nextSubtitle,
.nextPresenter {
color: #aaa;
}
.nowTitle {
font-size: 2.5vw;
}
.nowSubtitle,
.nowPresenter {
font-size: 2vw;
}
.nextTitle {
font-size: 2vw;
}
.nextSubtitle,
.nextPresenter {
color: #aaa;
font-size: 1.5vw;
}
.nowTitle:after,
.nowSubtitle:after,
.nowPresenter:after,
.nextTitle:after,
.nextSubtitle:after,
.nextPresenter:after {
content: '\200b';
}
/* =================== SCHEDULE ===================*/
.todayContainer {
+59 -16
View File
@@ -2,6 +2,8 @@ import QRCode from 'react-qr-code';
import style from './Public.module.css';
import Paginator from '../../../common/components/views/Paginator';
import NavLogo from '../../../common/components/nav/NavLogo';
import { AnimatePresence, motion } from 'framer-motion';
import TitleSide from '../../../common/components/views/TitleSide';
export default function StageManager(props) {
const { publ, title, time, events, selectedId, general } = props;
@@ -9,28 +11,69 @@ export default function StageManager(props) {
// Format messages
const showPubl = publ.text !== '' && publ.visible;
// motion
const titleVariants = {
hidden: {
x: -1500,
},
visible: {
x: 0,
transition: {
duration: 1,
},
},
exit: {
x: -1500,
},
};
return (
<div className={style.container__gray}>
<NavLogo />
<div className={style.eventTitle}>{general.title}</div>
{title.showNow && (
<div className={style.nowContainer}>
<div className={style.label}>Now</div>
<div className={style.nowTitle}>{title.titleNow}</div>
<div className={style.nowSubtitle}>{title.subtitleNow}</div>
<div className={style.nowPresenter}>{title.presenterNow}</div>
</div>
)}
{title.showNext && (
<div className={style.nextContainer}>
<div className={style.label}>Next</div>
<div className={style.nextTitle}>{title.titleNext}</div>
<div className={style.nextSubtitle}>{title.subtitleNext}</div>
<div className={style.nextPresenter}>{title.presenterNext}</div>
</div>
)}
<AnimatePresence>
{title.showNow && (
<motion.div
className={style.nowContainer}
key='now'
variants={titleVariants}
initial='hidden'
animate='visible'
exit='exit'
>
<TitleSide
label='Now'
type='now'
title={title.titleNow}
subtitle={title.subtitleNow}
presenter={title.presenterNow}
/>
</motion.div>
)}
</AnimatePresence>
<AnimatePresence>
{title.showNext && (
<motion.div
className={style.nextContainer}
key='next'
variants={titleVariants}
initial='hidden'
animate='visible'
exit='exit'
>
<TitleSide
label='Next'
type='next'
title={title.titleNext}
subtitle={title.subtitleNext}
presenter={title.presenterNext}
/>
</motion.div>
)}
</AnimatePresence>
<div className={style.todayContainer}>
<div className={style.label}>Today</div>
@@ -112,47 +112,6 @@
border-radius: 0 2vw 2vw 0;
}
.nowTitle,
.nextTitle {
color: #ddd;
font-weight: 400;
}
.nowSubtitle,
.nowPresenter,
.nextSubtitle,
.nextPresenter {
color: #aaa;
}
.nowTitle {
font-size: 2.5vw;
}
.nowSubtitle,
.nowPresenter {
font-size: 2vw;
}
.nextTitle {
font-size: 2vw;
}
.nextSubtitle,
.nextPresenter {
color: #aaa;
font-size: 1.5vw;
}
.nowTitle:after,
.nowSubtitle:after,
.nowPresenter:after,
.nextTitle:after,
.nextSubtitle:after,
.nextPresenter:after {
content: '\200b';
}
/* =================== SCHEDULE ===================*/
.todayContainer {
@@ -1,6 +1,8 @@
import { AnimatePresence, motion } from 'framer-motion';
import Countdown from '../../../common/components/countdown/Countdown';
import MyProgressBar from '../../../common/components/myProgressBar/MyProgressBar';
import NavLogo from '../../../common/components/nav/NavLogo';
import TitleCard from '../../../common/components/views/TitleCard';
import style from './PresenterView.module.css';
export default function PresenterView(props) {
@@ -9,6 +11,22 @@ export default function PresenterView(props) {
const showOverlay = pres.text !== '' && pres.visible;
const isPlaying = time.playstate === 'start';
// motion
const titleVariants = {
hidden: {
y: 500,
},
visible: {
y: 0,
transition: {
duration: 1,
},
},
exit: {
y: 500,
},
};
return (
<div
className={
@@ -54,23 +72,45 @@ export default function PresenterView(props) {
</div>
)}
{title.showNow && (
<div className={style.nowContainer}>
<div className={style.label}>Now</div>
<div className={style.title}>{title.titleNow}</div>
<div className={style.subtitle}>{title.subtitleNow}</div>
<div className={style.presenter}>{title.presenterNow}</div>
</div>
)}
<AnimatePresence>
{title.showNow && (
<motion.div
className={style.nowContainer}
key='now'
variants={titleVariants}
initial='hidden'
animate='visible'
exit='exit'
>
<TitleCard
label='Now'
title={title.titleNow}
subtitle={title.subtitleNow}
presenter={title.presenterNow}
/>
</motion.div>
)}
</AnimatePresence>
{title.showNext && (
<div className={style.nextContainer}>
<div className={style.label}>Next</div>
<div className={style.title}>{title.titleNext}</div>
<div className={style.subtitle}>{title.subtitleNext}</div>
<div className={style.presenter}>{title.presenterNext}</div>
</div>
)}
<AnimatePresence>
{title.showNext && (
<motion.div
className={style.nextContainer}
key='next'
variants={titleVariants}
initial='hidden'
animate='visible'
exit='exit'
>
<TitleCard
label='Next'
title={title.titleNext}
subtitle={title.subtitleNext}
presenter={title.presenterNext}
/>
</motion.div>
)}
</AnimatePresence>
</div>
);
}
@@ -57,32 +57,6 @@
grid-area: next;
}
.title,
.subtitle,
.presenter {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.title {
color: #ddd;
font-size: 2.5vw;
flex: 1;
}
.subtitle,
.presenter {
color: #aaa;
font-size: 2vw;
}
.title:after,
.presenter:after,
.subtitle:after {
content: '\200b';
}
/* =================== MAIN ===================*/
.timerContainer,
@@ -111,11 +85,13 @@
width: 80%;
margin: 0 auto;
opacity: 1;
transition: 0.5s;
}
.countdownPaused,
.progressContainerPaused {
opacity: 0.6;
transition: 0.5s;
}
.container__grayFinished {