31 lines
1.1 KiB
TypeScript
Raw Normal View History

/* Copyright (C) 2024-2025 LibreWeddingPlanner contributors*/
2024-10-27 21:11:45 +00:00
'use client';
import { AbstractApi } from '@/app/api/abstract-api';
import { TableSimulation, TableSimulationSerializer } from '@/app/lib/tableSimulation';
import Arrangement from '@/app/ui/arrangements/arrangement';
import ArrangementsTable from '@/app/ui/arrangements/arrangements-table';
import { classNames } from '@/app/ui/components/button';
import { useState } from 'react';
2024-11-01 18:25:00 +01:00
export default function Page() {
const [currentArrangement, setCurrentArrangement] = useState<string | null>(null);
function createSimulation() {
const api = new AbstractApi<TableSimulation>();
const serializer = new TableSimulationSerializer();
api.create(serializer, new TableSimulation(), () => {});
}
return (
<>
<div className="flex flex-col w-full items-center justify-between">
<button onClick={createSimulation} className={classNames('primary')}>Add new</button>
</div>
<ArrangementsTable onArrangementSelected={setCurrentArrangement} />
{currentArrangement && <Arrangement key={currentArrangement} id={currentArrangement} />}
</>
)
2024-08-11 12:34:16 +02:00
}