mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 02:43:50 +00:00
the rundown title list should also folow the runown selection
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { isOntimeEvent, OntimeEvent } from 'ontime-types';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import { useRundownSelectionContext } from '../context/RundownSelectionContext';
|
||||
import { useSelectedEventId } from '../hooks/useSocket';
|
||||
import { getFlatRundownMetadata, getRundownMetadata } from '../utils/rundownMetadata';
|
||||
import { ExtendedEntry, getFlatRundownMetadata, getRundownMetadata } from '../utils/rundownMetadata';
|
||||
import { useFlatRundown, useRundown } from './useRundown';
|
||||
|
||||
export function useContextRundownEditModal() {
|
||||
@@ -42,6 +43,27 @@ export function useContextRundownList() {
|
||||
);
|
||||
}
|
||||
|
||||
export function useContextRundownTitleList() {
|
||||
'use memo';
|
||||
const { effectiveRundownId, isLoadedRundown } = useRundownSelectionContext();
|
||||
const loadedEventId = useSelectedEventId();
|
||||
const effectiveSelectedEventId = isLoadedRundown ? loadedEventId : null;
|
||||
const { data: rundown, status } = useRundown(effectiveRundownId);
|
||||
const flatRundown = useMemo(() => {
|
||||
const flatData = getFlatRundownMetadata(rundown, effectiveSelectedEventId);
|
||||
return flatData.filter(isOntimeEvent) as ExtendedEntry<OntimeEvent>[];
|
||||
}, [effectiveSelectedEventId, rundown]);
|
||||
|
||||
return useMemo(
|
||||
() => ({
|
||||
flatRundown,
|
||||
status,
|
||||
isLoadedRundown,
|
||||
}),
|
||||
[status, isLoadedRundown, flatRundown],
|
||||
);
|
||||
}
|
||||
|
||||
export function useContextRundownTable() {
|
||||
'use memo';
|
||||
const { effectiveRundownId, isLoadedRundown } = useRundownSelectionContext();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { lazy } from 'react';
|
||||
|
||||
import { RundownSelectionContextProvider } from '../../common/context/RundownSelectionContext';
|
||||
import TrackingPlaybackBar from '../../features/control/playback/tracking-playback-bar/TrackingPlaybackBar';
|
||||
import { AppMode } from '../../ontimeConfig';
|
||||
import TitleList from './title-list/TitleList';
|
||||
@@ -14,44 +15,51 @@ const MessageControl = lazy(() => import('../../features/control/message/Message
|
||||
export default function Editor() {
|
||||
const { layoutMode } = useEditorLayout();
|
||||
|
||||
if (layoutMode === EditorLayoutMode.CONTROL) {
|
||||
return (
|
||||
<div id='panels' className={styles.panelContainer}>
|
||||
<div className={styles.left}>
|
||||
<TimerControl />
|
||||
<MessageControl />
|
||||
</div>
|
||||
<Rundown />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (layoutMode === EditorLayoutMode.TRACKING) {
|
||||
return (
|
||||
<div id='panels' className={`${styles.panelContainer} ${styles.panelContainerTracking}`}>
|
||||
<div className={styles.rundownLayout}>
|
||||
<div className={styles.titlesPanel}>
|
||||
<TitleList mode={AppMode.Run} />
|
||||
switch (layoutMode) {
|
||||
case EditorLayoutMode.TRACKING: {
|
||||
return (
|
||||
<div id='panels' className={`${styles.panelContainer} ${styles.panelContainerTracking}`}>
|
||||
<div className={styles.rundownLayout}>
|
||||
<div className={styles.titlesPanel}>
|
||||
<RundownSelectionContextProvider>
|
||||
<TitleList mode={AppMode.Run} />
|
||||
</RundownSelectionContextProvider>
|
||||
</div>
|
||||
<div className={styles.rundownPanel}>
|
||||
<Rundown />
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.rundownPanel}>
|
||||
<Rundown />
|
||||
<TrackingPlaybackBar />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
case EditorLayoutMode.PLANNING: {
|
||||
return (
|
||||
<div id='panels' className={styles.panelContainer}>
|
||||
<div className={styles.rundownLayout}>
|
||||
<div className={styles.titlesPanel}>
|
||||
<RundownSelectionContextProvider>
|
||||
<TitleList mode={AppMode.Edit} />
|
||||
</RundownSelectionContextProvider>
|
||||
</div>
|
||||
<div className={styles.rundownPanel}>
|
||||
<Rundown />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<TrackingPlaybackBar />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div id='panels' className={styles.panelContainer}>
|
||||
<div className={styles.rundownLayout}>
|
||||
<div className={styles.titlesPanel}>
|
||||
<TitleList mode={AppMode.Edit} />
|
||||
</div>
|
||||
<div className={styles.rundownPanel}>
|
||||
);
|
||||
}
|
||||
case EditorLayoutMode.CONTROL:
|
||||
default: {
|
||||
return (
|
||||
<div id='panels' className={styles.panelContainer}>
|
||||
<div className={styles.left}>
|
||||
<TimerControl />
|
||||
<MessageControl />
|
||||
</div>
|
||||
<Rundown />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
import { Virtuoso, VirtuosoHandle } from 'react-virtuoso';
|
||||
|
||||
import ScrollArea from '../../../common/components/scroll-area/ScrollArea';
|
||||
import { useRundown } from '../../../common/hooks-query/useRundown';
|
||||
import { useContextRundownList } from '../../../common/hooks-query/useContextRundown';
|
||||
import { useSelectedEventId } from '../../../common/hooks/useSocket';
|
||||
import { ExtendedEntry, getFlatRundownMetadata } from '../../../common/utils/rundownMetadata';
|
||||
import { useEventSelection } from '../../../features/rundown/useEventSelection';
|
||||
@@ -20,7 +20,7 @@ interface TitleListProps {
|
||||
}
|
||||
|
||||
export default function TitleList({ mode }: TitleListProps) {
|
||||
const { data: rundown } = useRundown(null);
|
||||
const { rundown } = useContextRundownList();
|
||||
const selectedEventId = useSelectedEventId();
|
||||
const cursor = useEventSelection((state) => state.cursor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user