Rework the table simulations UI #331
@ -7,7 +7,7 @@ import { TableArrangement } from '@/app/lib/definitions';
|
||||
import { classNames } from "../components/button";
|
||||
import TableOfContents from "../components/table-of-contents";
|
||||
import { loadTableSimulations } from "@/app/api/tableSimulations";
|
||||
import { ArchiveBoxXMarkIcon, CheckBadgeIcon } from "@heroicons/react/24/outline";
|
||||
import { ArchiveBoxXMarkIcon, ArrowsPointingOutIcon, CheckBadgeIcon } from "@heroicons/react/24/outline";
|
||||
import { Tooltip } from "primereact/tooltip";
|
||||
import clsx from "clsx";
|
||||
import { ProgressBar } from "primereact/progressbar";
|
||||
@ -32,13 +32,13 @@ export default function ArrangementsTable({ onArrangementSelected }: { onArrange
|
||||
});
|
||||
}
|
||||
|
||||
function arrangementClicked(e: React.MouseEvent<HTMLElement>) {
|
||||
onArrangementSelected(e.currentTarget.getAttribute('data-arrangement-id') || '');
|
||||
function arrangementClicked(arrangement: TableArrangement) {
|
||||
onArrangementSelected(arrangement.id);
|
||||
}
|
||||
|
||||
return (
|
||||
<TableOfContents
|
||||
headers={['Name', 'Discomfort', 'Status', 'Actions']}
|
||||
headers={['Name', 'Discomfort', 'Actions']}
|
||||
caption='Simulations'
|
||||
elements={arrangements}
|
||||
rowRender={(arrangement) => (
|
||||
@ -52,18 +52,8 @@ export default function ArrangementsTable({ onArrangementSelected }: { onArrange
|
||||
<td className="px-6 py-4">
|
||||
{arrangement.discomfort}
|
||||
</td>
|
||||
<td className="px-4">
|
||||
<Tooltip target=".tooltip-status" />
|
||||
|
||||
<>
|
||||
{ arrangement.valid && arrangement.status === 'not_started' && <ProgressBar mode="indeterminate" style={{ height: '6px' }}></ProgressBar> }
|
||||
{ arrangement.valid && arrangement.status !== 'not_started' && <ProgressBar value={(100 * arrangement.progress).toFixed(2) }></ProgressBar> }
|
||||
|
||||
{ !arrangement.valid && 'The list of potential guests has changed since this simulation.' }
|
||||
</>
|
||||
</td>
|
||||
<td>
|
||||
<button data-arrangement-id={arrangement.id} onClick={arrangementClicked} className={classNames('primary')}>Load</button>
|
||||
<ArrowsPointingOutIcon data-arrangement-id={arrangement.id} onClick={() => arrangementClicked(arrangement)} className='size-6 cursor-pointer' />
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user