// Inhalts-Panel „Flächenbilanz" — listet alle Räume gruppiert nach // ihrer Flächenart (SIA 416) mit Zwischen-/Gesamtsummen und bietet einen // CSV-Export, darüber die Kennzahlenleiste mit Parzelle und Raumprogramm // (KennzahlenSection). Fläche/Bilanz werden LIVE aus den Raum-Umrissen abgeleitet // (geometry/roomArea: evaluateRoom/balance/roomsToCsv) — nie gespeichert. // // Daten kommen aus dem Store (project.rooms). Bezeichner englisch, UI-Text // deutsch via t() (CONVENTIONS.md). import { t } from "../i18n"; import { useStore } from "../state/appStore"; import { balance, evaluateRoom, roomsToCsv, siaLabelFull } from "../core"; import type { Room } from "../model/types"; import { roomDisplayName } from "../model/roomStamp"; import { KennzahlenSection } from "./KennzahlenSection"; import { AreaTableSection } from "./AreaTableSection"; import { UnitsSection } from "./UnitsSection"; import { CostEstimateSection } from "./CostEstimateSection"; import { OpeningScheduleSection } from "./OpeningScheduleSection"; import { ElementScheduleSection } from "./ElementScheduleSection"; import { RoomBookSection } from "./RoomBookSection"; import { downloadCsv } from "./downloadFile"; import { runWithAnonymityGate } from "../state/anonymityGate"; /** Löst je Raum die anrechenbare (Netto-)Fläche + Kategorie auf. */ function roomAreas(rooms: Room[]): { category: Room["siaCategory"]; area: number }[] { return rooms.map((r) => ({ category: r.siaCategory, area: evaluateRoom(r.boundary, r.siaCategory, { bulge: r.boundaryBulge }).netArea, })); } /** Löst den Anzeigenamen eines Geschosses (oder die ID) auf. */ function floorNameOf( levels: { id: string; name: string }[], floorId: string, ): string { return levels.find((z) => z.id === floorId)?.name ?? floorId; } export function RoomBalancePanel() { const project = useStore((s) => s.project); const rooms = project.rooms ?? []; const levels = project.drawingLevels; if (rooms.length === 0) { return (