refactor: visibility options

This commit is contained in:
Carlos Valente
2024-12-20 21:07:31 +01:00
committed by Carlos Valente
parent 430b72c1d0
commit c9ef2465f8
4 changed files with 35 additions and 21 deletions
@@ -3,6 +3,7 @@ import { flexRender, HeaderGroup } from '@tanstack/react-table';
import { OntimeRundownEntry } from 'ontime-types';
import { getAccessibleColour } from '../../../../common/utils/styleUtils';
import { useCuesheetOptions } from '../../cuesheet.options';
import { SortableCell } from './SortableCell';
@@ -10,11 +11,11 @@ import style from '../CuesheetTable.module.scss';
interface CuesheetHeaderProps {
headerGroups: HeaderGroup<OntimeRundownEntry>[];
showIndexColumn: boolean;
}
export default function CuesheetHeader(props: CuesheetHeaderProps) {
const { headerGroups, showIndexColumn } = props;
const { headerGroups } = props;
const { hideIndexColumn, showActionMenu } = useCuesheetOptions();
return (
<thead className={style.tableHeader}>
@@ -23,8 +24,8 @@ export default function CuesheetHeader(props: CuesheetHeaderProps) {
return (
<tr key={headerGroup.id}>
<th className={style.actionColumn} />
<th className={style.indexColumn}>{showIndexColumn && '#'}</th>
{showActionMenu && <th className={style.actionColumn} />}
{!hideIndexColumn && <th className={style.indexColumn}>#</th>}
<SortableContext key={key} items={headerGroup.headers} strategy={horizontalListSortingStrategy}>
{headerGroup.headers.map((header) => {
const width = header.getSize();