Skip to content

Commit 8474080

Browse files
committed
wip: implement adjustable label length and size
1 parent 283dfb5 commit 8474080

File tree

3 files changed

+51
-21
lines changed

3 files changed

+51
-21
lines changed

packages/webui/src/client/styles/countdown/director.scss

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,28 @@ $hold-status-color: $liveline-timecode-color;
1616
.director-screen {
1717
font-family: Roboto Flex;
1818

19-
.director-screen__header {
19+
.director-screen__top {
20+
position: fixed;
21+
top: 0;
22+
left: 0;
23+
right: 0;
24+
height: 14vh;
25+
padding-left: 10px;
2026
display: flex;
2127
flex-direction: row;
2228
justify-content: space-between;
2329
align-items: center;
24-
font-size: 2em;
30+
background-color: #3F3F3F;
2531
color: #888;
32+
font-size: 2em;
2633
padding: 0 0.2em;
27-
padding-left: 10px;
2834

2935
}
3036

3137

3238
.director-screen__body {
3339
position: fixed;
34-
top: 20vh;
40+
top: 14vh;
3541
bottom: 0;
3642
left: 0;
3743
right: 0;
@@ -65,21 +71,27 @@ $hold-status-color: $liveline-timecode-color;
6571
line-height: 100%;
6672
letter-spacing: 0%;
6773
vertical-align: middle;
74+
color: #fff;
6875

6976
&.live {
7077
background: $general-live-color;
71-
color: #fff;
7278
text-shadow: 0px 0px 6px #000000;
7379
}
74-
80+
7581
&.next {
7682
background: $general-next-color;
77-
color: #000;
83+
text-shadow: 0px 0px 6px #000000;
7884
}
7985
}
8086
.director-screen__body__segment__countdown {
87+
height: 100%;
88+
width: 30vw;
89+
color: #FF5218;
8190
float: right;
82-
margin-right: 10px;
91+
text-align: right;
92+
padding-right: 10px;
93+
background: linear-gradient(90deg, rgba(223, 0, 0, 0) 0%, #DF0000 7.86%, rgba(116, 0, 0, 0.808) 16.21%, rgba(0, 0, 0, 0.6) 24.94%);
94+
8395
}
8496

8597
.director-screen__body__rundown-countdown {
@@ -174,17 +186,14 @@ $hold-status-color: $liveline-timecode-color;
174186
}
175187

176188
&.director-screen__body__part--next-part {
189+
border-top: solid 2em $general-next-color;
177190
.director-screen__body__part__piece-icon,
178191
.director-screen__body__part__piece-name {
179192
grid-row: 2 / -1;
180193
}
181194
}
182195
}
183196

184-
.director-screen__body__part + .director-screen__body__part {
185-
border-top: solid 0.8em #454545;
186-
}
187-
188197
.clocks-segment-countdown-red {
189198
color: $general-late-color;
190199
}

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ function DirectorScreenRender({
357357

358358
return (
359359
<div className="director-screen">
360-
<div className="director-screen__header">
361-
<div className="director-screen__header__planned-end">
360+
<div className="director-screen__top">
361+
<div className="director-screen__top__planned-end">
362362
<div>
363363
<PlannedEndComponent value={expectedEnd} />
364364
</div>
@@ -387,6 +387,9 @@ function DirectorScreenRender({
387387
</div>
388388
</div>
389389
<div className="director-screen__body">
390+
{
391+
// Current Part:
392+
}
390393
<div className="director-screen__body__part">
391394
<div
392395
className={ClassNames('director-screen__body__segment-name', {
@@ -419,6 +422,15 @@ function DirectorScreenRender({
419422
showStyleBaseId={currentShowStyleBaseId}
420423
rundownIds={rundownIds}
421424
playlistActivationId={playlist?.activationId}
425+
autowidth={{
426+
label: '',
427+
width: '80%',
428+
fontFamily: 'Roboto Flex',
429+
fontSize: '2em',
430+
minWidthPercentage: 5,
431+
minLetterSpacing: 2,
432+
useVariableFont: true,
433+
}}
422434
/>
423435
</div>
424436
<div className="director-screen__body__part__piece-countdown">
@@ -451,6 +463,9 @@ function DirectorScreenRender({
451463
</div>
452464
) : null}
453465
</div>
466+
{
467+
// Next Part:
468+
}
454469
<div className="director-screen__body__part director-screen__body__part--next-part">
455470
<div
456471
className={ClassNames('director-screen__body__segment-name', {

packages/webui/src/client/ui/PieceIcons/PieceName.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ import { PieceGeneric } from '@sofie-automation/corelib/dist/dataModel/Piece'
88
import { RundownPlaylistActivationId } from '@sofie-automation/corelib/dist/dataModel/Ids'
99
import { ReadonlyDeep } from 'type-fest'
1010
import { CorelibPubSub } from '@sofie-automation/corelib/dist/pubsub'
11+
import { AdjustLabelFit, AdjustLabelFitProps } from '../util/AdjustLabelFit'
1112

1213
interface INamePropsHeader extends IPropsHeader {
1314
partName: string
1415
playlistActivationId: RundownPlaylistActivationId | undefined
16+
autowidth?: AdjustLabelFitProps
1517
}
1618

1719
const supportedLayers = new Set([
@@ -21,7 +23,7 @@ const supportedLayers = new Set([
2123
SourceLayerType.LOCAL,
2224
])
2325

24-
function getLocalPieceLabel(piece: ReadonlyDeep<PieceGeneric>): JSX.Element | null {
26+
function getLocalPieceLabel(piece: ReadonlyDeep<PieceGeneric>, autowidth?: AdjustLabelFitProps): JSX.Element | null {
2527
const { color } = piece.content as EvsContent
2628
return (
2729
<>
@@ -30,17 +32,21 @@ function getLocalPieceLabel(piece: ReadonlyDeep<PieceGeneric>): JSX.Element | nu
3032
·
3133
</span>
3234
)}
33-
{piece.name}
35+
<AdjustLabelFit {...autowidth} label={piece.name || ''} />
3436
</>
3537
)
3638
}
3739

38-
function getPieceLabel(piece: ReadonlyDeep<PieceGeneric>, type: SourceLayerType): JSX.Element | null {
40+
function getPieceLabel(
41+
piece: ReadonlyDeep<PieceGeneric>,
42+
type: SourceLayerType,
43+
autowidth?: AdjustLabelFitProps
44+
): JSX.Element | null {
3945
switch (type) {
4046
case SourceLayerType.LOCAL:
41-
return getLocalPieceLabel(piece)
47+
return getLocalPieceLabel(piece, autowidth)
4248
default:
43-
return <>{piece.name}</>
49+
return <AdjustLabelFit {...autowidth} label={piece.name || ''} />
4450
}
4551
}
4652

@@ -59,7 +65,7 @@ export function PieceNameContainer(props: Readonly<INamePropsHeader>): JSX.Eleme
5965
useSubscription(MeteorPubSub.uiShowStyleBase, props.showStyleBaseId)
6066

6167
if (pieceInstance && sourceLayer && supportedLayers.has(sourceLayer.type)) {
62-
return getPieceLabel(pieceInstance.piece, sourceLayer.type)
68+
return getPieceLabel(pieceInstance.piece, sourceLayer.type, props.autowidth)
6369
}
64-
return <>{props.partName || ''}</>
70+
return <AdjustLabelFit {...props.autowidth} label={props.partName || ''} />
6571
}

0 commit comments

Comments
 (0)