mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-31 03:49:11 +00:00
802521c706
The editor and cuesheet had three overlapping notions of which rundown they were showing: loaded-only data hooks, a prop-drilled RundownSource, and a selection store which read the loaded rundown out of the query cache. Rendering two rundowns at once was not possible. Introduce a rundown scope: a context carrying the rundown identity (id, isLoaded and a selection store) which the utility hooks read from. useRundown, useEntry and friends keep their signatures and call sites, they simply resolve their rundown from the enclosing scope. The app mounts a scope at the root which follows the loaded rundown, so runtime views are unaffected; the editor and cuesheet mount an editable scope which also binds entry actions to the same rundown. - useEventSelection becomes a per-scope store factory, so panels hold independent cursors and the store is handed its rundown instead of reaching for the loaded one - the cuesheet selection is generalised to useRundownSelection with a namespace, so each surface persists its own choice - the clipboard records the rundown an entry was copied from, leaving room for pasting across rundowns - removes useScopedRundown and the prop-drilled RundownSource Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011a5cbVjNC5XXF88b2PkUCa
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { memo, useEffect, useMemo } from 'react';
|
|
|
|
import useCustomFields from '../../../common/hooks-query/useCustomFields';
|
|
import CuesheetDnd from '../../../views/cuesheet/cuesheet-dnd/CuesheetDnd';
|
|
import CuesheetTable from '../../../views/cuesheet/cuesheet-table/CuesheetTable';
|
|
import { useCuesheetPermissions } from '../../../views/cuesheet/useTablePermissions';
|
|
import { useEditorFollowMode } from '../useEditorFollowMode';
|
|
import { makeRundownColumns } from './makeRundownColumns';
|
|
|
|
export default memo(RundownTable);
|
|
function RundownTable() {
|
|
const { data: customFields } = useCustomFields();
|
|
const setPermissions = useCuesheetPermissions((state) => state.setPermissions);
|
|
const { editorMode } = useEditorFollowMode();
|
|
|
|
// Editor always has full permissions
|
|
useEffect(() => {
|
|
setPermissions({
|
|
canChangeMode: true,
|
|
canCreateEntries: true,
|
|
canEditEntries: true,
|
|
canFlag: true,
|
|
canShare: true,
|
|
});
|
|
}, [setPermissions]);
|
|
|
|
const columns = useMemo(() => makeRundownColumns(customFields), [customFields]);
|
|
|
|
return (
|
|
<CuesheetDnd columns={columns} tableRoot='editor'>
|
|
<CuesheetTable columns={columns} cuesheetMode={editorMode} tableRoot='editor' />
|
|
</CuesheetDnd>
|
|
);
|
|
}
|