Sheets settings (#774)

* wip: migrate sheet settings

---------

Co-authored-by: arc-alex <ac@omnivox.dk>
This commit is contained in:
Carlos Valente
2024-02-17 22:05:38 +01:00
committed by GitHub
parent c1377544a0
commit 5a397c6da7
34 changed files with 732 additions and 701 deletions
@@ -1,4 +1,3 @@
import { MutableRefObject } from 'react';
import { ExcelImportMap } from 'ontime-utils';
import ImportMapTable, { type TableEntry } from './ImportMapTable';
@@ -6,50 +5,50 @@ import ImportMapTable, { type TableEntry } from './ImportMapTable';
import style from '../UploadModal.module.scss';
interface ExcelFileOptionsProps {
optionsRef: MutableRefObject<ExcelImportMap>;
importOptions: ExcelImportMap;
updateOptions: <T extends keyof ExcelImportMap>(field: T, value: ExcelImportMap[T]) => void;
}
export default function ExcelFileOptions(props: ExcelFileOptionsProps) {
const { optionsRef, updateOptions } = props;
const { importOptions, updateOptions } = props;
const worksheet: TableEntry[] = [{ label: 'Worksheet', title: 'worksheet', value: optionsRef.current.worksheet }];
const worksheet: TableEntry[] = [{ label: 'Worksheet', title: 'worksheet', value: importOptions.worksheet }];
const timings: TableEntry[] = [
{ label: 'Start time', title: 'timeStart', value: optionsRef.current.timeStart },
{ label: 'End Time', title: 'timeEnd', value: optionsRef.current.timeEnd },
{ label: 'Duration', title: 'duration', value: optionsRef.current.duration },
{ label: 'Warning Time', title: 'timeWarning', value: optionsRef.current.timeWarning },
{ label: 'Danger Time', title: 'timeDanger', value: optionsRef.current.timeDanger },
{ label: 'Start time', title: 'timeStart', value: importOptions.timeStart },
{ label: 'End Time', title: 'timeEnd', value: importOptions.timeEnd },
{ label: 'Duration', title: 'duration', value: importOptions.duration },
{ label: 'Warning Time', title: 'timeWarning', value: importOptions.timeWarning },
{ label: 'Danger Time', title: 'timeDanger', value: importOptions.timeDanger },
];
const titles: TableEntry[] = [
{ label: 'Cue', title: 'cue', value: optionsRef.current.cue },
{ label: 'Colour', title: 'colour', value: optionsRef.current.colour },
{ label: 'Title', title: 'title', value: optionsRef.current.title },
{ label: 'Presenter', title: 'presenter', value: optionsRef.current.presenter },
{ label: 'Subtitle', title: 'subtitle', value: optionsRef.current.subtitle },
{ label: 'Note', title: 'note', value: optionsRef.current.note },
{ label: 'Cue', title: 'cue', value: importOptions.cue },
{ label: 'Colour', title: 'colour', value: importOptions.colour },
{ label: 'Title', title: 'title', value: importOptions.title },
{ label: 'Presenter', title: 'presenter', value: importOptions.presenter },
{ label: 'Subtitle', title: 'subtitle', value: importOptions.subtitle },
{ label: 'Note', title: 'note', value: importOptions.note },
];
const options: TableEntry[] = [
{ label: 'Is Public', title: 'isPublic', value: optionsRef.current.isPublic },
{ label: 'Skip', title: 'skip', value: optionsRef.current.skip },
{ label: 'Timer Type', title: 'timerType', value: optionsRef.current.timerType },
{ label: 'End Action', title: 'endAction', value: optionsRef.current.endAction },
{ label: 'Is Public', title: 'isPublic', value: importOptions.isPublic },
{ label: 'Skip', title: 'skip', value: importOptions.skip },
{ label: 'Timer Type', title: 'timerType', value: importOptions.timerType },
{ label: 'End Action', title: 'endAction', value: importOptions.endAction },
];
const userFields: TableEntry[] = [
{ label: 'User 0', title: 'user0', value: optionsRef.current.user0 },
{ label: 'User 1', title: 'user1', value: optionsRef.current.user1 },
{ label: 'User 2', title: 'user2', value: optionsRef.current.user2 },
{ label: 'User 3', title: 'user3', value: optionsRef.current.user3 },
{ label: 'User 4', title: 'user4', value: optionsRef.current.user4 },
{ label: 'User 5', title: 'user5', value: optionsRef.current.user5 },
{ label: 'User 6', title: 'user6', value: optionsRef.current.user6 },
{ label: 'User 7', title: 'user7', value: optionsRef.current.user7 },
{ label: 'User 8', title: 'user8', value: optionsRef.current.user8 },
{ label: 'User 9', title: 'user9', value: optionsRef.current.user9 },
{ label: 'User 0', title: 'user0', value: importOptions.user0 },
{ label: 'User 1', title: 'user1', value: importOptions.user1 },
{ label: 'User 2', title: 'user2', value: importOptions.user2 },
{ label: 'User 3', title: 'user3', value: importOptions.user3 },
{ label: 'User 4', title: 'user4', value: importOptions.user4 },
{ label: 'User 5', title: 'user5', value: importOptions.user5 },
{ label: 'User 6', title: 'user6', value: importOptions.user6 },
{ label: 'User 7', title: 'user7', value: importOptions.user7 },
{ label: 'User 8', title: 'user8', value: importOptions.user8 },
{ label: 'User 9', title: 'user9', value: importOptions.user9 },
];
return (
@@ -31,8 +31,8 @@ export default function ImportMapTable(props: ImportMapTableProps) {
<td className={style.input}>
<Input
id={field.title}
size='xs'
variant='ontime-filled-on-light'
size='sm'
variant='ontime-filled'
maxLength={25}
defaultValue={field.value}
placeholder='Use default column name'