diff --git a/apps/client/src/views/cuesheet/Cuesheet.tsx b/apps/client/src/views/cuesheet/Cuesheet.tsx index deaf586e5..7c4eb412e 100644 --- a/apps/client/src/views/cuesheet/Cuesheet.tsx +++ b/apps/client/src/views/cuesheet/Cuesheet.tsx @@ -11,7 +11,7 @@ import CuesheetHeader from './cuesheet-table-elements/CuesheetHeader'; import DelayRow from './cuesheet-table-elements/DelayRow'; import EventRow from './cuesheet-table-elements/EventRow'; import CuesheetTableSettings from './cuesheet-table-settings/CuesheetTableSettings'; -import { useCuesheetSettings } from './store/CuesheetSettings'; +import { useCuesheetSettings } from './store/cuesheetSettingsStore'; import useColumnManager from './useColumnManager'; import style from './Cuesheet.module.scss'; diff --git a/apps/client/src/views/cuesheet/CuesheetWrapper.module.scss b/apps/client/src/views/cuesheet/CuesheetPage.module.scss similarity index 100% rename from apps/client/src/views/cuesheet/CuesheetWrapper.module.scss rename to apps/client/src/views/cuesheet/CuesheetPage.module.scss diff --git a/apps/client/src/views/cuesheet/CuesheetWrapper.tsx b/apps/client/src/views/cuesheet/CuesheetPage.tsx similarity index 95% rename from apps/client/src/views/cuesheet/CuesheetWrapper.tsx rename to apps/client/src/views/cuesheet/CuesheetPage.tsx index f6b9cab87..a404aa48b 100644 --- a/apps/client/src/views/cuesheet/CuesheetWrapper.tsx +++ b/apps/client/src/views/cuesheet/CuesheetPage.tsx @@ -14,13 +14,13 @@ import { useFlatRundown } from '../../common/hooks-query/useRundown'; import { CuesheetOverview } from '../../features/overview/Overview'; import CuesheetProgress from './cuesheet-progress/CuesheetProgress'; -import { useCuesheetSettings } from './store/CuesheetSettings'; +import { useCuesheetSettings } from './store/cuesheetSettingsStore'; import Cuesheet from './Cuesheet'; import { makeCuesheetColumns } from './cuesheetCols'; -import styles from './CuesheetWrapper.module.scss'; +import styles from './CuesheetPage.module.scss'; -export default function CuesheetWrapper() { +export default function CuesheetPage() { // TODO: can we use the normalised rundown for the table? const { data: flatRundown, status: rundownStatus } = useFlatRundown(); const { data: customFields } = useCustomFields(); diff --git a/apps/client/src/views/cuesheet/ProtectedCuesheet.tsx b/apps/client/src/views/cuesheet/ProtectedCuesheet.tsx index 6a31c1742..af8c4aee7 100644 --- a/apps/client/src/views/cuesheet/ProtectedCuesheet.tsx +++ b/apps/client/src/views/cuesheet/ProtectedCuesheet.tsx @@ -1,11 +1,11 @@ import ProtectRoute from '../../common/components/protect-route/ProtectRoute'; -import CuesheetWrapper from './CuesheetWrapper'; +import CuesheetPage from './CuesheetPage'; export default function ProtectedCuesheet() { return ( - + ); } diff --git a/apps/client/src/views/cuesheet/__tests__/__snapshots__/utils.test.js.snap b/apps/client/src/views/cuesheet/__tests__/__snapshots__/utils.test.js.snap deleted file mode 100644 index 5214b2670..000000000 --- a/apps/client/src/views/cuesheet/__tests__/__snapshots__/utils.test.js.snap +++ /dev/null @@ -1,41 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`makeTable() > returns array of arrays with given fields 1`] = ` -[ - [ - "Ontime · Rundown export", - ], - [ - "Project title: test title", - ], - [ - "Project description: test description", - ], - [ - "Time Start", - "Time End", - "Duration", - "ID", - "Colour", - "Cue", - "Title", - "Note", - "Is Public? (x)", - "Skip?", - "lighting", - ], - [ - "00:00:00", - "00:00:00", - "...", - "", - "", - "", - "test title 1", - "", - "x", - "", - "", - ], -] -`; diff --git a/apps/client/src/views/cuesheet/__tests__/utils.test.js b/apps/client/src/views/cuesheet/__tests__/cuesheet.utils.test.ts similarity index 67% rename from apps/client/src/views/cuesheet/__tests__/utils.test.js rename to apps/client/src/views/cuesheet/__tests__/cuesheet.utils.test.ts index d62ed12e7..a7b162246 100644 --- a/apps/client/src/views/cuesheet/__tests__/utils.test.js +++ b/apps/client/src/views/cuesheet/__tests__/cuesheet.utils.test.ts @@ -1,4 +1,6 @@ -import { makeCSV, makeTable, parseField } from '../cuesheetUtils'; +import { ProjectData } from 'ontime-types'; + +import { makeCSV, makeTable, parseField } from '../cuesheet.utils'; describe('parseField()', () => { it('returns a string from given millis on timeStart, TimeEnd and duration', () => { @@ -27,6 +29,7 @@ describe('parseField()', () => { }); it('returns an empty string on undefined fields', () => { + // @ts-expect-error -- testing user data with missing fields expect(parseField('title')).toBe(''); }); @@ -51,6 +54,7 @@ describe('makeTable()', () => { const headerData = { title: 'test title', description: 'test description', + projectLogo: 'test logo', }; const tableData = [ { @@ -66,8 +70,48 @@ describe('makeTable()', () => { lighting: { label: 'test' }, }; - const table = makeTable(headerData, tableData, customFields); - expect(table).toMatchSnapshot(); + // @ts-expect-error -- testing user data with missing fields + const table = makeTable(headerData as ProjectData, tableData, customFields); + expect(table).not.toContain('test logo'); + expect(table).toMatchInlineSnapshot(` + [ + [ + "Ontime · Rundown export", + ], + [ + "Project title: test title", + ], + [ + "Project description: test description", + ], + [ + "Time Start", + "Time End", + "Duration", + "ID", + "Colour", + "Cue", + "Title", + "Note", + "Is Public? (x)", + "Skip?", + "lighting", + ], + [ + "00:00:00", + "00:00:00", + "...", + "", + "", + "", + "test title 1", + "", + "x", + "", + "", + ], + ] + `); }); }); diff --git a/apps/client/src/views/cuesheet/cuesheet-table-header/CuesheetTableHeader.tsx b/apps/client/src/views/cuesheet/cuesheet-table-header/CuesheetTableHeader.tsx index 1966a0e52..94f65896c 100644 --- a/apps/client/src/views/cuesheet/cuesheet-table-header/CuesheetTableHeader.tsx +++ b/apps/client/src/views/cuesheet/cuesheet-table-header/CuesheetTableHeader.tsx @@ -6,7 +6,7 @@ import PlaybackIcon from '../../../common/components/playback-icon/PlaybackIcon' import useProjectData from '../../../common/hooks-query/useProjectData'; import { cx, enDash } from '../../../common/utils/styleUtils'; import { tooltipDelayFast } from '../../../ontimeConfig'; -import { useCuesheetSettings } from '../store/CuesheetSettings'; +import { useCuesheetSettings } from '../store/cuesheetSettingsStore'; import CuesheetTableHeaderTimers from './CuesheetTableHeaderTimers'; diff --git a/apps/client/src/views/cuesheet/cuesheet-table-settings/CuesheetTableSettings.tsx b/apps/client/src/views/cuesheet/cuesheet-table-settings/CuesheetTableSettings.tsx index a5990accb..290512c19 100644 --- a/apps/client/src/views/cuesheet/cuesheet-table-settings/CuesheetTableSettings.tsx +++ b/apps/client/src/views/cuesheet/cuesheet-table-settings/CuesheetTableSettings.tsx @@ -3,7 +3,7 @@ import { Button, Checkbox, Switch } from '@chakra-ui/react'; import { Column } from '@tanstack/react-table'; import { OntimeRundownEntry } from 'ontime-types'; -import { useCuesheetSettings } from '../store/CuesheetSettings'; +import { useCuesheetSettings } from '../store/cuesheetSettingsStore'; import style from './CuesheetTableSettings.module.scss'; diff --git a/apps/client/src/views/cuesheet/defaults.ts b/apps/client/src/views/cuesheet/cuesheet.options.ts similarity index 100% rename from apps/client/src/views/cuesheet/defaults.ts rename to apps/client/src/views/cuesheet/cuesheet.options.ts diff --git a/apps/client/src/views/cuesheet/cuesheetUtils.ts b/apps/client/src/views/cuesheet/cuesheet.utils.ts similarity index 100% rename from apps/client/src/views/cuesheet/cuesheetUtils.ts rename to apps/client/src/views/cuesheet/cuesheet.utils.ts diff --git a/apps/client/src/views/cuesheet/cuesheetCols.tsx b/apps/client/src/views/cuesheet/cuesheetCols.tsx index 24b9ab850..42b91ddc0 100644 --- a/apps/client/src/views/cuesheet/cuesheetCols.tsx +++ b/apps/client/src/views/cuesheet/cuesheetCols.tsx @@ -7,7 +7,7 @@ import DelayIndicator from '../../common/components/delay-indicator/DelayIndicat import RunningTime from '../../features/viewers/common/running-time/RunningTime'; import EditableCell from './cuesheet-table-elements/EditableCell'; -import { useCuesheetSettings } from './store/CuesheetSettings'; +import { useCuesheetSettings } from './store/cuesheetSettingsStore'; import style from './Cuesheet.module.scss'; diff --git a/apps/client/src/views/cuesheet/store/CuesheetSettings.tsx b/apps/client/src/views/cuesheet/store/cuesheetSettingsStore.tsx similarity index 96% rename from apps/client/src/views/cuesheet/store/CuesheetSettings.tsx rename to apps/client/src/views/cuesheet/store/cuesheetSettingsStore.tsx index aacf0e256..f9eb5d0fb 100644 --- a/apps/client/src/views/cuesheet/store/CuesheetSettings.tsx +++ b/apps/client/src/views/cuesheet/store/cuesheetSettingsStore.tsx @@ -2,7 +2,7 @@ import { create } from 'zustand'; import { booleanFromLocalStorage } from '../../../common/utils/localStorage'; -interface CuesheetSettings { +interface CuesheetSettingsStore { showSettings: boolean; showIndexColumn: boolean; followSelected: boolean; @@ -36,7 +36,7 @@ enum CuesheetKeys { Seconds = 'ontime-cuesheet-hide-sceconds', } -export const useCuesheetSettings = create()((set) => ({ +export const useCuesheetSettings = create()((set) => ({ showSettings: false, showIndexColumn: booleanFromLocalStorage(CuesheetKeys.ColumnIndex, true), followSelected: booleanFromLocalStorage(CuesheetKeys.Follow, false),