mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-22 15:39:11 +00:00
refactor: show upcoming events
This commit is contained in:
committed by
Carlos Valente
parent
db8ed93d41
commit
980ae7a7c5
@@ -126,13 +126,12 @@ export function getUpcomingEvents(events: OntimeRundown, selectedId: MaybeString
|
|||||||
return { now: null, next: null, followedBy: null };
|
return { now: null, next: null, followedBy: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
const now = selectedId ? getEventWithId(events, selectedId) : getFirstEvent(events)?.firstEvent;
|
let now = selectedId ? getEventWithId(events, selectedId) : null;
|
||||||
|
|
||||||
if (!isOntimeEvent(now)) {
|
if (!isOntimeEvent(now)) {
|
||||||
return { now: null, next: null, followedBy: null };
|
now = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const next = getNextEvent(events, now.id)?.nextEvent;
|
const next = now ? getNextEvent(events, now.id)?.nextEvent : getFirstEvent(events).firstEvent;
|
||||||
const followedBy = next ? getNextEvent(events, next.id)?.nextEvent : null;
|
const followedBy = next ? getNextEvent(events, next.id)?.nextEvent : null;
|
||||||
|
|
||||||
// Return the titles, handling nulls appropriately
|
// Return the titles, handling nulls appropriately
|
||||||
|
|||||||
Reference in New Issue
Block a user