Compare commits

...

3 Commits

Author SHA1 Message Date
Renovate Bot
ea9eb83d4a Update dependency @types/bcrypt to v6
Some checks failed
Build Nginx-based docker image / build-static-assets (push) Failing after 3s
Check usage of free licenses / build-static-assets (pull_request) Failing after 2s
Add copyright notice / copyright_notice (pull_request) Failing after 3s
Playwright Tests / test (pull_request) Failing after 1s
2025-09-16 22:23:46 +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 36 additions and 21 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

@ -31,7 +31,7 @@
},
"devDependencies": {
"@playwright/test": "^1.52.0",
"@types/bcrypt": "^5.0.2",
"@types/bcrypt": "^6.0.0",
"@types/node": "24.3.1",
"@types/react": "18.3.23",
"@types/react-dom": "18.3.7",

10
pnpm-lock.yaml generated
View File

@ -79,8 +79,8 @@ importers:
specifier: ^1.52.0
version: 1.54.1
'@types/bcrypt':
specifier: ^5.0.2
version: 5.0.2
specifier: ^6.0.0
version: 6.0.0
'@types/node':
specifier: 24.3.1
version: 24.3.1
@ -508,8 +508,8 @@ packages:
'@tiptap/starter-kit@2.26.1':
resolution: {integrity: sha512-oziMGCds8SVQ3s5dRpBxVdEKZAmO/O//BjZ69mhA3q4vJdR0rnfLb5fTxSeQvHiqB878HBNn76kNaJrHrV35GA==}
'@types/bcrypt@5.0.2':
resolution: {integrity: sha512-6atioO8Y75fNcbmj0G7UjI9lXN2pQ/IGJ2FWT4a/btd0Lk9lQalHLKhkgKVZ3r+spnmWUKfbMi1GEe9wyHQfNQ==}
'@types/bcrypt@6.0.0':
resolution: {integrity: sha512-/oJGukuH3D2+D+3H4JWLaAsJ/ji86dhRidzZ/Od7H/i8g+aCmvkeCc6Ni/f9uxGLSQVCRZkX2/lqEFG2BvWtlQ==}
'@types/linkify-it@5.0.0':
resolution: {integrity: sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==}
@ -1753,7 +1753,7 @@ snapshots:
'@tiptap/extension-text-style': 2.26.1(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))
'@tiptap/pm': 2.26.1
'@types/bcrypt@5.0.2':
'@types/bcrypt@6.0.0':
dependencies:
'@types/node': 24.3.1