mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 12:53:32 +00:00
0e6d6cd416
* refactor: allow secondary rundowns * ui: move dropdown * feat: follow loaded * ui: background edit warning ui: fix disable radio button * feat(ui): add loaded sufix in the rundown list * feat(ui): add direct link to background edit from rundown manager * fix: better fallback * fix: default to is isCurrentRundown for nav bar colour * chore: rename navigate to cuesheet --------- Co-authored-by: alex-arc <ac@omnivox.dk>
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import { OntimeEntry, Rundown, isOntimeEvent, isOntimeGroup, isOntimeMilestone } from 'ontime-types';
|
|
import { useMemo } from 'react';
|
|
|
|
import EventEditor from './EventEditor';
|
|
import GroupEditor from './GroupEditor';
|
|
import MilestoneEditor from './MilestoneEditor';
|
|
|
|
import style from './EntryEditor.module.scss';
|
|
|
|
interface CuesheetEntryEditorProps {
|
|
entryId: string;
|
|
rundown: Rundown;
|
|
}
|
|
|
|
export default function CuesheetEntryEditor({ entryId, rundown }: CuesheetEntryEditorProps) {
|
|
const entry = useMemo<OntimeEntry | null>(() => {
|
|
if (rundown.order.length === 0) {
|
|
return null;
|
|
}
|
|
|
|
const event = rundown.entries[entryId];
|
|
return event ?? null;
|
|
}, [entryId, rundown.entries, rundown.order.length]);
|
|
|
|
if (isOntimeEvent(entry)) {
|
|
return (
|
|
<div className={style.entryEditor} data-testid='editor-container'>
|
|
<EventEditor event={entry} />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (isOntimeMilestone(entry)) {
|
|
return (
|
|
<div className={style.inModal} data-testid='editor-container'>
|
|
<MilestoneEditor milestone={entry} />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (isOntimeGroup(entry)) {
|
|
return (
|
|
<div className={style.inModal} data-testid='editor-container'>
|
|
<GroupEditor group={entry} />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return null;
|
|
}
|