/* Copyright (C) 2024-2025 LibreWeddingPlanner contributors*/ 'use client' import React, { useState } from "react" import { TableArrangement } from '@/app/lib/definitions'; import { classNames } from "../components/button"; import TableOfContents from "../components/table-of-contents"; import { loadTableSimulations } from "@/app/api/tableSimulations"; export default function ArrangementsTable ({onArrangementSelected}: {onArrangementSelected: (arrangementId: string) => void}) { const [arrangements, setArrangements] = useState>([]); const [arrangementsLoaded, setArrangementsLoaded] = useState(false); function refreshSimulations() { loadTableSimulations((arrangements) => { setArrangements(arrangements); setArrangementsLoaded(true); }); } function arrangementClicked(e: React.MouseEvent) { onArrangementSelected(e.currentTarget.getAttribute('data-arrangement-id') || ''); } !arrangementsLoaded && refreshSimulations(); return( ( {arrangement.name} {arrangement.discomfort} )} /> ); }