Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: improve visibility of time-to-end #1298

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/client/src/features/control/message/TimerPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ export default function TimerPreview() {
if (showTimerMessage) return 'Message';
if (phase === TimerPhase.Pending) return 'Standby to start';
if (phase === TimerPhase.Overtime && data.endMessage) return 'Custom end message';
if (timerType === TimerType.TimeToEnd)
return (
<>
Timer
<br /> (Time to end)
</>
);
return 'Timer';
})();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@use '../blockMixins' as *;

$skip-opacity: 0.2;
$skip-border: color-mix(in srgb, $red-700, transparent 60%); // 60 is opacity disabled
$active-border: color-mix(in srgb, $active-indicator, transparent 60%); // 60 is opacity disabled

.eventBlock {
@include block-styling;
Expand Down Expand Up @@ -55,6 +57,10 @@ $skip-opacity: 0.2;
outline: 1px solid $block-cursor-color;
}

&.timeToEnd {
border: 1px solid $active-border;
}

&.past:not(.skip) {
.timerNote,
.statusElements,
Expand All @@ -69,7 +75,7 @@ $skip-opacity: 0.2;
}

&.skip {
border: 1px solid $white-3;
border: 1px solid $skip-border;

.timerNote,
.eventTitle,
Expand Down
9 changes: 8 additions & 1 deletion apps/client/src/features/rundown/event-block/EventBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ export default function EventBlock(props: EventBlockProps) {
playback ? style[playback] : null,
isSelected ? style.selected : null,
hasCursor ? style.hasCursor : null,
timerType === TimerType.TimeToEnd ? style.timeToEnd : null,
]);

const handleFocusClick = (event: MouseEvent) => {
Expand Down Expand Up @@ -271,7 +272,13 @@ export default function EventBlock(props: EventBlockProps) {
onContextMenu={onContextMenu}
id='event-block'
>
<RundownIndicators timeStart={timeStart} previousStart={previousStart} previousEnd={previousEnd} delay={delay} />
<RundownIndicators
timeStart={timeStart}
previousStart={previousStart}
previousEnd={previousEnd}
delay={delay}
timeToEnd={timerType === TimerType.TimeToEnd}
/>

<div className={style.binder} style={{ ...binderColours }} tabIndex={-1}>
<span className={style.drag} ref={handleRef} {...dragAttributes} {...dragListeners}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const EventBlockInner = (props: EventBlockInnerProps) => {
</div>
<div className={style.eventStatus} tabIndex={-1}>
<Tooltip label={`Time type: ${timerType}`} openDelay={tooltipDelayMid}>
<span>
<span className={cx([timerType === TimerType.TimeToEnd && style.active])}>
<TimerIcon type={timerType} className={style.statusIcon} />
</span>
</Tooltip>
Expand Down Expand Up @@ -151,14 +151,16 @@ function EndActionIcon(props: { action: EndAction; className: string }) {

function TimerIcon(props: { type: TimerType; className: string }) {
const { type, className } = props;
const maybeActiveClasses = cx([type === TimerType.TimeToEnd && style.active, className]);

if (type === TimerType.CountUp) {
return <IoArrowUp className={className} />;
}
if (type === TimerType.Clock) {
return <IoTime className={className} />;
}
if (type === TimerType.TimeToEnd) {
return <IoFlag className={className} />;
return <IoFlag className={maybeActiveClasses} />;
}
return <IoArrowDown className={className} />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ $gap-left: calc(2rem + 0.25rem + 3rem);
.gap {
@include indicator($blue-500);
}

.timeToEnd {
@include indicator($gray-1200);
outline: 1px solid $active-indicator;
outline-offset: -1px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ interface RundownIndicatorProps {
previousStart?: number;
previousEnd?: number;
delay: number;
timeToEnd?: boolean;
}

export default function RundownIndicators(props: RundownIndicatorProps) {
const { timeStart, previousStart, previousEnd, delay } = props;
const { timeStart, previousStart, previousEnd, delay, timeToEnd } = props;

const hasOverlap = formatOverlap(timeStart, previousStart, previousEnd);
const hasDelay = formatDelay(timeStart, delay);
Expand All @@ -19,6 +20,7 @@ export default function RundownIndicators(props: RundownIndicatorProps) {
<div className={style.indicators}>
{hasDelay && <div className={style.delay}>{hasDelay}</div>}
{hasOverlap && <div className={style.gap}>{hasOverlap}</div>}
{timeToEnd && <div className={style.timeToEnd}>Time to end</div>}
</div>
);
}