refactor: rename negative to overtime

This commit is contained in:
Carlos Valente
2024-06-04 15:34:43 +02:00
committed by Carlos Valente
parent ee1753ef29
commit 6d1a911ab8
6 changed files with 7 additions and 7 deletions
@@ -44,7 +44,7 @@ export default function PlaybackTimer(props: PropsWithChildren<PlaybackTimerProp
const isRolling = playback === Playback.Roll; const isRolling = playback === Playback.Roll;
const isWaiting = timer.secondaryTimer !== null && timer.secondaryTimer > 0 && timer.current === null; const isWaiting = timer.secondaryTimer !== null && timer.secondaryTimer > 0 && timer.current === null;
const isOvertime = timer.phase === TimerPhase.Negative; const isOvertime = timer.phase === TimerPhase.Overtime;
const hasAddedTime = Boolean(timer.addedTime); const hasAddedTime = Boolean(timer.addedTime);
const rollLabel = isRolling ? 'Roll mode active' : ''; const rollLabel = isRolling ? 'Roll mode active' : '';
@@ -127,7 +127,7 @@ export default function MinimalTimer(props: MinimalTimerProps) {
const isPlaying = time.playback !== Playback.Pause; const isPlaying = time.playback !== Playback.Pause;
const shouldShowModifiers = time.timerType !== TimerType.Clock && time.timerType !== TimerType.CountUp; const shouldShowModifiers = time.timerType !== TimerType.Clock && time.timerType !== TimerType.CountUp;
const finished = time.phase === TimerPhase.Negative; const finished = time.phase === TimerPhase.Overtime;
const showEndMessage = finished && viewSettings.endMessage && !hideEndMessage; const showEndMessage = finished && viewSettings.endMessage && !hideEndMessage;
const showFinished = finished && !userOptions?.hideOvertime && (shouldShowModifiers || showEndMessage); const showFinished = finished && !userOptions?.hideOvertime && (shouldShowModifiers || showEndMessage);
@@ -111,7 +111,7 @@ export default function Timer(props: TimerProps) {
const timerIsTimeOfDay = time.timerType === TimerType.Clock; const timerIsTimeOfDay = time.timerType === TimerType.Clock;
const finished = time.phase === TimerPhase.Negative; const finished = time.phase === TimerPhase.Overtime;
const totalTime = (time.duration ?? 0) + (time.addedTime ?? 0); const totalTime = (time.duration ?? 0) + (time.addedTime ?? 0);
const shouldShowModifiers = time.timerType !== TimerType.Clock && time.timerType !== TimerType.CountUp; const shouldShowModifiers = time.timerType !== TimerType.Clock && time.timerType !== TimerType.CountUp;
@@ -1779,7 +1779,7 @@ describe('getTimerPhase()', () => {
expect(phase).toBe(TimerPhase.None); expect(phase).toBe(TimerPhase.None);
}); });
it('can be negative', () => { it('can be in overtime', () => {
const state = { const state = {
timer: { timer: {
addedTime: 0, addedTime: 0,
@@ -1794,7 +1794,7 @@ describe('getTimerPhase()', () => {
} as RuntimeState; } as RuntimeState;
const phase = getTimerPhase(state); const phase = getTimerPhase(state);
expect(phase).toBe(TimerPhase.Negative); expect(phase).toBe(TimerPhase.Overtime);
}); });
it('can be danger', () => { it('can be danger', () => {
+1 -1
View File
@@ -391,7 +391,7 @@ export function getTimerPhase(state: RuntimeState): TimerPhase {
} }
if (current < 0) { if (current < 0) {
return TimerPhase.Negative; return TimerPhase.Overtime;
} }
const danger = state.eventNow.timeDanger; const danger = state.eventNow.timeDanger;
@@ -6,7 +6,7 @@ export enum TimerPhase {
Default = 'default', Default = 'default',
Warning = 'warning', Warning = 'warning',
Danger = 'danger', Danger = 'danger',
Negative = 'negative', Overtime = 'overtime',
Pending = 'pending', // used for waiting to roll Pending = 'pending', // used for waiting to roll
} }