[274] Umbau je Schicht: Sanierung mehrschichtiger Wände über Typ-Paar Bestand → Sanierungstyp

Modell (Rust, gen:types): WallType.renovationTarget/renovationSide/renovationOld/renovationNew, Wand
renovation.renovated bzw. renovation.newTypeId (Ausnahme). Kern renovation::build_up: Zuordnung von der
Bezugsseite her (Baustoff + Dicke + Lage = Bestand, manuell überschreibbar), gezeigter Aufbau je Filter
(alt, neu, überlagert in Teilschichten), Ersatzwand mit Ersatztyp und Achsversatz für Grundriss, Schnitt,
Ansicht, Axo, 3D und Kennzahlen; Farben je Schicht, Abbruch-Kanten gestrichelt, im Umbauplan gelbe
gestrichelte Kontur über der roten Füllung. Abfragen renovationPair/renovationPairs.

Oberfläche: Objekt-Info „Neuer Aufbau (Sanierung)“ mit Streifen Alt/Neu/Ergebnis, Umbau-Panel Abschnitt
„Sanierung“ (Typ-Paare, Editor, Sanierungstyp anlegen, alle Wände vom Typ sanieren). Beispiel Umbau: Südwand
Beton 20 + Dämmung 10 → Dämmung 20, Schnitt C. Tests: Kern renovation_layers_tests.rs, vitest
renovationLayers.test.ts, e2e renovation274.spec.ts; Bilder doc/review-274. Nicht in der Tauri-App/auf dem
Mac geprüft, 3D-Bild nicht angesehen.
This commit is contained in:
Claude committed 2026-11-17 17:54:25 +00:00
1 parent 539a0333c5
commit 12cfc69e24
36 files changed
+2017 -44

No files matched your search

+60 -2
View File
@@ -4,8 +4,9 @@
import { memo } from "react";
import { t } from "../../i18n";
import type { RenovationStatus } from "../../model/types";
import { RENOVATION_STATUSES } from "../../core";
import { useStore } from "../../state/appStore";
import { RENOVATION_STATUSES, commonBuildUp, parseBuildUpKey, renovationPair, setBuildUpOps } from "../../core";
import { getState, useStore } from "../../state/appStore";
import { RenovationStrip } from "../../ui/RenovationStrip";
import { useRenovationSelection } from "../../state/renovationHook";
import { Dropdown } from "../../ui/Dropdown";
@@ -44,6 +45,7 @@ export const RenovationField = memo(function RenovationField() {
width={150}
/>
</div>
<BuildUpField />
{phases.length > 0 && (
<div className="objinfo-field" data-testid="objinfo-renovation-phase">
<span className="objinfo-flabel">{t("renovation.phase")}</span>
@@ -62,3 +64,59 @@ export const RenovationField = memo(function RenovationField() {
</>
);
});
const NO_TYPES: readonly { id: string; name: string; renovationTarget?: string }[] = [];
/**
* [274] „Neuer Aufbau (Sanierung)“ der gewählten Wände: keiner, wie Typ (Sanierungstyp des Wandtyps) oder ein anderer
* Wandtyp (Ausnahme). Mehrfachauswahl in einem Undo-Schritt; bei gemeinsamem Wandtyp der Streifen Alt/Neu/Ergebnis.
*/
const BuildUpField = memo(function BuildUpField() {
const types = useStore((s) => s.project.wallTypes) ?? NO_TYPES;
const applyChange = useStore((s) => s.applyChange);
const wallIds = useStore((s) => s.selection.walls);
// Gemeinsamer Aufbau und gemeinsamer Wandtyp als Text: rendert nur bei echter Änderung neu.
const key = useStore((s) => {
const set = new Set(s.selection.walls);
const ts = new Set(s.project.walls.filter((w) => set.has(w.id)).map((w) => w.wallTypeId));
return JSON.stringify([commonBuildUp(s.project, s.selection.walls), ts.size === 1 ? [...ts][0] : null]);
});
const [common, typeId] = JSON.parse(key) as [string | null, string | null];
if (common === null || wallIds.length === 0) return null;
const own = typeId ? types.find((x) => x.id === typeId) : undefined;
const ownTarget = own?.renovationTarget ? types.find((x) => x.id === own.renovationTarget) : undefined;
const options = [
...(common === "mixed" ? [{ value: MIXED, label: t("renovation.mixed") }] : []),
{ value: "", label: t("renovation.buildUp.none") },
{ value: "type", label: ownTarget ? t("renovation.buildUp.type", { name: ownTarget.name }) : t("renovation.buildUp.typeMissing") },
...types.filter((x) => x.id !== typeId).map((x) => ({ value: `t:${x.id}`, label: t("renovation.buildUp.other", { name: x.name }) })),
];
const value = common === "mixed" ? MIXED : common;
const b = parseBuildUpKey(value === MIXED ? "" : value);
const target = b.kind === "other" ? b.typeId : b.kind === "type" ? ownTarget?.id : undefined;
const pair = typeId && target ? renovationPair(getState().project, typeId, target) : null;
return (
<>
<div className="objinfo-field" data-testid="objinfo-renovation-buildup">
<span className="objinfo-flabel" title={t("renovation.buildUp.hint")}>
{t("renovation.buildUp")}
</span>
<Dropdown
value={value}
onChange={(v) => {
if (v === MIXED) return;
applyChange((p) => setBuildUpOps(p, wallIds, parseBuildUpKey(v)));
}}
options={options}
title={t("renovation.buildUp")}
width={150}
/>
</div>
{pair && (
<div className="objinfo-field reno-strip-field" data-testid="objinfo-renovation-strip">
<RenovationStrip pair={pair} width={140} />
</div>
)}
</>
);
});