Compare commits

...

3 Commits

Author SHA1 Message Date
Renovate Bot
de14be0673 Update dependency @tiptap/react to v3
Some checks failed
Check usage of free licenses / build-static-assets (pull_request) Failing after 5s
Playwright Tests / test (pull_request) Failing after 5s
Build Nginx-based docker image / build-static-assets (push) Failing after 7s
Add copyright notice / copyright_notice (pull_request) Failing after 6s
2025-09-16 22:23:00 +00:00
f6cbc88acd Display simulation progress (#329)
All checks were successful
Check usage of free licenses / build-static-assets (push) Successful in 52s
Build Nginx-based docker image / build-static-assets (push) Successful in 6m15s
Playwright Tests / test (push) Successful in 7m40s
2025-09-16 12:09:17 +00:00
17b9a5e5b4 Display simulation progress
All checks were successful
Add copyright notice / copyright_notice (pull_request) Successful in 3m26s
Check usage of free licenses / build-static-assets (pull_request) Successful in 3m37s
Build Nginx-based docker image / build-static-assets (push) Successful in 40m57s
Playwright Tests / test (pull_request) Successful in 4m16s
2025-09-08 22:47:16 +02:00
7 changed files with 85 additions and 49 deletions

View File

@ -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);

View File

@ -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) => {

View File

@ -14,6 +14,8 @@ export type TableArrangement = {
guests?: Guest[];
discomfort?: number;
valid?: boolean;
progress: number;
status: 'in_progress' | 'completed' | 'not_started';
}
export type User = {

View File

@ -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 {

View File

@ -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>
)}

View File

@ -10,7 +10,7 @@
"@heroicons/react": "^2.1.4",
"@tailwindcss/forms": "^0.5.7",
"@tiptap/pm": "^2.14.0",
"@tiptap/react": "^2.14.0",
"@tiptap/react": "^3.0.0",
"@tiptap/starter-kit": "^2.14.0",
"autoprefixer": "10.4.21",
"bcrypt": "^6.0.0",

87
pnpm-lock.yaml generated
View File

@ -21,8 +21,8 @@ importers:
specifier: ^2.14.0
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)
specifier: ^3.0.0
version: 3.4.3(@floating-ui/dom@1.7.4)(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)(@types/react-dom@18.3.7(@types/react@18.3.23))(@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)
'@tiptap/starter-kit':
specifier: ^2.14.0
version: 2.26.1
@ -124,6 +124,15 @@ packages:
'@emnapi/runtime@1.4.5':
resolution: {integrity: sha512-++LApOtY0pEEz1zrd9vy1/zXVaVJJ/EbAF3u0fXIzPJEDtnITsBGbbK0EkM72amhl/R5b+5xx0Y/QhcVOpuulg==}
'@floating-ui/core@1.7.3':
resolution: {integrity: sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==}
'@floating-ui/dom@1.7.4':
resolution: {integrity: sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==}
'@floating-ui/utils@0.2.10':
resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==}
'@hapi/hoek@9.3.0':
resolution: {integrity: sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==}
@ -354,9 +363,6 @@ packages:
engines: {node: '>=18'}
hasBin: true
'@popperjs/core@2.11.8':
resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==}
'@remirror/core-constants@3.0.0':
resolution: {integrity: sha512-42aWfPrimMfDKDi4YegyS7x+/0tlzaqwPQCULLanv3DMIlu96KTJR0fM5isWX2UViOqlGnX6YFgqWepcX+XMNg==}
@ -392,11 +398,11 @@ packages:
peerDependencies:
'@tiptap/core': ^2.7.0
'@tiptap/extension-bubble-menu@2.26.1':
resolution: {integrity: sha512-oHevUcZbTMFOTpdCEo4YEDe044MB4P1ZrWyML8CGe5tnnKdlI9BN03AXpI1mEEa5CA3H1/eEckXx8EiCgYwQ3Q==}
'@tiptap/extension-bubble-menu@3.4.3':
resolution: {integrity: sha512-P8r8fvdH5Z2cr+KT5SKafAUlzJEz/Pj9/AcliQfOtVvr2s+0g4VdjxAdAF1FPT+xHQVhyfxZlUjL41/t7wygOg==}
peerDependencies:
'@tiptap/core': ^2.7.0
'@tiptap/pm': ^2.7.0
'@tiptap/core': ^3.4.3
'@tiptap/pm': ^3.4.3
'@tiptap/extension-bullet-list@2.26.1':
resolution: {integrity: sha512-HHakuV4ckYCDOnBbne088FvCEP4YICw+wgPBz/V2dfpiFYQ4WzT0LPK9s7OFMCN+ROraoug+1ryN1Z1KdIgujQ==}
@ -425,11 +431,12 @@ packages:
'@tiptap/core': ^2.7.0
'@tiptap/pm': ^2.7.0
'@tiptap/extension-floating-menu@2.26.1':
resolution: {integrity: sha512-OJF+H6qhQogVTMedAGSWuoL1RPe3LZYXONuFCVyzHnvvMpK+BP1vm180E2zDNFnn/DVA+FOrzNGpZW7YjoFH1w==}
'@tiptap/extension-floating-menu@3.4.3':
resolution: {integrity: sha512-amvig9djr7F3fIjIRjoIvOySzVzjABFGeZuAhUsDa/RXEpiS93wHg5Y/ECYyDbNqchl7SrAj9hz7H9DPdmgNKw==}
peerDependencies:
'@tiptap/core': ^2.7.0
'@tiptap/pm': ^2.7.0
'@floating-ui/dom': ^1.0.0
'@tiptap/core': ^3.4.3
'@tiptap/pm': ^3.4.3
'@tiptap/extension-gapcursor@2.26.1':
resolution: {integrity: sha512-KOiMZc3PwJS3hR0nSq5d0TJi2jkNZkLZElcT6pCEnhRHzPH6dRMu9GM5Jj798ZRUy0T9UFcKJalFZaDxnmRnpg==}
@ -497,11 +504,13 @@ packages:
'@tiptap/pm@2.26.1':
resolution: {integrity: sha512-8aF+mY/vSHbGFqyG663ds84b+vca5Lge3tHdTMTKazxCnhXR9dn2oQJMnZ78YZvdRbkPkMJJHti9h3K7u2UQvw==}
'@tiptap/react@2.26.1':
resolution: {integrity: sha512-Zxlwzi1iML7aELa+PyysFD2ncVo2mEcjTkhoDok9iTbMGpm1oU8hgR1i6iHrcSNQLfaRiW6M7HNhZZQPKIC9yw==}
'@tiptap/react@3.4.3':
resolution: {integrity: sha512-eGrTZ4HxfNwMORrgEzVR5Y6eO1dvCmEbGay/EZWrvaBSAL8nayBxdp3nDWXWvL52r4ibwbGnjm+FgtSgxXjYMg==}
peerDependencies:
'@tiptap/core': ^2.7.0
'@tiptap/pm': ^2.7.0
'@tiptap/core': ^3.4.3
'@tiptap/pm': ^3.4.3
'@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
'@types/react-dom': ^17.0.0 || ^18.0.0 || ^19.0.0
react: ^17.0.0 || ^18.0.0 || ^19.0.0
react-dom: ^17.0.0 || ^18.0.0 || ^19.0.0
@ -1307,9 +1316,6 @@ packages:
thenify@3.3.1:
resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==}
tippy.js@6.3.7:
resolution: {integrity: sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==}
to-regex-range@5.0.1:
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
engines: {node: '>=8.0'}
@ -1409,6 +1415,20 @@ snapshots:
tslib: 2.8.1
optional: true
'@floating-ui/core@1.7.3':
dependencies:
'@floating-ui/utils': 0.2.10
optional: true
'@floating-ui/dom@1.7.4':
dependencies:
'@floating-ui/core': 1.7.3
'@floating-ui/utils': 0.2.10
optional: true
'@floating-ui/utils@0.2.10':
optional: true
'@hapi/hoek@9.3.0': {}
'@hapi/topo@5.1.0':
@ -1578,8 +1598,6 @@ snapshots:
dependencies:
playwright: 1.54.1
'@popperjs/core@2.11.8': {}
'@remirror/core-constants@3.0.0': {}
'@sideway/address@4.1.5':
@ -1611,11 +1629,12 @@ snapshots:
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)':
'@tiptap/extension-bubble-menu@3.4.3(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)':
dependencies:
'@floating-ui/dom': 1.7.4
'@tiptap/core': 2.26.1(@tiptap/pm@2.26.1)
'@tiptap/pm': 2.26.1
tippy.js: 6.3.7
optional: true
'@tiptap/extension-bullet-list@2.26.1(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))':
dependencies:
@ -1639,11 +1658,12 @@ snapshots:
'@tiptap/core': 2.26.1(@tiptap/pm@2.26.1)
'@tiptap/pm': 2.26.1
'@tiptap/extension-floating-menu@2.26.1(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)':
'@tiptap/extension-floating-menu@3.4.3(@floating-ui/dom@1.7.4)(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)':
dependencies:
'@floating-ui/dom': 1.7.4
'@tiptap/core': 2.26.1(@tiptap/pm@2.26.1)
'@tiptap/pm': 2.26.1
tippy.js: 6.3.7
optional: true
'@tiptap/extension-gapcursor@2.26.1(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)':
dependencies:
@ -1717,17 +1737,22 @@ 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@3.4.3(@floating-ui/dom@1.7.4)(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)(@types/react-dom@18.3.7(@types/react@18.3.23))(@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)':
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)
'@tiptap/extension-floating-menu': 2.26.1(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)
'@tiptap/pm': 2.26.1
'@types/react': 18.3.23
'@types/react-dom': 18.3.7(@types/react@18.3.23)
'@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)
use-sync-external-store: 1.5.0(react@19.0.0-rc-f38c22b244-20240704)
optionalDependencies:
'@tiptap/extension-bubble-menu': 3.4.3(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)
'@tiptap/extension-floating-menu': 3.4.3(@floating-ui/dom@1.7.4)(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)
transitivePeerDependencies:
- '@floating-ui/dom'
'@tiptap/starter-kit@2.26.1':
dependencies:
@ -2579,10 +2604,6 @@ snapshots:
dependencies:
any-promise: 1.3.0
tippy.js@6.3.7:
dependencies:
'@popperjs/core': 2.11.8
to-regex-range@5.0.1:
dependencies:
is-number: 7.0.0