Skip to content

Commit c6910d9

Browse files
committed
wip: prepare counter components
1 parent 2e9ff13 commit c6910d9

File tree

4 files changed

+58
-4
lines changed

4 files changed

+58
-4
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { RundownUtils } from '../rundown'
2+
3+
interface OverUnderProps {
4+
value: number
5+
}
6+
7+
export const OverUnderClockComponent = (props: OverUnderProps): JSX.Element => {
8+
const overUnder = props.value > 0 ? 'Over' : 'Under'
9+
return (
10+
<div className="counter-component__over-under-clock">
11+
<span>{overUnder}</span>
12+
<span>
13+
{RundownUtils.formatDiffToTimecode(props.value, true, false, true, true, true, undefined, true, true)}
14+
</span>
15+
</div>
16+
)
17+
}
18+
19+
export const PlannedEndComponent = (props: OverUnderProps): JSX.Element => {
20+
return (
21+
<span className="counter-component__planned-end">
22+
{RundownUtils.formatTimeToTimecode({ frameRate: 25 }, props.value, true)}
23+
</span>
24+
)
25+
}
26+
27+
export const TimeToPlannedEndComponent = (props: OverUnderProps): JSX.Element => {
28+
return (
29+
<span className="counter-component__time-to-planned-end">
30+
{RundownUtils.formatTimeToTimecode({ frameRate: 25 }, props.value, true)}
31+
</span>
32+
)
33+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.counter-component__over-under {
2+
background-color: aqua;
3+
}
4+
5+
.counter-component__planned-end {
6+
background-color: purple;
7+
}
8+
9+
.counter-component__time-to-planned-end {
10+
background-color: pink;
11+
}

packages/webui/src/client/styles/main.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ input {
4949
@import 'countdown/overlay';
5050
@import 'countdown/presenter';
5151
@import 'countdown/director';
52+
@import 'counterComponents';
5253

5354
@import 'customizations/nrk/shelf/taPanel';
5455

packages/webui/src/client/ui/ClockView/DirectorScreen.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ import { useSetDocumentClass } from '../util/useSetDocumentClass'
3636
import { useRundownAndShowStyleIdsForPlaylist } from '../util/useRundownAndShowStyleIdsForPlaylist'
3737
import { RundownPlaylistClientUtil } from '../../lib/rundownPlaylistUtil'
3838
import { CurrentPartOrSegmentRemaining } from '../RundownView/RundownTiming/CurrentPartOrSegmentRemaining'
39+
import {
40+
OverUnderClockComponent,
41+
PlannedEndComponent,
42+
TimeToPlannedEndComponent,
43+
} from '../../lib/Components/CounterComponents'
3944

4045
interface SegmentUi extends DBSegment {
4146
items: Array<PartUi>
@@ -345,7 +350,7 @@ function DirectorScreenRender({
345350
timingDurations.remainingBudgetOnCurrentSegment ?? timingDurations.remainingTimeOnCurrentPart ?? 0
346351

347352
const expectedStart = PlaylistTiming.getExpectedStart(playlist.timing)
348-
const expectedEnd = PlaylistTiming.getExpectedEnd(playlist.timing)
353+
const expectedEnd = PlaylistTiming.getExpectedEnd(playlist.timing) || 0
349354
const expectedDuration = PlaylistTiming.getExpectedDuration(playlist.timing)
350355

351356
const overUnderClock = getPlaylistTimingDiff(playlist, timingDurations) ?? 0
@@ -354,11 +359,15 @@ function DirectorScreenRender({
354359
<div className="director-screen">
355360
<div className="director-screen__header">
356361
<div className="director-screen__header__planned-end">
357-
<div>{RundownUtils.formatTimeToTimecode({ frameRate: 25 }, expectedEnd || 0, true)}</div>
362+
<div>
363+
<PlannedEndComponent value={expectedEnd} />
364+
</div>
358365
PLANNED END
359366
</div>
360367
<div className="director-screen__header__planned-duration">
361-
<div>{RundownUtils.formatTimeToTimecode({ frameRate: 25 }, expectedDuration || 0, true)}</div>
368+
<div>
369+
<TimeToPlannedEndComponent value={expectedEnd - overUnderClock} />
370+
</div>
362371
TIME TO PLANNED END
363372
</div>
364373
<div className="director-screen__header__over-under">
@@ -367,7 +376,7 @@ function DirectorScreenRender({
367376
over: Math.floor(overUnderClock / 1000) >= 0,
368377
})}
369378
>
370-
{RundownUtils.formatDiffToTimecode(overUnderClock, true, false, true, true, true, undefined, true, true)}
379+
<OverUnderClockComponent value={overUnderClock} />
371380
</div>
372381
OVER/UNDER
373382
</div>

0 commit comments

Comments
 (0)