keep the index row as a colour chip (#1039)

This commit is contained in:
Alex Christoffer Rasmussen
2024-06-03 22:38:22 +02:00
committed by GitHub
parent 2076080c5f
commit a3b21072eb
4 changed files with 8 additions and 11 deletions
@@ -36,7 +36,6 @@ $table-header-font-size: calc(1rem - 3px);
min-width: 2rem; min-width: 2rem;
text-align: right; text-align: right;
font-weight: 400; font-weight: 400;
position: sticky; position: sticky;
left: 0; left: 0;
z-index: 1; z-index: 1;
@@ -60,7 +60,7 @@ export default function CuesheetHeader(props: CuesheetHeaderProps) {
return ( return (
<DndContext key={key} sensors={sensors} collisionDetection={closestCorners} onDragEnd={handleOnDragEnd}> <DndContext key={key} sensors={sensors} collisionDetection={closestCorners} onDragEnd={handleOnDragEnd}>
<tr key={headerGroup.id}> <tr key={headerGroup.id}>
{showIndexColumn && <th className={style.indexColumn}>#</th>} <th className={style.indexColumn}>{showIndexColumn && '#'}</th>
<SortableContext key={key} items={headerGroup.headers} strategy={horizontalListSortingStrategy}> <SortableContext key={key} items={headerGroup.headers} strategy={horizontalListSortingStrategy}>
{headerGroup.headers.map((header) => { {headerGroup.headers.map((header) => {
const width = header.getSize(); const width = header.getSize();
@@ -56,11 +56,9 @@ function EventRow(props: PropsWithChildren<EventRowProps>) {
style={{ opacity: `${isPast ? pastOpacity : '1'}` }} style={{ opacity: `${isPast ? pastOpacity : '1'}` }}
ref={selectedRef ?? ownRef} ref={selectedRef ?? ownRef}
> >
{showIndexColumn && ( <td className={style.indexColumn} style={{ backgroundColor: bgColour, color: textColour.color }}>
<td className={style.indexColumn} style={{ backgroundColor: bgColour, color: textColour.color }}> {showIndexColumn && eventIndex}
{eventIndex} </td>
</td>
)}
{isVisible ? children : null} {isVisible ? children : null}
</tr> </tr>
); );
@@ -40,10 +40,6 @@ function CuesheetTableSettings(props: CuesheetTableSettingsProps) {
<div className={style.leftPanel}> <div className={style.leftPanel}>
<div className={style.sectionTitle}>Toggle column visibility</div> <div className={style.sectionTitle}>Toggle column visibility</div>
<div className={style.options}> <div className={style.options}>
<label className={style.option}>
<Checkbox variant='ontime-ondark' defaultChecked={showIndexColumn} onChange={() => toggleIndexColumn()} />
Event Order
</label>
{columns.map((column) => { {columns.map((column) => {
const columnHeader = column.columnDef.header; const columnHeader = column.columnDef.header;
const visible = column.getIsVisible(); const visible = column.getIsVisible();
@@ -69,6 +65,10 @@ function CuesheetTableSettings(props: CuesheetTableSettingsProps) {
<Switch variant='ontime' size='sm' isChecked={showPrevious} onChange={() => togglePreviousVisibility()} /> <Switch variant='ontime' size='sm' isChecked={showPrevious} onChange={() => togglePreviousVisibility()} />
Show past events Show past events
</label> </label>
<label className={style.option}>
<Switch variant='ontime' size='sm' isChecked={showIndexColumn} onChange={() => toggleIndexColumn()} />
Show Event Order
</label>
</div> </div>
<div className={style.sectionTitle}>Delay Flow</div> <div className={style.sectionTitle}>Delay Flow</div>
<div className={style.options}> <div className={style.options}>