-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
113 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,90 @@ | ||
import { OntimeEntryCommonKeys, OntimeEvent } from 'ontime-types'; | ||
import { useMemo } from 'react'; | ||
import { useSearchParams } from 'react-router-dom'; | ||
|
||
import { ViewOption } from '../../common/components/view-params-editor/types'; | ||
import { isStringBoolean } from '../../features/viewers/common/viewUtils'; | ||
|
||
/** | ||
* @description set default column order | ||
* In the specific case of the cuesheet options | ||
* we save the user preferences in the local storage | ||
*/ | ||
export const defaultColumnOrder: OntimeEntryCommonKeys[] = [ | ||
'isPublic', | ||
'cue', | ||
'timeStart', | ||
'timeEnd', | ||
'duration', | ||
'title', | ||
'note', | ||
export const cuesheetOptions: ViewOption[] = [ | ||
{ section: 'Table options' }, | ||
{ | ||
id: 'hideTableSeconds', | ||
title: 'Hide seconds in table', | ||
description: 'Whether to hide seconds in the time fields displayed in the table', | ||
type: 'boolean', | ||
defaultValue: false, | ||
}, | ||
{ | ||
id: 'followSelected', | ||
title: 'Follow selected event', | ||
description: 'Whether the view should automatically scroll to the selected event', | ||
type: 'boolean', | ||
defaultValue: false, | ||
}, | ||
{ | ||
id: 'hidePast', | ||
title: 'Hide Past Events', | ||
description: 'Whether to hide events that have passed', | ||
type: 'boolean', | ||
defaultValue: false, | ||
}, | ||
{ | ||
id: 'hideIndexColumn', | ||
title: 'Hide index column', | ||
description: 'Whether the hide the event indexes in the table', | ||
type: 'boolean', | ||
defaultValue: false, | ||
}, | ||
{ section: 'Delay flow' }, | ||
{ | ||
id: 'showDelayedTimes', | ||
title: 'Show delayed times', | ||
description: 'Whether the time fields should include delays', | ||
type: 'boolean', | ||
defaultValue: false, | ||
}, | ||
{ | ||
id: 'hideDelays', | ||
title: 'Hide delays', | ||
description: 'Whether to hide the rows containing scheduled delays', | ||
type: 'boolean', | ||
defaultValue: false, | ||
}, | ||
]; | ||
|
||
type CuesheetOptions = { | ||
hideTableSeconds: boolean; | ||
followSelected: boolean; | ||
hidePast: boolean; | ||
hideIndexColumn: boolean; | ||
showDelayedTimes: boolean; | ||
hideDelays: boolean; | ||
}; | ||
|
||
/** | ||
* Utility extract the view options from URL Params | ||
* the names and fallbacks are manually matched with cuesheetOptions | ||
*/ | ||
export function getOptionsFromParams(searchParams: URLSearchParams): CuesheetOptions { | ||
// we manually make an object that matches the key above | ||
return { | ||
hideTableSeconds: isStringBoolean(searchParams.get('hideTableSeconds')), | ||
followSelected: isStringBoolean(searchParams.get('followSelected')), | ||
hidePast: isStringBoolean(searchParams.get('hidePast')), | ||
hideIndexColumn: isStringBoolean(searchParams.get('hideIndexColumn')), | ||
showDelayedTimes: isStringBoolean(searchParams.get('showDelayedTimes')), | ||
hideDelays: isStringBoolean(searchParams.get('hideDelays')), | ||
}; | ||
} | ||
|
||
/** | ||
* @description set default hidden columns | ||
* Hook exposes the cuesheet view options | ||
*/ | ||
export const defaultHiddenColumns: (keyof OntimeEvent)[] = []; | ||
export function useCuesheetOptions(): CuesheetOptions { | ||
const [searchParams] = useSearchParams(); | ||
const options = useMemo(() => getOptionsFromParams(searchParams), [searchParams]); | ||
return options; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 0 additions & 85 deletions
85
apps/client/src/views/cuesheet/store/cuesheetSettingsStore.tsx
This file was deleted.
Oops, something went wrong.