From 1b55dbc17043dc474fdd265f55eb79d93f6e0b06 Mon Sep 17 00:00:00 2001 From: Carlos Valente <34649812+cpvalente@users.noreply.github.com> Date: Mon, 20 Nov 2023 09:53:35 +0100 Subject: [PATCH 1/5] style: clock period (#601) * style: tweaks to studio override * style: improvements to 12 hour format --- .../components/schedule/ScheduleItem.tsx | 16 ++++++++-- .../__tests__/{time.test.js => time.test.ts} | 10 +++++++ .../features/viewers/backstage/Backstage.scss | 1 + .../features/viewers/backstage/Backstage.tsx | 11 +++++-- .../src/features/viewers/clock/Clock.tsx | 8 ++--- .../superscript-time/SuperscriptTime.scss | 4 +++ .../superscript-time/SuperscriptTime.tsx | 23 +++++++++++++++ .../features/viewers/countdown/Countdown.scss | 2 ++ .../features/viewers/countdown/Countdown.tsx | 14 +++++---- .../viewers/countdown/CountdownSelect.tsx | 8 +++-- .../src/features/viewers/public/Public.scss | 1 + .../src/features/viewers/public/Public.tsx | 3 +- .../features/viewers/studio/StudioClock.scss | 29 +++++++++---------- .../src/features/viewers/timer/Timer.scss | 9 +++--- .../src/features/viewers/timer/Timer.tsx | 3 +- apps/server/src/external/styles/override.css | 5 ++++ 16 files changed, 108 insertions(+), 39 deletions(-) rename apps/client/src/common/utils/__tests__/{time.test.js => time.test.ts} (73%) create mode 100644 apps/client/src/features/viewers/common/superscript-time/SuperscriptTime.scss create mode 100644 apps/client/src/features/viewers/common/superscript-time/SuperscriptTime.tsx diff --git a/apps/client/src/common/components/schedule/ScheduleItem.tsx b/apps/client/src/common/components/schedule/ScheduleItem.tsx index af265725c..dcfabc2e2 100644 --- a/apps/client/src/common/components/schedule/ScheduleItem.tsx +++ b/apps/client/src/common/components/schedule/ScheduleItem.tsx @@ -1,7 +1,12 @@ +import SuperscriptTime from '../../../features/viewers/common/superscript-time/SuperscriptTime'; import { formatTime } from '../../utils/time'; import './Schedule.scss'; +const formatOptions = { + format: 'hh:mm a', +}; + interface ScheduleItemProps { selected: 'past' | 'now' | 'future'; timeStart: number; @@ -16,8 +21,8 @@ interface ScheduleItemProps { export default function ScheduleItem(props: ScheduleItemProps) { const { selected, timeStart, timeEnd, title, presenter, backstageEvent, colour, skip } = props; - const start = formatTime(timeStart, { format: 'hh:mm' }); - const end = formatTime(timeEnd, { format: 'hh:mm' }); + const start = formatTime(timeStart, formatOptions); + const end = formatTime(timeEnd, formatOptions); const userColour = colour !== '' ? colour : ''; const selectStyle = `entry--${selected}`; @@ -25,7 +30,12 @@ export default function ScheduleItem(props: ScheduleItemProps) {
(Component: ComponentType
) => { }, [rundownData]); // websocket data - const data = useStore(runtime); const { timer, publicMessage, timerMessage, lowerMessage, + externalMessage, playback, onAir, eventNext, @@ -64,7 +65,7 @@ const withData =
(Component: ComponentType
) => { publicEventNow, eventNow, loaded, - } = data; + } = useStore(runtime); const publicSelectedId = loaded.selectedPublicEventId; const selectedId = loaded.selectedEventId; const nextId = loaded.nextEventId; @@ -92,6 +93,7 @@ const withData =
(Component: ComponentType
) => {
pres={timerMessage}
publ={publicMessage}
lower={lowerMessage}
+ external={externalMessage}
eventNow={eventNow}
publicEventNow={publicEventNow}
eventNext={eventNext}
diff --git a/apps/client/src/features/viewers/timer/Timer.scss b/apps/client/src/features/viewers/timer/Timer.scss
index e7c3192b5..7cd00751e 100644
--- a/apps/client/src/features/viewers/timer/Timer.scss
+++ b/apps/client/src/features/viewers/timer/Timer.scss
@@ -79,6 +79,9 @@
justify-self: center;
align-self: center;
+ width: 100%;
+ overflow: hidden;
+
.end-message {
text-align: center;
font-size: 11.5vw;
@@ -90,7 +93,6 @@
.timer {
opacity: 1;
- font-size: 20vw;
font-family: var(--font-family-override, $viewer-font-family);
color: var(--timer-color-override, $timer-color);
line-height: 0.9em;
@@ -98,6 +100,9 @@
letter-spacing: 0.05em;
font-weight: 600;
+ transition-property: font-size;
+ transition-duration: $viewer-transition-time;
+
&--paused {
opacity: $viewer-opacity-disabled;
transition: $viewer-transition-time;
@@ -109,6 +114,27 @@
}
}
+ .external {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+
+ font-weight: 600;
+ text-align: center;
+ color: var(--external-color-override, $external-color);
+ letter-spacing: 0.5px;
+ line-height: 0.9em;
+ padding-bottom: 0.2em;
+ transition-property: opacity, height;
+ transition-duration: $viewer-transition-time;
+ border-top: 1px solid rgba(white, 0.1);
+
+ &--hidden {
+ opacity: 0;
+ height: 0;
+ }
+ }
+
.progress-container {
grid-area: progress;
width: 100%;
@@ -122,7 +148,6 @@
}
}
-
/* =================== OVERLAY ===================*/
.message-overlay {
diff --git a/apps/client/src/features/viewers/timer/Timer.tsx b/apps/client/src/features/viewers/timer/Timer.tsx
index 914b98328..f40f0c31e 100644
--- a/apps/client/src/features/viewers/timer/Timer.tsx
+++ b/apps/client/src/features/viewers/timer/Timer.tsx
@@ -1,6 +1,6 @@
import { useEffect } from 'react';
import { AnimatePresence, motion } from 'framer-motion';
-import { OntimeEvent, Playback, TimerMessage, TimerType, ViewSettings } from 'ontime-types';
+import { Message, OntimeEvent, Playback, TimerMessage, TimerType, ViewSettings } from 'ontime-types';
import { overrideStylesURL } from '../../../common/api/apiConstants';
import MultiPartProgressBar from '../../../common/components/multi-part-progress-bar/MultiPartProgressBar';
@@ -41,6 +41,7 @@ const titleVariants = {
interface TimerProps {
isMirrored: boolean;
pres: TimerMessage;
+ external: Message;
eventNow: OntimeEvent | null;
eventNext: OntimeEvent | null;
time: TimeManagerType;
@@ -48,10 +49,9 @@ interface TimerProps {
}
export default function Timer(props: TimerProps) {
- const { isMirrored, pres, eventNow, eventNext, time, viewSettings } = props;
+ const { isMirrored, pres, eventNow, eventNext, time, viewSettings, external } = props;
const { shouldRender } = useRuntimeStylesheet(viewSettings?.overrideStyles && overrideStylesURL);
const { getLocalizedString } = useTranslation();
-
useEffect(() => {
document.title = 'ontime - Timer';
}, []);
@@ -78,6 +78,7 @@ export default function Timer(props: TimerProps) {
const showBlinking = pres.timerBlink;
const showBlackout = pres.timerBlackout;
const showClock = time.timerType !== TimerType.Clock;
+ const showExternal = external.visible && external.text;
const timerColor =
showProgress && showDanger
@@ -94,7 +95,13 @@ export default function Timer(props: TimerProps) {
}
const baseClasses = `stage-timer ${isMirrored ? 'mirror' : ''} ${showBlackout ? 'blackout' : ''}`;
- const timerFontSize = 89 / (stageTimerCharacters - 1);
+ let timerFontSize = 89 / (stageTimerCharacters - 1);
+ // we need to shrink the timer if the external is going to be there
+ if (showExternal) {
+ timerFontSize *= 0.8;
+ }
+ const externalFontSize = timerFontSize * 0.4
+ const timerContainerClasses = `timer-container ${showBlinking ? (showOverlay ? '' : 'blink') : ''}`;
const timerClasses = `timer ${!isPlaying ? 'timer--paused' : ''} ${showFinished ? 'timer--finished' : ''}`;
return (
@@ -110,7 +117,7 @@ export default function Timer(props: TimerProps) {