mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-08 15:59:16 +00:00
feat: stage manager view
small fixes in other components - message control fields have value from socket - added millis to string
This commit is contained in:
@@ -1,16 +1,7 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
import { formatDisplay } from '../../dateConfig';
|
||||||
import styles from './Countdown.module.css';
|
import styles from './Countdown.module.css';
|
||||||
|
|
||||||
function formatDisplay(seconds, hideZero) {
|
|
||||||
const format = (val) => `0${Math.floor(val)}`.slice(-2);
|
|
||||||
const hours = seconds / 3600;
|
|
||||||
const minutes = (seconds % 3600) / 60;
|
|
||||||
|
|
||||||
if (hideZero && hours < 1)
|
|
||||||
return [minutes, seconds % 60].map(format).join(':');
|
|
||||||
else return [hours, minutes, seconds % 60].map(format).join(':');
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function Countdown(props) {
|
export default function Countdown(props) {
|
||||||
const { time, small, hideZeroHours } = props;
|
const { time, small, hideZeroHours } = props;
|
||||||
const [clock, setClock] = useState(time);
|
const [clock, setClock] = useState(time);
|
||||||
|
|||||||
@@ -20,6 +20,17 @@ export const stringFromMillis = (
|
|||||||
: `${parseInt(hours) ? `${hours}` : '00'}${delim}${minutes}`;
|
: `${parseInt(hours) ? `${hours}` : '00'}${delim}${minutes}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// another go at simpler string formatting (counters)
|
||||||
|
export function formatDisplay(seconds, hideZero) {
|
||||||
|
const format = (val) => `0${Math.floor(val)}`.slice(-2);
|
||||||
|
const hours = seconds / 3600;
|
||||||
|
const minutes = (seconds % 3600) / 60;
|
||||||
|
|
||||||
|
if (hideZero && hours < 1)
|
||||||
|
return [minutes, seconds % 60].map(format).join(':');
|
||||||
|
else return [hours, minutes, seconds % 60].map(format).join(':');
|
||||||
|
}
|
||||||
|
|
||||||
// millis to seconds
|
// millis to seconds
|
||||||
export const millisToSeconds = (millis) => {
|
export const millisToSeconds = (millis) => {
|
||||||
return Math.floor(millis / 1000);
|
return Math.floor(millis / 1000);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ export default function MessageControl() {
|
|||||||
|
|
||||||
// Handle presenter messages
|
// Handle presenter messages
|
||||||
socket.on('messages-presenter', (data) => {
|
socket.on('messages-presenter', (data) => {
|
||||||
|
console.log('debug: stting data', data);
|
||||||
setPres({ ...data });
|
setPres({ ...data });
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -52,6 +53,8 @@ export default function MessageControl() {
|
|||||||
};
|
};
|
||||||
}, [socket]);
|
}, [socket]);
|
||||||
|
|
||||||
|
console.log('debug', pres);
|
||||||
|
|
||||||
const messageControl = async (action, payload) => {
|
const messageControl = async (action, payload) => {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 'pres-text':
|
case 'pres-text':
|
||||||
@@ -84,9 +87,8 @@ export default function MessageControl() {
|
|||||||
<span className={style.label}>Presenter screen message</span>
|
<span className={style.label}>Presenter screen message</span>
|
||||||
<div className={style.inputItems}>
|
<div className={style.inputItems}>
|
||||||
<Editable
|
<Editable
|
||||||
onChange={(event) =>
|
onChange={(event) => messageControl('pres-text', event)}
|
||||||
messageControl('pres-text', event)
|
value={pres.text}
|
||||||
}
|
|
||||||
placeholder='only the presenter screens see this'
|
placeholder='only the presenter screens see this'
|
||||||
className={style.inline}
|
className={style.inline}
|
||||||
>
|
>
|
||||||
@@ -105,10 +107,9 @@ export default function MessageControl() {
|
|||||||
<span className={style.label}>Public screen message</span>
|
<span className={style.label}>Public screen message</span>
|
||||||
<div className={style.inputItems}>
|
<div className={style.inputItems}>
|
||||||
<Editable
|
<Editable
|
||||||
onChange={(event) =>
|
onChange={(event) => messageControl('publ-text', event)}
|
||||||
messageControl('publ-text', event)
|
value={publ.text}
|
||||||
}
|
placeholder='public screens will render this'
|
||||||
placeholder='all screens will render this'
|
|
||||||
className={style.inline}
|
className={style.inline}
|
||||||
>
|
>
|
||||||
<EditablePreview />
|
<EditablePreview />
|
||||||
@@ -126,9 +127,8 @@ export default function MessageControl() {
|
|||||||
<span className={style.label}>Lower third message</span>
|
<span className={style.label}>Lower third message</span>
|
||||||
<div className={style.inputItems}>
|
<div className={style.inputItems}>
|
||||||
<Editable
|
<Editable
|
||||||
onChange={(event) =>
|
onChange={(event) => messageControl('lower-text', event)}
|
||||||
messageControl('lower-text', event)
|
value={lower.text}
|
||||||
}
|
|
||||||
placeholder='visible in lower third screen'
|
placeholder='visible in lower third screen'
|
||||||
className={style.inline}
|
className={style.inline}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,25 +1,31 @@
|
|||||||
import QRCode from 'react-qr-code';
|
import QRCode from 'react-qr-code';
|
||||||
|
import { formatDisplay } from '../../../common/dateConfig';
|
||||||
import style from './StageManager.module.css';
|
import style from './StageManager.module.css';
|
||||||
|
|
||||||
export default function StageManager() {
|
export default function StageManager(props) {
|
||||||
|
const { pres, publ, lower, title, time } = props;
|
||||||
|
|
||||||
|
const showPubl = publ.text !== '' && publ.visible;
|
||||||
|
const stageTimer =
|
||||||
|
time.currentSeconds != null && !isNaN(time.currentSeconds)
|
||||||
|
? formatDisplay(time.currentSeconds, true)
|
||||||
|
: '';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={style.container__gray}>
|
<div className={style.container__gray}>
|
||||||
<div className={style.eventTitle}>Todays event name</div>
|
<div className={style.eventTitle}>A hamburger life</div>
|
||||||
|
|
||||||
<div className={style.nowContainer}>
|
<div className={style.nowContainer}>
|
||||||
<div className={style.label}>Now</div>
|
<div className={style.label}>Now</div>
|
||||||
<div className={style.nowTitle}>Are hamburguers real</div>
|
<div className={style.nowTitle}>{title.titleNow}</div>
|
||||||
<div className={style.nowSubtitle}>A day in the life....</div>
|
<div className={style.nowSubtitle}>{title.subtitleNow}</div>
|
||||||
<div className={style.nowPresenter}>Carlos Valente</div>
|
<div className={style.nowPresenter}>{title.presenterNow}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={style.nextContainer}>
|
<div className={style.nextContainer}>
|
||||||
<div className={style.label}>Up Next</div>
|
<div className={style.label}>Next</div>
|
||||||
<div className={style.nextTitle}>Up to midnight</div>
|
<div className={style.nextTitle}>{title.titleNext}</div>
|
||||||
<div className={style.nextSubtitle}></div>
|
<div className={style.nextSubtitle}>{title.subtitleNext}</div>
|
||||||
<div className={style.nextPresenter}>Veronica</div>
|
<div className={style.nextPresenter}>{title.presenterNext}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={style.todayContainer}>
|
<div className={style.todayContainer}>
|
||||||
<div className={style.label}>Today</div>
|
<div className={style.label}>Today</div>
|
||||||
<div className={style.entries}>
|
<div className={style.entries}>
|
||||||
@@ -56,14 +62,23 @@ export default function StageManager() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className={
|
||||||
|
showPubl ? style.publicContainer : style.publicContainerHidden
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div className={style.label}>Public message</div>
|
||||||
|
<div className={style.message}>{publ.text}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className={style.clockContainer}>
|
<div className={style.clockContainer}>
|
||||||
<div className={style.label}>Time Now</div>
|
<div className={style.label}>Time Now</div>
|
||||||
<div className={style.clock}>11:00:23</div>
|
<div className={style.clock}>{time.clock}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={style.countdownContainer}>
|
<div className={style.countdownContainer}>
|
||||||
<div className={style.label}>Countdown</div>
|
<div className={style.label}>Stage Timer</div>
|
||||||
<div className={style.clock}>00:23</div>
|
<div className={style.clock}>{stageTimer}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={style.infoContainer}>
|
<div className={style.infoContainer}>
|
||||||
|
|||||||
@@ -1,20 +1,26 @@
|
|||||||
.container__gray,
|
.container__gray,
|
||||||
.container__grayFinished {
|
.container__grayFinished {
|
||||||
|
margin: 0;
|
||||||
|
box-sizing: border-box; /* reset */
|
||||||
|
overflow: hidden;
|
||||||
|
width: 100%; /* restrict the page width to viewport */
|
||||||
|
|
||||||
background: linear-gradient(90deg, #252525 0%, #121212 100%);
|
background: linear-gradient(90deg, #252525 0%, #121212 100%);
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
color: #fffd;
|
color: #fffd;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr 1fr 3vw 2fr 1vw;
|
grid-template-columns: 1fr 1fr 1fr 3vw 2fr;
|
||||||
grid-template-rows: 5vh 1fr 1fr 1fr 1fr 1fr;
|
grid-template-rows: 2fr 1fr 1fr 0 1fr;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
' titl titl titl . schd .'
|
' titl titl titl . schd'
|
||||||
' titl titl titl . schd .'
|
' now now now . schd'
|
||||||
' now now now . schd .'
|
' next next .... . schd'
|
||||||
' next next .... . schd .'
|
' ... .... .... . ....'
|
||||||
' .... .... .... . info .'
|
' publ publ time . info'
|
||||||
' time clck pres . info .';
|
' publ publ clck . info';
|
||||||
gap: 1vw;
|
gap: 1vw;
|
||||||
|
padding: 1vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
@@ -24,23 +30,41 @@
|
|||||||
|
|
||||||
.eventTitle {
|
.eventTitle {
|
||||||
grid-area: titl;
|
grid-area: titl;
|
||||||
font-size: 5vw;
|
font-size: 4vw;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
padding-top: 0.2vh;
|
padding-top: 0.2vh;
|
||||||
padding-left: 2vw;
|
padding-left: 1vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =================== TITLES ===================*/
|
/* =================== TITLES ===================*/
|
||||||
|
|
||||||
.nowContainer,
|
.nowContainer,
|
||||||
.nextContainer,
|
.nextContainer,
|
||||||
.todayContainer,
|
.todayContainer {
|
||||||
.clockContainer,
|
|
||||||
.countdownContainer {
|
|
||||||
background-color: rgba(255, 255, 255, 0.05);
|
background-color: rgba(255, 255, 255, 0.05);
|
||||||
padding: 1vh 2vw;
|
padding: 1vh 2vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.clockContainer,
|
||||||
|
.countdownContainer,
|
||||||
|
.publicContainer,
|
||||||
|
.publicContainerHidden {
|
||||||
|
background-color: rgba(255, 255, 255, 0.05);
|
||||||
|
padding: 1vh 1vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.publicContainer {
|
||||||
|
opacity: 1;
|
||||||
|
transition: 0.5s;
|
||||||
|
transition-property: opacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
.publicContainerHidden {
|
||||||
|
opacity: 0;
|
||||||
|
transition: 0.5s;
|
||||||
|
transition-property: opacity;
|
||||||
|
}
|
||||||
|
|
||||||
.todayContainer,
|
.todayContainer,
|
||||||
.infoContainer {
|
.infoContainer {
|
||||||
background-color: rgba(255, 255, 255, 0.07);
|
background-color: rgba(255, 255, 255, 0.07);
|
||||||
@@ -48,16 +72,28 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.infoContainer,
|
.infoContainer,
|
||||||
.todayContainer {
|
.todayContainer,
|
||||||
|
.publicContainer,
|
||||||
|
.publicContainerHidden {
|
||||||
border-radius: 1vw;
|
border-radius: 1vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nowContainer,
|
||||||
|
.nextContainer {
|
||||||
|
margin-left: -1vw;
|
||||||
|
}
|
||||||
|
|
||||||
.nowContainer {
|
.nowContainer {
|
||||||
background-color: rgba(255, 255, 255, 0.09);
|
background-color: rgba(255, 255, 255, 0.09);
|
||||||
|
|
||||||
grid-area: now;
|
grid-area: now;
|
||||||
border-radius: 0 2vw 2vw 0;
|
border-radius: 0 2vw 2vw 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.publicContainer,
|
||||||
|
.publicContainerHidden {
|
||||||
|
grid-area: publ;
|
||||||
|
}
|
||||||
|
|
||||||
.nextContainer {
|
.nextContainer {
|
||||||
grid-area: next;
|
grid-area: next;
|
||||||
border-radius: 0 2vw 2vw 0;
|
border-radius: 0 2vw 2vw 0;
|
||||||
@@ -77,22 +113,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nowTitle {
|
.nowTitle {
|
||||||
font-size: 3vw;
|
font-size: 2.5vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nowSubtitle,
|
.nowSubtitle,
|
||||||
.nowPresenter {
|
.nowPresenter {
|
||||||
font-size: 2.2vw;
|
font-size: 2vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nextTitle {
|
.nextTitle {
|
||||||
font-size: 2.5vw;
|
font-size: 2vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nextSubtitle,
|
.nextSubtitle,
|
||||||
.nextPresenter {
|
.nextPresenter {
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
font-size: 1.8vw;
|
font-size: 1.5vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =================== SCHEDULE ===================*/
|
/* =================== SCHEDULE ===================*/
|
||||||
@@ -114,9 +150,9 @@
|
|||||||
.navItem,
|
.navItem,
|
||||||
.navItemSelected {
|
.navItemSelected {
|
||||||
background-color: rgba(255, 255, 255, 0.39);
|
background-color: rgba(255, 255, 255, 0.39);
|
||||||
width: 1vw;
|
width: 0.7vw;
|
||||||
height: 1vw;
|
height: 0.7vw;
|
||||||
border-radius: 1vw;
|
border-radius: 0.35vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navItemSelected {
|
.navItemSelected {
|
||||||
@@ -143,7 +179,9 @@
|
|||||||
|
|
||||||
.entryPast {
|
.entryPast {
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
|
font-size: 1.2vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.entryFuture {
|
.entryFuture {
|
||||||
color: #ddd;
|
color: #ddd;
|
||||||
}
|
}
|
||||||
@@ -153,17 +191,19 @@
|
|||||||
line-height: 7vh;
|
line-height: 7vh;
|
||||||
background-color: rgba(255, 255, 255, 0.09);
|
background-color: rgba(255, 255, 255, 0.09);
|
||||||
border-bottom: 0.5vh solid #ff7597aa;
|
border-bottom: 0.5vh solid #ff7597aa;
|
||||||
|
margin-left: -0.5vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =================== OVERLAY ===================*/
|
/* =================== OVERLAY ===================*/
|
||||||
|
|
||||||
.message {
|
.message {
|
||||||
grid-area: pres;
|
font-size: 3vw;
|
||||||
|
line-height: 3vw;
|
||||||
|
padding: 0.5vh 0 0.5vh 1vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.infoContainer {
|
.infoContainer {
|
||||||
grid-area: info;
|
grid-area: info;
|
||||||
margin-bottom: 2vh;
|
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|
||||||
grid-template-columns: 3fr 1fr;
|
grid-template-columns: 3fr 1fr;
|
||||||
@@ -187,18 +227,17 @@
|
|||||||
|
|
||||||
.clockContainer {
|
.clockContainer {
|
||||||
grid-area: time;
|
grid-area: time;
|
||||||
margin-bottom: 2vh;
|
border-radius: 1vw 1vw 0 0;
|
||||||
border-radius: 1vw 0 0 1vw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.countdownContainer {
|
.countdownContainer {
|
||||||
grid-area: clck;
|
grid-area: clck;
|
||||||
margin-bottom: 2vh;
|
border-radius: 0 0 1vw 1vw;
|
||||||
border-radius: 0 1vw 1vw 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.clock {
|
.clock {
|
||||||
font-size: 3vw;
|
font-size: 3vw;
|
||||||
|
line-height: 3vw;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
letter-spacing: 0.25vw;
|
letter-spacing: 0.25vw;
|
||||||
color: #ddd;
|
color: #ddd;
|
||||||
|
|||||||
Reference in New Issue
Block a user