mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 15:09:10 +00:00
chore: restructure directory
This commit is contained in:
committed by
Carlos Valente
parent
6ffbf2af9d
commit
7dbf64d100
@@ -11,7 +11,7 @@ import CuesheetHeader from './cuesheet-table-elements/CuesheetHeader';
|
|||||||
import DelayRow from './cuesheet-table-elements/DelayRow';
|
import DelayRow from './cuesheet-table-elements/DelayRow';
|
||||||
import EventRow from './cuesheet-table-elements/EventRow';
|
import EventRow from './cuesheet-table-elements/EventRow';
|
||||||
import CuesheetTableSettings from './cuesheet-table-settings/CuesheetTableSettings';
|
import CuesheetTableSettings from './cuesheet-table-settings/CuesheetTableSettings';
|
||||||
import { useCuesheetSettings } from './store/CuesheetSettings';
|
import { useCuesheetSettings } from './store/cuesheetSettingsStore';
|
||||||
import useColumnManager from './useColumnManager';
|
import useColumnManager from './useColumnManager';
|
||||||
|
|
||||||
import style from './Cuesheet.module.scss';
|
import style from './Cuesheet.module.scss';
|
||||||
|
|||||||
+3
-3
@@ -14,13 +14,13 @@ import { useFlatRundown } from '../../common/hooks-query/useRundown';
|
|||||||
import { CuesheetOverview } from '../../features/overview/Overview';
|
import { CuesheetOverview } from '../../features/overview/Overview';
|
||||||
|
|
||||||
import CuesheetProgress from './cuesheet-progress/CuesheetProgress';
|
import CuesheetProgress from './cuesheet-progress/CuesheetProgress';
|
||||||
import { useCuesheetSettings } from './store/CuesheetSettings';
|
import { useCuesheetSettings } from './store/cuesheetSettingsStore';
|
||||||
import Cuesheet from './Cuesheet';
|
import Cuesheet from './Cuesheet';
|
||||||
import { makeCuesheetColumns } from './cuesheetCols';
|
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?
|
// TODO: can we use the normalised rundown for the table?
|
||||||
const { data: flatRundown, status: rundownStatus } = useFlatRundown();
|
const { data: flatRundown, status: rundownStatus } = useFlatRundown();
|
||||||
const { data: customFields } = useCustomFields();
|
const { data: customFields } = useCustomFields();
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import ProtectRoute from '../../common/components/protect-route/ProtectRoute';
|
import ProtectRoute from '../../common/components/protect-route/ProtectRoute';
|
||||||
|
|
||||||
import CuesheetWrapper from './CuesheetWrapper';
|
import CuesheetPage from './CuesheetPage';
|
||||||
|
|
||||||
export default function ProtectedCuesheet() {
|
export default function ProtectedCuesheet() {
|
||||||
return (
|
return (
|
||||||
<ProtectRoute permission='operator'>
|
<ProtectRoute permission='operator'>
|
||||||
<CuesheetWrapper />
|
<CuesheetPage />
|
||||||
</ProtectRoute>
|
</ProtectRoute>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
],
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
+47
-3
@@ -1,4 +1,6 @@
|
|||||||
import { makeCSV, makeTable, parseField } from '../cuesheetUtils';
|
import { ProjectData } from 'ontime-types';
|
||||||
|
|
||||||
|
import { makeCSV, makeTable, parseField } from '../cuesheet.utils';
|
||||||
|
|
||||||
describe('parseField()', () => {
|
describe('parseField()', () => {
|
||||||
it('returns a string from given millis on timeStart, TimeEnd and duration', () => {
|
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', () => {
|
it('returns an empty string on undefined fields', () => {
|
||||||
|
// @ts-expect-error -- testing user data with missing fields
|
||||||
expect(parseField('title')).toBe('');
|
expect(parseField('title')).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -51,6 +54,7 @@ describe('makeTable()', () => {
|
|||||||
const headerData = {
|
const headerData = {
|
||||||
title: 'test title',
|
title: 'test title',
|
||||||
description: 'test description',
|
description: 'test description',
|
||||||
|
projectLogo: 'test logo',
|
||||||
};
|
};
|
||||||
const tableData = [
|
const tableData = [
|
||||||
{
|
{
|
||||||
@@ -66,8 +70,48 @@ describe('makeTable()', () => {
|
|||||||
lighting: { label: 'test' },
|
lighting: { label: 'test' },
|
||||||
};
|
};
|
||||||
|
|
||||||
const table = makeTable(headerData, tableData, customFields);
|
// @ts-expect-error -- testing user data with missing fields
|
||||||
expect(table).toMatchSnapshot();
|
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",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
],
|
||||||
|
]
|
||||||
|
`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ import PlaybackIcon from '../../../common/components/playback-icon/PlaybackIcon'
|
|||||||
import useProjectData from '../../../common/hooks-query/useProjectData';
|
import useProjectData from '../../../common/hooks-query/useProjectData';
|
||||||
import { cx, enDash } from '../../../common/utils/styleUtils';
|
import { cx, enDash } from '../../../common/utils/styleUtils';
|
||||||
import { tooltipDelayFast } from '../../../ontimeConfig';
|
import { tooltipDelayFast } from '../../../ontimeConfig';
|
||||||
import { useCuesheetSettings } from '../store/CuesheetSettings';
|
import { useCuesheetSettings } from '../store/cuesheetSettingsStore';
|
||||||
|
|
||||||
import CuesheetTableHeaderTimers from './CuesheetTableHeaderTimers';
|
import CuesheetTableHeaderTimers from './CuesheetTableHeaderTimers';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Button, Checkbox, Switch } from '@chakra-ui/react';
|
|||||||
import { Column } from '@tanstack/react-table';
|
import { Column } from '@tanstack/react-table';
|
||||||
import { OntimeRundownEntry } from 'ontime-types';
|
import { OntimeRundownEntry } from 'ontime-types';
|
||||||
|
|
||||||
import { useCuesheetSettings } from '../store/CuesheetSettings';
|
import { useCuesheetSettings } from '../store/cuesheetSettingsStore';
|
||||||
|
|
||||||
import style from './CuesheetTableSettings.module.scss';
|
import style from './CuesheetTableSettings.module.scss';
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import DelayIndicator from '../../common/components/delay-indicator/DelayIndicat
|
|||||||
import RunningTime from '../../features/viewers/common/running-time/RunningTime';
|
import RunningTime from '../../features/viewers/common/running-time/RunningTime';
|
||||||
|
|
||||||
import EditableCell from './cuesheet-table-elements/EditableCell';
|
import EditableCell from './cuesheet-table-elements/EditableCell';
|
||||||
import { useCuesheetSettings } from './store/CuesheetSettings';
|
import { useCuesheetSettings } from './store/cuesheetSettingsStore';
|
||||||
|
|
||||||
import style from './Cuesheet.module.scss';
|
import style from './Cuesheet.module.scss';
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@ import { create } from 'zustand';
|
|||||||
|
|
||||||
import { booleanFromLocalStorage } from '../../../common/utils/localStorage';
|
import { booleanFromLocalStorage } from '../../../common/utils/localStorage';
|
||||||
|
|
||||||
interface CuesheetSettings {
|
interface CuesheetSettingsStore {
|
||||||
showSettings: boolean;
|
showSettings: boolean;
|
||||||
showIndexColumn: boolean;
|
showIndexColumn: boolean;
|
||||||
followSelected: boolean;
|
followSelected: boolean;
|
||||||
@@ -36,7 +36,7 @@ enum CuesheetKeys {
|
|||||||
Seconds = 'ontime-cuesheet-hide-sceconds',
|
Seconds = 'ontime-cuesheet-hide-sceconds',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useCuesheetSettings = create<CuesheetSettings>()((set) => ({
|
export const useCuesheetSettings = create<CuesheetSettingsStore>()((set) => ({
|
||||||
showSettings: false,
|
showSettings: false,
|
||||||
showIndexColumn: booleanFromLocalStorage(CuesheetKeys.ColumnIndex, true),
|
showIndexColumn: booleanFromLocalStorage(CuesheetKeys.ColumnIndex, true),
|
||||||
followSelected: booleanFromLocalStorage(CuesheetKeys.Follow, false),
|
followSelected: booleanFromLocalStorage(CuesheetKeys.Follow, false),
|
||||||
Reference in New Issue
Block a user