// Flächentabelle (Flächenarten je Geschoss) und IVHB-Kennziffern im Flächenbilanz-Panel ([70]). // // • Die Tabellen stammen aus demselben Berichtsmodell wie CSV und PDF (`buildAreaReport`): // was hier steht, steht auch im Export. // • Eingaben, die das Modell nicht hergibt (anrechenbare Grundstücksfläche, Grünfläche, Basis der // aGF, Untergeschosse), liegen nur in der Ansicht (nicht im Projekt). // Herleitung der Zahlen: `src-tauri/core/src/flaechen.rs`. import { useMemo, useState } from "react"; import { t } from "../i18n"; import { areaReportToCsv, buildAreaReport, buildAreaReportPdf } from "../core"; import type { AgfBasis } from "../core"; import { DEFAULT_AREA_INPUTS, ivhbOptionsOf, type AreaInputs } from "./areaInputs"; import { downloadCsv } from "./downloadFile"; import { useStore } from "../state/appStore"; const BASES: AgfBasis[] = ["ngf", "gf", "nf"]; export function AreaTableSection() { const project = useStore((s) => s.project); const [inputs, setInputs] = useState(DEFAULT_AREA_INPUTS); const notify = useStore((s) => s.notify); const report = useMemo( () => buildAreaReport(project, { areas: true, ivhb: true, ivhbOptions: ivhbOptionsOf(inputs) }), // eslint-disable-next-line react-hooks/exhaustive-deps [project, inputs], ); const set = (patch: Partial) => setInputs((i) => ({ ...i, ...patch })); const stem = `${project.name || "projekt"}-flaechen`; const exportPdf = () => { try { buildAreaReportPdf(report).save(`${stem}.pdf`); } catch { notify(t("areas.exportPdf.fail")); } }; return (
{t("areas.title")}
{report.sections.map((s, si) => (
{s.heading}
{s.columns.map((c, i) => ( ))} {s.rows.map((r, ri) => ( {r.cells.map((c, ci) => typeof c === "string" ? ( ) : ( ), )} ))}
{c}
{c} {c.n === null ? "–" : c.n.toFixed(c.d)}
))}
    {report.notes.map((n, i) => (
  • {n}
  • ))}
); }