From 4ed38340e04eac3e5da85f405facfc616233c09f Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Sun, 23 Mar 2025 22:01:33 +0100 Subject: [PATCH] refactor: remove stop as a possible end action --- .../app-settings/panel/interface-panel/EditorSettingsForm.tsx | 1 - .../src/features/rundown/event-block/EventBlockInner.tsx | 4 ---- .../rundown/event-editor/composite/EventEditorTimes.tsx | 1 - apps/server/src/services/runtime-service/RuntimeService.ts | 4 +--- packages/types/src/definitions/EndAction.type.ts | 1 - packages/utils/src/validate-events/validateEvent.test.ts | 4 ++-- 6 files changed, 3 insertions(+), 12 deletions(-) diff --git a/apps/client/src/features/app-settings/panel/interface-panel/EditorSettingsForm.tsx b/apps/client/src/features/app-settings/panel/interface-panel/EditorSettingsForm.tsx index f6bcd00f6..8772a129e 100644 --- a/apps/client/src/features/app-settings/panel/interface-panel/EditorSettingsForm.tsx +++ b/apps/client/src/features/app-settings/panel/interface-panel/EditorSettingsForm.tsx @@ -102,7 +102,6 @@ export default function EditorSettingsForm() { onChange={(event) => setDefaultEndAction(event.target.value as EndAction)} > - diff --git a/apps/client/src/features/rundown/event-block/EventBlockInner.tsx b/apps/client/src/features/rundown/event-block/EventBlockInner.tsx index c404ded56..ce821f33b 100644 --- a/apps/client/src/features/rundown/event-block/EventBlockInner.tsx +++ b/apps/client/src/features/rundown/event-block/EventBlockInner.tsx @@ -8,7 +8,6 @@ import { IoPlay, IoPlayForward, IoPlaySkipForward, - IoStop, IoTime, } from 'react-icons/io5'; import { Tooltip } from '@chakra-ui/react'; @@ -177,9 +176,6 @@ function EndActionIcon(props: { action: EndAction; className: string }) { if (action === EndAction.PlayNext) { return ; } - if (action === EndAction.Stop) { - return ; - } return ; } diff --git a/apps/client/src/features/rundown/event-editor/composite/EventEditorTimes.tsx b/apps/client/src/features/rundown/event-editor/composite/EventEditorTimes.tsx index f5a5f8b46..cd9593cc6 100644 --- a/apps/client/src/features/rundown/event-editor/composite/EventEditorTimes.tsx +++ b/apps/client/src/features/rundown/event-editor/composite/EventEditorTimes.tsx @@ -114,7 +114,6 @@ function EventEditorTimes(props: EventEditorTimesProps) { variant='ontime' > - diff --git a/apps/server/src/services/runtime-service/RuntimeService.ts b/apps/server/src/services/runtime-service/RuntimeService.ts index 071e0b976..2883f260a 100644 --- a/apps/server/src/services/runtime-service/RuntimeService.ts +++ b/apps/server/src/services/runtime-service/RuntimeService.ts @@ -134,9 +134,7 @@ class RuntimeService { // handle end action if there was a timer playing // actions are added to the queue stack to ensure that the order of operations is maintained if (newState.eventNow) { - if (newState.eventNow.endAction === EndAction.Stop) { - setTimeout(this.stop.bind(this), 0); - } else if (newState.eventNow.endAction === EndAction.LoadNext) { + if (newState.eventNow.endAction === EndAction.LoadNext) { setTimeout(this.loadNext.bind(this), 0); } else if (newState.eventNow.endAction === EndAction.PlayNext) { setTimeout(this.startNext.bind(this), 0); diff --git a/packages/types/src/definitions/EndAction.type.ts b/packages/types/src/definitions/EndAction.type.ts index 7db64a69b..81111c79c 100644 --- a/packages/types/src/definitions/EndAction.type.ts +++ b/packages/types/src/definitions/EndAction.type.ts @@ -2,5 +2,4 @@ export enum EndAction { LoadNext = 'load-next', None = 'none', PlayNext = 'play-next', - Stop = 'stop', } diff --git a/packages/utils/src/validate-events/validateEvent.test.ts b/packages/utils/src/validate-events/validateEvent.test.ts index aa61b4106..9c8734d14 100644 --- a/packages/utils/src/validate-events/validateEvent.test.ts +++ b/packages/utils/src/validate-events/validateEvent.test.ts @@ -9,9 +9,9 @@ describe('validateEndAction()', () => { expect(endAction).toBe(EndAction.LoadNext); }); it('returns fallback otherwise', () => { - const emptyAction = validateEndAction('', EndAction.Stop); + const emptyAction = validateEndAction('', EndAction.LoadNext); const invalidAction = validateEndAction('this-does-not-exist', EndAction.PlayNext); - expect(emptyAction).toBe(EndAction.Stop); + expect(emptyAction).toBe(EndAction.LoadNext); expect(invalidAction).toBe(EndAction.PlayNext); }); });