From 8b70fc247a607b7acef54ba3e9f9c61d26656427 Mon Sep 17 00:00:00 2001 From: cv <34649812+cpvalente@users.noreply.github.com> Date: Sun, 18 Apr 2021 19:20:11 +0200 Subject: [PATCH] feat: stage manager view small fixes in other components - message control fields have value from socket - added millis to string --- .../common/components/countdown/Countdown.jsx | 11 +-- client/src/common/dateConfig.js | 11 +++ .../src/features/control/MessageControl.jsx | 20 ++-- .../viewers/backstage/StageManager.jsx | 45 ++++++--- .../viewers/backstage/StageManager.module.css | 95 +++++++++++++------ 5 files changed, 119 insertions(+), 63 deletions(-) diff --git a/client/src/common/components/countdown/Countdown.jsx b/client/src/common/components/countdown/Countdown.jsx index 38e5cb451..8f1f3a3e9 100644 --- a/client/src/common/components/countdown/Countdown.jsx +++ b/client/src/common/components/countdown/Countdown.jsx @@ -1,16 +1,7 @@ import { useEffect, useState } from 'react'; +import { formatDisplay } from '../../dateConfig'; 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) { const { time, small, hideZeroHours } = props; const [clock, setClock] = useState(time); diff --git a/client/src/common/dateConfig.js b/client/src/common/dateConfig.js index 0af90de25..a89197bc0 100644 --- a/client/src/common/dateConfig.js +++ b/client/src/common/dateConfig.js @@ -20,6 +20,17 @@ export const stringFromMillis = ( : `${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 export const millisToSeconds = (millis) => { return Math.floor(millis / 1000); diff --git a/client/src/features/control/MessageControl.jsx b/client/src/features/control/MessageControl.jsx index 93eb169e4..bb9c8eb9e 100644 --- a/client/src/features/control/MessageControl.jsx +++ b/client/src/features/control/MessageControl.jsx @@ -28,6 +28,7 @@ export default function MessageControl() { // Handle presenter messages socket.on('messages-presenter', (data) => { + console.log('debug: stting data', data); setPres({ ...data }); }); @@ -52,6 +53,8 @@ export default function MessageControl() { }; }, [socket]); + console.log('debug', pres); + const messageControl = async (action, payload) => { switch (action) { case 'pres-text': @@ -84,9 +87,8 @@ export default function MessageControl() { Presenter screen message
- messageControl('pres-text', event) - } + onChange={(event) => messageControl('pres-text', event)} + value={pres.text} placeholder='only the presenter screens see this' className={style.inline} > @@ -105,10 +107,9 @@ export default function MessageControl() { Public screen message
- messageControl('publ-text', event) - } - placeholder='all screens will render this' + onChange={(event) => messageControl('publ-text', event)} + value={publ.text} + placeholder='public screens will render this' className={style.inline} > @@ -126,9 +127,8 @@ export default function MessageControl() { Lower third message
- messageControl('lower-text', event) - } + onChange={(event) => messageControl('lower-text', event)} + value={lower.text} placeholder='visible in lower third screen' className={style.inline} > diff --git a/client/src/features/viewers/backstage/StageManager.jsx b/client/src/features/viewers/backstage/StageManager.jsx index b6ba3de2e..4f4caab7e 100644 --- a/client/src/features/viewers/backstage/StageManager.jsx +++ b/client/src/features/viewers/backstage/StageManager.jsx @@ -1,25 +1,31 @@ import QRCode from 'react-qr-code'; +import { formatDisplay } from '../../../common/dateConfig'; 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 (
-
Todays event name
- +
A hamburger life
Now
-
Are hamburguers real
-
A day in the life....
-
Carlos Valente
+
{title.titleNow}
+
{title.subtitleNow}
+
{title.presenterNow}
-
-
Up Next
-
Up to midnight
-
-
Veronica
+
Next
+
{title.titleNext}
+
{title.subtitleNext}
+
{title.presenterNext}
-
Today
@@ -56,14 +62,23 @@ export default function StageManager() {
+
+
Public message
+
{publ.text}
+
+
Time Now
-
11:00:23
+
{time.clock}
-
Countdown
-
00:23
+
Stage Timer
+
{stageTimer}
diff --git a/client/src/features/viewers/backstage/StageManager.module.css b/client/src/features/viewers/backstage/StageManager.module.css index c69dd495d..4960ae05e 100644 --- a/client/src/features/viewers/backstage/StageManager.module.css +++ b/client/src/features/viewers/backstage/StageManager.module.css @@ -1,20 +1,26 @@ .container__gray, .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%); height: 100vh; color: #fffd; font-weight: 300; display: grid; - grid-template-columns: 1fr 1fr 1fr 3vw 2fr 1vw; - grid-template-rows: 5vh 1fr 1fr 1fr 1fr 1fr; + grid-template-columns: 1fr 1fr 1fr 3vw 2fr; + grid-template-rows: 2fr 1fr 1fr 0 1fr; grid-template-areas: - ' titl titl titl . schd .' - ' titl titl titl . schd .' - ' now now now . schd .' - ' next next .... . schd .' - ' .... .... .... . info .' - ' time clck pres . info .'; + ' titl titl titl . schd' + ' now now now . schd' + ' next next .... . schd' + ' ... .... .... . ....' + ' publ publ time . info' + ' publ publ clck . info'; gap: 1vw; + padding: 1vw; } .label { @@ -24,23 +30,41 @@ .eventTitle { grid-area: titl; - font-size: 5vw; + font-size: 4vw; font-weight: 600; padding-top: 0.2vh; - padding-left: 2vw; + padding-left: 1vw; } /* =================== TITLES ===================*/ .nowContainer, .nextContainer, -.todayContainer, -.clockContainer, -.countdownContainer { +.todayContainer { background-color: rgba(255, 255, 255, 0.05); 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, .infoContainer { background-color: rgba(255, 255, 255, 0.07); @@ -48,16 +72,28 @@ } .infoContainer, -.todayContainer { +.todayContainer, +.publicContainer, +.publicContainerHidden { border-radius: 1vw; } +.nowContainer, +.nextContainer { + margin-left: -1vw; +} + .nowContainer { background-color: rgba(255, 255, 255, 0.09); - grid-area: now; border-radius: 0 2vw 2vw 0; } + +.publicContainer, +.publicContainerHidden { + grid-area: publ; +} + .nextContainer { grid-area: next; border-radius: 0 2vw 2vw 0; @@ -77,22 +113,22 @@ } .nowTitle { - font-size: 3vw; + font-size: 2.5vw; } .nowSubtitle, .nowPresenter { - font-size: 2.2vw; + font-size: 2vw; } .nextTitle { - font-size: 2.5vw; + font-size: 2vw; } .nextSubtitle, .nextPresenter { color: #aaa; - font-size: 1.8vw; + font-size: 1.5vw; } /* =================== SCHEDULE ===================*/ @@ -114,9 +150,9 @@ .navItem, .navItemSelected { background-color: rgba(255, 255, 255, 0.39); - width: 1vw; - height: 1vw; - border-radius: 1vw; + width: 0.7vw; + height: 0.7vw; + border-radius: 0.35vw; } .navItemSelected { @@ -143,7 +179,9 @@ .entryPast { color: #aaa; + font-size: 1.2vw; } + .entryFuture { color: #ddd; } @@ -153,17 +191,19 @@ line-height: 7vh; background-color: rgba(255, 255, 255, 0.09); border-bottom: 0.5vh solid #ff7597aa; + margin-left: -0.5vw; } /* =================== OVERLAY ===================*/ .message { - grid-area: pres; + font-size: 3vw; + line-height: 3vw; + padding: 0.5vh 0 0.5vh 1vw; } .infoContainer { grid-area: info; - margin-bottom: 2vh; display: grid; grid-template-columns: 3fr 1fr; @@ -187,18 +227,17 @@ .clockContainer { grid-area: time; - margin-bottom: 2vh; - border-radius: 1vw 0 0 1vw; + border-radius: 1vw 1vw 0 0; } .countdownContainer { grid-area: clck; - margin-bottom: 2vh; - border-radius: 0 1vw 1vw 0; + border-radius: 0 0 1vw 1vw; } .clock { font-size: 3vw; + line-height: 3vw; text-align: center; letter-spacing: 0.25vw; color: #ddd;