Merge branch 'worktree-agent-ae0df7110bf4298e3' into claude/practical-noether-1hb2s1
This commit is contained in:
13 files changed
+1975
-110
No files matched your search
@@ -3,6 +3,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import type { IfcElementsSummary } from "../io/ifcImport";
|
||||
|
||||
export type IfcImportMode = "mesh" | "elements";
|
||||
|
||||
@@ -67,3 +68,100 @@ export function IfcImportDialog({ fileName, onImport, onCancel }: IfcImportDialo
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Zeilen „erkannt" des Berichts: Zähler aus der Zusammenfassung des Kerns. */
|
||||
const RECOGNIZED: ReadonlyArray<[string, (s: IfcElementsSummary) => number]> = [
|
||||
["ifc.importReport.walls", (s) => s.walls],
|
||||
["ifc.importReport.openings", (s) => s.openings],
|
||||
["ifc.importReport.ceilings", (s) => s.ceilings],
|
||||
["ifc.importReport.roofs", (s) => s.roofs ?? 0],
|
||||
["ifc.importReport.stairs", (s) => s.stairs ?? 0],
|
||||
["ifc.importReport.columns", (s) => s.columns],
|
||||
["ifc.importReport.rooms", (s) => s.rooms],
|
||||
["ifc.importReport.floors", (s) => s.floors],
|
||||
[
|
||||
"ifc.importReport.types",
|
||||
(s) => s.wallTypes + s.ceilingTypes + (s.roofTypes ?? 0) + (s.doorTypes ?? 0) + (s.windowTypes ?? 0),
|
||||
],
|
||||
["ifc.importReport.meshes", (s) => s.meshes],
|
||||
];
|
||||
|
||||
/** Bericht nach dem Bauteil-Import ([B4]): was erkannt wurde und was mit welchem Grund Mesh blieb. */
|
||||
export function IfcImportReportDialog({
|
||||
fileName,
|
||||
summary,
|
||||
onClose,
|
||||
}: {
|
||||
fileName: string;
|
||||
summary: IfcElementsSummary;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape" || e.key === "Enter") onClose();
|
||||
};
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
}, [onClose]);
|
||||
const kept = Object.entries(summary.keptReasons ?? {}).flatMap(([cls, reasons]) =>
|
||||
Object.entries(reasons).map(([why, n]) => ({ cls, why, n })),
|
||||
);
|
||||
return (
|
||||
<div className="imp-overlay" onClick={onClose}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("ifc.importReport.title")}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<header className="imp-head">
|
||||
<span className="imp-head-title">{t("ifc.importReport.title")}</span>
|
||||
<button className="imp-close" onClick={onClose} aria-label={t("export.close")}>
|
||||
×
|
||||
</button>
|
||||
</header>
|
||||
<div className="imp-body">
|
||||
<section className="imp-section">
|
||||
<div className="imp-section-title">
|
||||
{fileName} · {t("ifc.importReport.recognized")}
|
||||
</div>
|
||||
<table className="imp-table">
|
||||
<tbody>
|
||||
{RECOGNIZED.map(([key, n]) => (
|
||||
<tr key={key}>
|
||||
<td>{t(key)}</td>
|
||||
<td style={{ textAlign: "right" }}>{n(summary)}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<section className="imp-section">
|
||||
<div className="imp-section-title">{t("ifc.importReport.kept")}</div>
|
||||
{kept.length === 0 ? (
|
||||
<div className="imp-note">{t("ifc.importReport.keptNone")}</div>
|
||||
) : (
|
||||
<table className="imp-table">
|
||||
<tbody>
|
||||
{kept.map(({ cls, why, n }) => (
|
||||
<tr key={`${cls}/${why}`}>
|
||||
<td>{cls}</td>
|
||||
<td>{t(`ifc.reason.${why}`)}</td>
|
||||
<td style={{ textAlign: "right" }}>{n}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
<footer className="imp-foot">
|
||||
<button className="imp-btn primary" onClick={onClose}>
|
||||
{t("ifc.importReport.close")}
|
||||
</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user