feat: table mode in editor

This commit is contained in:
Carlos Valente
2025-12-21 17:04:24 +01:00
committed by Carlos Valente
parent e5c5ec18d3
commit 0de55e74a8
17 changed files with 405 additions and 41 deletions
@@ -15,7 +15,7 @@ import { PresetContext } from '../../../../common/context/PresetContext';
import type { ExtendedEntry } from '../../../../common/utils/rundownMetadata';
import { cx } from '../../../../common/utils/styleUtils';
import { AppMode, sessionKeys } from '../../../../ontimeConfig';
import { usePersistedCuesheetOptions } from '../../cuesheet.options';
import { CuesheetOptions, usePersistedCuesheetOptions } from '../../cuesheet.options';
import { useCuesheetPermissions } from '../../useTablePermissions';
import CuesheetShareModal from './CuesheetShareModal';
@@ -29,6 +29,17 @@ interface CuesheetTableSettingsProps {
handleClearToggles: () => void;
}
export interface ViewSettingsProps {
optionsStore: CuesheetOptions;
}
export interface ColumnSettingsProps {
columns: Column<ExtendedEntry, unknown>[];
handleResetResizing: () => void;
handleResetReordering: () => void;
handleClearToggles: () => void;
}
export default function CuesheetTableSettings({
columns,
handleResetResizing,
@@ -37,6 +48,7 @@ export default function CuesheetTableSettings({
}: CuesheetTableSettingsProps) {
const canShare = useCuesheetPermissions((state) => state.canShare);
const preset = use(PresetContext);
const options = usePersistedCuesheetOptions();
const [cuesheetMode, setCuesheetMode] = useSessionStorage({
key: preset ? `${preset.alias}${sessionKeys.cuesheetMode}` : sessionKeys.cuesheetMode,
@@ -52,7 +64,7 @@ export default function CuesheetTableSettings({
return (
<Toolbar.Root className={style.tableSettings}>
<ViewSettings />
<ViewSettings optionsStore={options} />
<ColumnSettings
columns={columns}
handleResetResizing={handleResetResizing}
@@ -78,8 +90,8 @@ export default function CuesheetTableSettings({
);
}
function ViewSettings() {
const options = usePersistedCuesheetOptions();
export function ViewSettings({ optionsStore }: ViewSettingsProps) {
const options = optionsStore;
return (
<Popover.Root>
@@ -137,12 +149,12 @@ function ViewSettings() {
);
}
function ColumnSettings({
export function ColumnSettings({
columns,
handleResetResizing,
handleResetReordering,
handleClearToggles,
}: CuesheetTableSettingsProps) {
}: ColumnSettingsProps) {
return (
<Popover.Root>
<Popover.Trigger