Feat: reorder events with alt+ctrl + arrow up/down (#645)

* fix: key guard

* feat: reorder events

* refactor: return index from the getEvent functions
This commit is contained in:
Alex Christoffer Rasmussen
2023-12-28 13:41:43 +01:00
committed by GitHub
parent b2c01a141a
commit 96280e5932
5 changed files with 176 additions and 59 deletions
+3 -3
View File
@@ -45,7 +45,7 @@ export function getIncrement(input: string): string {
*/
export function getCueCandidate(rundown: OntimeRundown, insertAfterId?: string): string {
function addAtTop() {
const firstEventCue = getFirstEvent(rundown)?.cue;
const firstEventCue = getFirstEvent(rundown).firstEvent?.cue;
if (isNumeric(firstEventCue)) {
return (Number(firstEventCue) / 10).toString();
@@ -68,11 +68,11 @@ export function getCueCandidate(rundown: OntimeRundown, insertAfterId?: string):
// get elements around
let previousEvent: OntimeRundownEntry | undefined | null | OntimeEvent = rundown.at(afterIndex);
if (!isOntimeEvent(previousEvent)) {
previousEvent = getPreviousEvent(rundown, insertAfterId) as null | OntimeEvent;
previousEvent = getPreviousEvent(rundown, insertAfterId).previousEvent as null | OntimeEvent;
}
let cue = '1';
const nextEvent = getNextEvent(rundown, insertAfterId);
const { nextEvent } = getNextEvent(rundown, insertAfterId);
// try and increment the cue
if (isOntimeEvent(previousEvent)) {