From db922a67e2e03f678093731cd45dc390f43f935a Mon Sep 17 00:00:00 2001 From: arc-alex Date: Thu, 14 Aug 2025 19:30:08 +0200 Subject: [PATCH] chore: cleanup --- apps/client/src/common/hooks/useSocket.ts | 2 +- apps/client/src/views/timeline/TimelineSections.tsx | 6 +++--- apps/server/src/services/__tests__/timerUtils.test.ts | 2 +- apps/server/src/stores/runtimeState.ts | 7 ++----- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/apps/client/src/common/hooks/useSocket.ts b/apps/client/src/common/hooks/useSocket.ts index 44738657b..499840cb3 100644 --- a/apps/client/src/common/hooks/useSocket.ts +++ b/apps/client/src/common/hooks/useSocket.ts @@ -272,5 +272,5 @@ export const useStudioTimersSocket = createSelector((state: RuntimeStore) => ({ export const useTimelineSocket = createSelector((state: RuntimeStore) => ({ clock: state.clock, - offsetAbs: state.offset.absolute, + offset: state.offset.absolute, })); diff --git a/apps/client/src/views/timeline/TimelineSections.tsx b/apps/client/src/views/timeline/TimelineSections.tsx index 9bfee8067..497c9541c 100644 --- a/apps/client/src/views/timeline/TimelineSections.tsx +++ b/apps/client/src/views/timeline/TimelineSections.tsx @@ -15,7 +15,7 @@ interface TimelineSectionsProps { export default function TimelineSections({ now, next, followedBy }: TimelineSectionsProps) { const { getLocalizedString } = useTranslation(); - const { clock, offsetAbs } = useTimelineSocket(); + const { clock, offset } = useTimelineSocket(); // gather card data const titleNow = now?.title ?? '-'; @@ -26,7 +26,7 @@ export default function TimelineSections({ now, next, followedBy }: TimelineSect let followedByStatus: string | undefined; if (next !== null) { - const timeToStart = getTimeToStart(clock, next.timeStart, next?.delay ?? 0, offsetAbs); + const timeToStart = getTimeToStart(clock, next.timeStart, next?.delay ?? 0, offset); if (timeToStart < 0) { nextStatus = dueText; } else { @@ -35,7 +35,7 @@ export default function TimelineSections({ now, next, followedBy }: TimelineSect } if (followedBy !== null) { - const timeToStart = getTimeToStart(clock, followedBy.timeStart, followedBy?.delay ?? 0, offsetAbs); + const timeToStart = getTimeToStart(clock, followedBy.timeStart, followedBy?.delay ?? 0, offset); if (timeToStart < 0) { followedByStatus = dueText; } else { diff --git a/apps/server/src/services/__tests__/timerUtils.test.ts b/apps/server/src/services/__tests__/timerUtils.test.ts index 6c6e7873c..abdc63734 100644 --- a/apps/server/src/services/__tests__/timerUtils.test.ts +++ b/apps/server/src/services/__tests__/timerUtils.test.ts @@ -1011,7 +1011,7 @@ describe('getRuntimeOffset()', () => { }); }); -describe('getoffsetRel()', () => { +describe('getRuntimeOffset() relative', () => { it('relative offset is 0 when starting at the planed time', () => { const state = { eventNow: { diff --git a/apps/server/src/stores/runtimeState.ts b/apps/server/src/stores/runtimeState.ts index 9af939f11..da655230a 100644 --- a/apps/server/src/stores/runtimeState.ts +++ b/apps/server/src/stores/runtimeState.ts @@ -106,14 +106,11 @@ export function clearEventData() { runtimeState.offset.absolute = 0; runtimeState.offset.relative = 0; runtimeState.offset.expectedFlagStart = null; + runtimeState.offset.expectedGroupEnd = null; + runtimeState.offset.expectedRundownEnd = null; runtimeState.rundown.selectedEventIndex = null; - //TODO: is there any ExpectedMetadata stuff we need to clear here - runtimeState.offset.expectedGroupEnd = null; - runtimeState.offset.expectedFlagStart = null; - runtimeState.offset.expectedRundownEnd = null; - runtimeState.timer.playback = Playback.Stop; runtimeState.clock = timeNow(); runtimeState.timer = { ...runtimeStorePlaceholder.timer };