From 347c748dd93aca756bb1f9f2e7c18c231e4c7432 Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Sat, 18 Jul 2026 16:50:43 +0200 Subject: [PATCH] feat(rundown): add shortcut to jump to current element --- apps/client/src/features/rundown/Rundown.tsx | 17 +++++++++++++++++ .../rundown/entry-editor/EventEditorEmpty.tsx | 3 +++ .../rundown/hooks/useRundownKeyboard.ts | 4 ++++ 3 files changed, 24 insertions(+) diff --git a/apps/client/src/features/rundown/Rundown.tsx b/apps/client/src/features/rundown/Rundown.tsx index d72768a5c..51f823a65 100644 --- a/apps/client/src/features/rundown/Rundown.tsx +++ b/apps/client/src/features/rundown/Rundown.tsx @@ -105,12 +105,29 @@ export default function Rundown({ order, flatOrder, entries, id, rundownMetadata handleCollapseGroup, }); + // Jump to the current element on demand: the running event in Run mode, the edit cursor otherwise. + // Scrolls only (no selection change) so jumping to the running event does not hijack the edit cursor. + const jumpToCurrent = useCallback(() => { + const targetId = editorMode === AppMode.Run ? featureData?.selectedEventId : cursor; + if (!targetId) { + return; + } + + // Open parent group if the target is inside a collapsed group + const entry = entries[targetId]; + if (entry && 'parent' in entry) { + expandGroup(entry.parent); + } + scrollToEntry(targetId); + }, [editorMode, featureData?.selectedEventId, cursor, entries, expandGroup, scrollToEntry]); + // Keyboard shortcuts useRundownKeyboard({ cursor, commands, clearSelectedEvents, setEntryCopyId, + jumpToCurrent, }); // DND handlers diff --git a/apps/client/src/features/rundown/entry-editor/EventEditorEmpty.tsx b/apps/client/src/features/rundown/entry-editor/EventEditorEmpty.tsx index 994a588b0..09d69fb13 100644 --- a/apps/client/src/features/rundown/entry-editor/EventEditorEmpty.tsx +++ b/apps/client/src/features/rundown/entry-editor/EventEditorEmpty.tsx @@ -44,6 +44,9 @@ function EventEditorEmpty() { + + + diff --git a/apps/client/src/features/rundown/hooks/useRundownKeyboard.ts b/apps/client/src/features/rundown/hooks/useRundownKeyboard.ts index 01d4c8fbf..734564e92 100644 --- a/apps/client/src/features/rundown/hooks/useRundownKeyboard.ts +++ b/apps/client/src/features/rundown/hooks/useRundownKeyboard.ts @@ -19,6 +19,7 @@ interface UseRundownKeyboardOptions { }; clearSelectedEvents: () => void; setEntryCopyId: (id: EntryId | null, mode?: 'copy' | 'cut') => void; + jumpToCurrent: () => void; } /** @@ -40,6 +41,7 @@ export function useRundownKeyboard({ commands, clearSelectedEvents, setEntryCopyId, + jumpToCurrent, }: UseRundownKeyboardOptions) { const scrollToEntry = useEventSelection((state) => state.scrollToEntry); @@ -127,6 +129,8 @@ export function useRundownKeyboard({ { preventDefault: true, usePhysicalKeys: true }, ], + ['alt + L', () => jumpToCurrent(), { preventDefault: true, usePhysicalKeys: true }], + [ 'alt + mod + ArrowDown', () => commands.moveEntry(cursor, 'down'),