Compare commits
3 Commits
6160bca434
...
efb4377528
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efb4377528 | ||
| f6cbc88acd | |||
| 17b9a5e5b4 |
@ -8,7 +8,7 @@ import Arrangement from '@/app/ui/arrangements/arrangement';
|
||||
import ArrangementsTable from '@/app/ui/arrangements/arrangements-table';
|
||||
import { classNames } from '@/app/ui/components/button';
|
||||
import { Toast } from 'primereact/toast';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
|
||||
export default function Page() {
|
||||
const toast = useRef<Toast>(null);
|
||||
|
||||
@ -13,6 +13,8 @@ export function loadTableSimulations(onLoad?: (tableSimulations: TableArrangemen
|
||||
name: record.name,
|
||||
discomfort: record.discomfort,
|
||||
valid: record.valid,
|
||||
progress: record.progress,
|
||||
status : record.status
|
||||
});
|
||||
}));
|
||||
}, (error) => {
|
||||
|
||||
@ -14,6 +14,8 @@ export type TableArrangement = {
|
||||
guests?: Guest[];
|
||||
discomfort?: number;
|
||||
valid?: boolean;
|
||||
progress: number;
|
||||
status: 'in_progress' | 'completed' | 'not_started';
|
||||
}
|
||||
|
||||
export type User = {
|
||||
|
||||
@ -22,10 +22,12 @@ export type Table = {
|
||||
export class TableSimulation implements Entity {
|
||||
id?: string;
|
||||
tables: Table[];
|
||||
progress: number;
|
||||
|
||||
constructor(id?: string, tables?: Table[]) {
|
||||
constructor(id?: string, tables?: Table[], progress?: number) {
|
||||
this.id = id;
|
||||
this.tables = tables || [];
|
||||
this.progress = progress || 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +45,7 @@ export class TableSimulationSerializer implements Serializable<TableSimulation>
|
||||
}
|
||||
},
|
||||
}
|
||||
}));
|
||||
}), data.progress);
|
||||
}
|
||||
|
||||
toJson(simulation: TableSimulation): string {
|
||||
|
||||
@ -10,11 +10,21 @@ import { loadTableSimulations } from "@/app/api/tableSimulations";
|
||||
import { ArchiveBoxXMarkIcon, CheckBadgeIcon } from "@heroicons/react/24/outline";
|
||||
import { Tooltip } from "primereact/tooltip";
|
||||
import clsx from "clsx";
|
||||
import { ProgressBar } from "primereact/progressbar";
|
||||
import { useEffect } from "react";
|
||||
import { TableSimulation, TableSimulationSerializer } from "@/app/lib/tableSimulation";
|
||||
import { AbstractApi } from "@/app/api/abstract-api";
|
||||
|
||||
export default function ArrangementsTable({ onArrangementSelected }: { onArrangementSelected: (arrangementId: string) => void }) {
|
||||
const [arrangements, setArrangements] = useState<Array<TableArrangement>>([]);
|
||||
const [arrangementsLoaded, setArrangementsLoaded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
refreshSimulations();
|
||||
const interval = setInterval(refreshSimulations, 10000);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
|
||||
function refreshSimulations() {
|
||||
loadTableSimulations((arrangements) => {
|
||||
setArrangements(arrangements);
|
||||
@ -26,11 +36,9 @@ export default function ArrangementsTable({ onArrangementSelected }: { onArrange
|
||||
onArrangementSelected(e.currentTarget.getAttribute('data-arrangement-id') || '');
|
||||
}
|
||||
|
||||
!arrangementsLoaded && refreshSimulations();
|
||||
|
||||
return (
|
||||
<TableOfContents
|
||||
headers={['Name', 'Discomfort', 'Actions', 'Status']}
|
||||
headers={['Name', 'Discomfort', 'Status', 'Actions']}
|
||||
caption='Simulations'
|
||||
elements={arrangements}
|
||||
rowRender={(arrangement) => (
|
||||
@ -44,17 +52,18 @@ export default function ArrangementsTable({ onArrangementSelected }: { onArrange
|
||||
<td className="px-6 py-4">
|
||||
{arrangement.discomfort}
|
||||
</td>
|
||||
<td>
|
||||
<button data-arrangement-id={arrangement.id} onClick={arrangementClicked} className={classNames('primary')}>Load</button>
|
||||
</td>
|
||||
<td>
|
||||
<td className="px-4">
|
||||
<Tooltip target=".tooltip-status" />
|
||||
|
||||
{
|
||||
arrangement.valid ?
|
||||
<CheckBadgeIcon className='size-6 tooltip-status' data-pr-position="right" data-pr-tooltip="Simulation is valid" /> :
|
||||
<ArchiveBoxXMarkIcon className='size-6 tooltip-status' data-pr-position="right" data-pr-tooltip="Simulation is expired due to attendance or affinity changes" />
|
||||
}
|
||||
<>
|
||||
{ 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>
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
"primeicons": "^7.0.0",
|
||||
"primereact": "^10.8.2",
|
||||
"react": "19.0.0-rc-f38c22b244-20240704",
|
||||
"react-dom": "19.0.0-rc-f38c22b244-20240704",
|
||||
"react-dom": "19.1.1",
|
||||
"tailwindcss": "3.4.17",
|
||||
"typescript": "5.8.3",
|
||||
"use-debounce": "^10.0.1",
|
||||
@ -34,7 +34,7 @@
|
||||
"@types/bcrypt": "^5.0.2",
|
||||
"@types/node": "24.3.1",
|
||||
"@types/react": "18.3.23",
|
||||
"@types/react-dom": "18.3.7",
|
||||
"@types/react-dom": "19.1.9",
|
||||
"wait-on": "^8.0.3"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
62
pnpm-lock.yaml
generated
62
pnpm-lock.yaml
generated
@ -22,7 +22,7 @@ importers:
|
||||
version: 2.26.1
|
||||
'@tiptap/react':
|
||||
specifier: ^2.14.0
|
||||
version: 2.26.1(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
version: 2.26.1(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)(react-dom@19.1.1(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
'@tiptap/starter-kit':
|
||||
specifier: ^2.14.0
|
||||
version: 2.26.1
|
||||
@ -40,10 +40,10 @@ importers:
|
||||
version: 3.2.6
|
||||
next:
|
||||
specifier: 15.4.5
|
||||
version: 15.4.5(@playwright/test@1.54.1)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
version: 15.4.5(@playwright/test@1.54.1)(react-dom@19.1.1(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
next-auth:
|
||||
specifier: 5.0.0-beta.29
|
||||
version: 5.0.0-beta.29(next@15.4.5(@playwright/test@1.54.1)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
version: 5.0.0-beta.29(next@15.4.5(@playwright/test@1.54.1)(react-dom@19.1.1(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
postcss:
|
||||
specifier: 8.5.6
|
||||
version: 8.5.6
|
||||
@ -52,13 +52,13 @@ importers:
|
||||
version: 7.0.0
|
||||
primereact:
|
||||
specifier: ^10.8.2
|
||||
version: 10.9.6(@types/react@18.3.23)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
version: 10.9.6(@types/react@18.3.23)(react-dom@19.1.1(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react:
|
||||
specifier: 19.0.0-rc-f38c22b244-20240704
|
||||
version: 19.0.0-rc-f38c22b244-20240704
|
||||
react-dom:
|
||||
specifier: 19.0.0-rc-f38c22b244-20240704
|
||||
version: 19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704)
|
||||
specifier: 19.1.1
|
||||
version: 19.1.1(react@19.0.0-rc-f38c22b244-20240704)
|
||||
tailwindcss:
|
||||
specifier: 3.4.17
|
||||
version: 3.4.17
|
||||
@ -88,8 +88,8 @@ importers:
|
||||
specifier: 18.3.23
|
||||
version: 18.3.23
|
||||
'@types/react-dom':
|
||||
specifier: 18.3.7
|
||||
version: 18.3.7(@types/react@18.3.23)
|
||||
specifier: 19.1.9
|
||||
version: 19.1.9(@types/react@18.3.23)
|
||||
wait-on:
|
||||
specifier: ^8.0.3
|
||||
version: 8.0.4
|
||||
@ -526,10 +526,10 @@ packages:
|
||||
'@types/prop-types@15.7.12':
|
||||
resolution: {integrity: sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==}
|
||||
|
||||
'@types/react-dom@18.3.7':
|
||||
resolution: {integrity: sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==}
|
||||
'@types/react-dom@19.1.9':
|
||||
resolution: {integrity: sha512-qXRuZaOsAdXKFyOhRBg6Lqqc0yay13vN7KrIg4L7N4aaHN68ma9OK3NE1BoDFgFOTfM7zg+3/8+2n8rLUH3OKQ==}
|
||||
peerDependencies:
|
||||
'@types/react': ^18.0.0
|
||||
'@types/react': ^19.0.0
|
||||
|
||||
'@types/react-transition-group@4.4.12':
|
||||
resolution: {integrity: sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w==}
|
||||
@ -1184,10 +1184,10 @@ packages:
|
||||
raf-schd@4.0.3:
|
||||
resolution: {integrity: sha512-tQkJl2GRWh83ui2DiPTJz9wEiMN20syf+5oKfB03yYP7ioZcJwsIK8FjrtLwH1m7C7e+Tt2yYBlrOpdT+dyeIQ==}
|
||||
|
||||
react-dom@19.0.0-rc-f38c22b244-20240704:
|
||||
resolution: {integrity: sha512-g89q2pf3irdpKFUMgCQgtxgqo3TSV1k1J6Sc8God4FwfxuNmAOOthkijENe5XZe6VeV1tor9DPzpjdTD9EyvNw==}
|
||||
react-dom@19.1.1:
|
||||
resolution: {integrity: sha512-Dlq/5LAZgF0Gaz6yiqZCf6VCcZs1ghAJyrsu84Q/GT0gV+mCxbfmKNoGRKBYMJ8IEdGPqu49YWXD02GCknEDkw==}
|
||||
peerDependencies:
|
||||
react: 19.0.0-rc-f38c22b244-20240704
|
||||
react: ^19.1.1
|
||||
|
||||
react-is@16.13.1:
|
||||
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
|
||||
@ -1226,8 +1226,8 @@ packages:
|
||||
rxjs@7.8.2:
|
||||
resolution: {integrity: sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==}
|
||||
|
||||
scheduler@0.25.0-rc-f38c22b244-20240704:
|
||||
resolution: {integrity: sha512-uAELK9fHhvg7kDQhk29+uO8FUMWUpkg9WpzkNXFP+BJy5HEtqnajde3CxuSgh202WH9TqoaiWT1mdA3DvUu6cQ==}
|
||||
scheduler@0.26.0:
|
||||
resolution: {integrity: sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==}
|
||||
|
||||
semver@7.7.2:
|
||||
resolution: {integrity: sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==}
|
||||
@ -1717,7 +1717,7 @@ snapshots:
|
||||
prosemirror-transform: 1.10.4
|
||||
prosemirror-view: 1.40.0
|
||||
|
||||
'@tiptap/react@2.26.1(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)':
|
||||
'@tiptap/react@2.26.1(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)(react-dom@19.1.1(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)':
|
||||
dependencies:
|
||||
'@tiptap/core': 2.26.1(@tiptap/pm@2.26.1)
|
||||
'@tiptap/extension-bubble-menu': 2.26.1(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)
|
||||
@ -1726,7 +1726,7 @@ snapshots:
|
||||
'@types/use-sync-external-store': 0.0.6
|
||||
fast-deep-equal: 3.1.3
|
||||
react: 19.0.0-rc-f38c22b244-20240704
|
||||
react-dom: 19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react-dom: 19.1.1(react@19.0.0-rc-f38c22b244-20240704)
|
||||
use-sync-external-store: 1.5.0(react@19.0.0-rc-f38c22b244-20240704)
|
||||
|
||||
'@tiptap/starter-kit@2.26.1':
|
||||
@ -1772,7 +1772,7 @@ snapshots:
|
||||
|
||||
'@types/prop-types@15.7.12': {}
|
||||
|
||||
'@types/react-dom@18.3.7(@types/react@18.3.23)':
|
||||
'@types/react-dom@19.1.9(@types/react@18.3.23)':
|
||||
dependencies:
|
||||
'@types/react': 18.3.23
|
||||
|
||||
@ -2163,20 +2163,20 @@ snapshots:
|
||||
|
||||
nanoid@3.3.11: {}
|
||||
|
||||
next-auth@5.0.0-beta.29(next@15.4.5(@playwright/test@1.54.1)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
next-auth@5.0.0-beta.29(next@15.4.5(@playwright/test@1.54.1)(react-dom@19.1.1(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
dependencies:
|
||||
'@auth/core': 0.40.0
|
||||
next: 15.4.5(@playwright/test@1.54.1)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
next: 15.4.5(@playwright/test@1.54.1)(react-dom@19.1.1(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react: 19.0.0-rc-f38c22b244-20240704
|
||||
|
||||
next@15.4.5(@playwright/test@1.54.1)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
next@15.4.5(@playwright/test@1.54.1)(react-dom@19.1.1(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
dependencies:
|
||||
'@next/env': 15.4.5
|
||||
'@swc/helpers': 0.5.15
|
||||
caniuse-lite: 1.0.30001702
|
||||
postcss: 8.4.31
|
||||
react: 19.0.0-rc-f38c22b244-20240704
|
||||
react-dom: 19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react-dom: 19.1.1(react@19.0.0-rc-f38c22b244-20240704)
|
||||
styled-jsx: 5.1.6(react@19.0.0-rc-f38c22b244-20240704)
|
||||
optionalDependencies:
|
||||
'@next/swc-darwin-arm64': 15.4.5
|
||||
@ -2287,12 +2287,12 @@ snapshots:
|
||||
|
||||
primeicons@7.0.0: {}
|
||||
|
||||
primereact@10.9.6(@types/react@18.3.23)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
primereact@10.9.6(@types/react@18.3.23)(react-dom@19.1.1(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
dependencies:
|
||||
'@types/react-transition-group': 4.4.12(@types/react@18.3.23)
|
||||
react: 19.0.0-rc-f38c22b244-20240704
|
||||
react-dom: 19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react-transition-group: 4.4.5(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react-dom: 19.1.1(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react-transition-group: 4.4.5(react-dom@19.1.1(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
optionalDependencies:
|
||||
'@types/react': 18.3.23
|
||||
|
||||
@ -2413,21 +2413,21 @@ snapshots:
|
||||
|
||||
raf-schd@4.0.3: {}
|
||||
|
||||
react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704):
|
||||
react-dom@19.1.1(react@19.0.0-rc-f38c22b244-20240704):
|
||||
dependencies:
|
||||
react: 19.0.0-rc-f38c22b244-20240704
|
||||
scheduler: 0.25.0-rc-f38c22b244-20240704
|
||||
scheduler: 0.26.0
|
||||
|
||||
react-is@16.13.1: {}
|
||||
|
||||
react-transition-group@4.4.5(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
react-transition-group@4.4.5(react-dom@19.1.1(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
dependencies:
|
||||
'@babel/runtime': 7.27.6
|
||||
dom-helpers: 5.2.1
|
||||
loose-envify: 1.4.0
|
||||
prop-types: 15.8.1
|
||||
react: 19.0.0-rc-f38c22b244-20240704
|
||||
react-dom: 19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react-dom: 19.1.1(react@19.0.0-rc-f38c22b244-20240704)
|
||||
|
||||
react@19.0.0-rc-f38c22b244-20240704: {}
|
||||
|
||||
@ -2457,7 +2457,7 @@ snapshots:
|
||||
dependencies:
|
||||
tslib: 2.8.1
|
||||
|
||||
scheduler@0.25.0-rc-f38c22b244-20240704: {}
|
||||
scheduler@0.26.0: {}
|
||||
|
||||
semver@7.7.2:
|
||||
optional: true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user