Files
DOSSIER/src/panels/ReportTable.tsx
T
Claude 273274c1b1
check / check (push) Has been cancelled
check / licenses (push) Has been cancelled
check / e2e (push) Has been cancelled
macos / native (push) Has been cancelled
cycles / linux (push) Has been cancelled
cycles / macos (push) Has been cancelled
[283] UX-Prüfung Teil 2: Wohnungsspiegel-Umbruch, Varianten-Knöpfe, Träger-Klasse 35, Geländer-Abschnitt, Englisch (Kürzel, Abbruch)
2026-11-18 17:51:59 +00:00

50 lines
2.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Ein Abschnitt des Berichtsmodells (`ReportSection` aus `export/areaReport.ts`) als Tabelle im Panel. Gemeinsam für die
// Flächentabelle (`AreaTableSection`) und den Wohnungsspiegel (`UnitsSection`): was hier steht, steht auch im Export.
import type { ReportSection } from "../export/areaReport";
export function ReportTable({ section: s }: { section: ReportSection }) {
return (
<div className="area-block">
<div className="area-heading">{s.heading}</div>
<div className="area-scroll">
<table className={s.columns.length > 6 ? "area-table wide" : "area-table"}>
<thead>
<tr>
{s.columns.map((c, i) => (
<th key={i} className={i === 0 ? "" : "num"}>
{c}
</th>
))}
</tr>
</thead>
<tbody>
{s.rows.map((r, ri) => (
<tr key={ri} className={r.total ? "total" : ""}>
{r.cells.map((c, ci) =>
typeof c === "string" ? (
// Kurze Textzellen in Zahlenspalten (Strich, ja/nein) stehen wie die Zahlen rechts.
<td key={ci} data-label={ci > 0 ? s.columns[ci] : undefined} data-span={cardSpan(c, s.columns[ci])} className={ci > 0 && c.length <= 4 ? "num" : undefined}>
{c}
</td>
) : (
<td key={ci} data-label={ci > 0 ? s.columns[ci] : undefined} data-span={cardSpan("", s.columns[ci])} className="num">
{c.n === null ? "–" : c.n.toFixed(c.d)}
</td>
),
)}
</tr>
))}
</tbody>
</table>
</div>
</div>
);
}
/** Kartenansicht im schmalen Dock: lange Texte und lange Spaltenköpfe („Aussenraum m²“) belegen zwei bzw. drei Rasterspalten, damit nichts mitten im Wort bricht. */
function cardSpan(text: string, head: string | undefined): string | undefined {
if (text.length > 22) return "3";
return text.length > 7 || (head?.length ?? 0) > 9 ? "2" : undefined;
}