diff --git a/TODO.md b/TODO.md index 228ae62a..692e24ac 100644 --- a/TODO.md +++ b/TODO.md @@ -66,7 +66,7 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC. der Parameterliste („Neu würfeln“). Unbekannte Id = Platzhalter-Rahmen. 14.11. (später): e2e `e2e/objectLibrary253.spec.ts` (Palette, WC + Esstisch, R/M, Objekt-Info, Breite, Neu würfeln, Undo samt Klasse; Test-Naht `libobjs`), Rust-Test Belag-Aussparen ([156]: Möbel/Sanitär ja, Auto/Parkfeld/Wendekreis nein), DXF als `BLOCK` `DOSSIER__` + `INSERT` (gleiche Parameter = ein Block, `doc/DATEIFORMATE.md`). Offen: auf dem Mac nicht geprüft; Ziehen aus der Palette (nur Klick); - 3D nach 1.0 (Trait hat Platz für `geometry3d`); Symbole nur im CLI-SVG/Chromium angesehen, nicht in der Tauri-App; DXF-Block ohne Attribute (Id/Parameter nur im Blocknamen). 14.11. UI-Review (Chromium, de/en, 1440×900 und 1024×700, hell/dunkel): Palette ohne Wortbruch mitten im Wort (weiche Trennstriche), Objekt-Info-Zeile „Objekt“ nicht mehr abgeschnitten. Offen: Klassen-Namen der Objekt-Klassen („23 Sanitär“) bleiben auch im englischen UI deutsch (Projektdaten); Palette im 900-px-Fenster nur ca. 270 px hoch (scrollt). Vorgaben ohne Antwort des Maintainers: abstrakt, nur 55er-Raster, nur 2D. · M + 3D nach 1.0 (Trait hat Platz für `geometry3d`); Symbole nur im CLI-SVG/Chromium angesehen, nicht in der Tauri-App; DXF-Block ohne Attribute (Id/Parameter nur im Blocknamen). 14.11. UI-Review (Chromium, de/en, 1440×900 und 1024×700, hell/dunkel): Palette ohne Wortbruch mitten im Wort (weiche Trennstriche), Objekt-Info-Zeile „Objekt“ nicht mehr abgeschnitten. Offen: Klassen-Namen der Objekt-Klassen („23 Sanitär“) bleiben auch im englischen UI deutsch (Projektdaten); Palette im 900-px-Fenster war nur ca. 270 px hoch: behoben 14.11. (spät) — Dock links oben 1,6 : 1 (Layout v15, ca. 480 px bei 900 px) und Gruppen merken offen/zu (`localStorage` `cad.objlib.open`); Mac nicht geprüft. Vorgaben ohne Antwort des Maintainers: abstrakt, nur 55er-Raster, nur 2D. · M ## Phase 1 (13.–19.11.): Stabil und baubar - ◐ **[206]** Referenz-Ablauf als e2e-Spec (Browser) und als Checkliste für die Mac-Abnahme (`doc/RELEASE-1.0.md`): jeder Schritt @@ -233,7 +233,7 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC. KI-/MCP-Werkzeug `export` ohne `save` liefert bei Treffern nichts aus (Argument `ignoreAnonymity`). Der Projekt-Dateiname ist auch nach Autosave-Wiederherstellen und Browser-/Electron-Start-Öffnen Suchbegriff, beim „Neu“ wird er gelöscht. Offen: `dossier-cli convert` prüft nicht; BCF-Export bewusst ohne Tor; nicht in der Tauri-App/auf dem Mac geprüft (Dialog-Weg nur per Code-Abgleich, kein e2e für die neuen Knöpfe). - UI-Review 14.11.: Anonymitäts-Dialog: Anführungszeichen einheitlich („…“ / “…”), englische Bereichsnamen gross geschrieben; Fokus startet auf „Abbrechen“, Tab-Reihenfolge ×, Abbrechen, Trotzdem exportieren. Fundstelle zeigt technisch „Name.feld“ (z. B. „Wärmedämmung.name“), offen. + UI-Review 14.11.: Anonymitäts-Dialog: Anführungszeichen einheitlich („…“ / “…”), englische Bereichsnamen gross geschrieben; Fokus startet auf „Abbrechen“, Tab-Reihenfolge ×, Abbrechen, Trotzdem exportieren. Fundstelle lesbar (14.11. spät): Elementart „Name“ · Feld, z. B. Material „Wärmedämmung“ · Name (`ui/anonymityPlace.ts`, Mapping der Kern-Pfade mit `t()`, Test de/en; Kern liefert weiter den Pfad). - [61] Raumprogramm gegen Modell und Flächennachweis SIA 416 als Tabelle/Layout-Element ([70]); Kennzahlen (GF, GV, HNF/GF, Fassadenanteil). - 3D-Bilder für die Abgabe: hochaufgelöster PNG-Export (Perspektive, Axonometrie, Schatten), Sonnenstand; [205] Pausfolie. - [199]/[204] Plan- und App-Review-Reste im Darstellungsbereich 1:500/1:200 schliessen. @@ -370,7 +370,7 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC. Blatt-Tabelle Quelle „siteProof“ (wie [209]), CLI `kennzahlen --nachweis`. Tests: `site_proof::tests`, `sheet_table::tests::baurecht_nachweis_tabelle`, `src/analysis/siteProof.test.ts`. Offen: Blatt-Tabelle nimmt aGSF/Grünfläche nicht aus den Panel-Eingaben (nur Parzellenfläche/-grenze), Grünfläche nur per Eingabe, Grenzabstand als Verstossfläche statt kleinster Abstand, Fassadenhöhe nur über ±0.00, Mac/Tauri nicht geprüft. · S - UI-Review 14.11.: Flächenbilanz-Panel: Tabellen brechen Text/Köpfe um (Nachweis- und Grundlagen-Tabelle jetzt in 340 px ganz sichtbar, de/en); die breite Flächentabelle (8 Spalten) scrollt weiterhin waagrecht (Rollbalken auf dem Mac ausgeblendet). Blatt-Tabelle Baurecht nicht im UI-Review angesehen. + UI-Review 14.11.: Flächenbilanz-Panel: Tabellen brechen Text/Köpfe um (Nachweis- und Grundlagen-Tabelle jetzt in 340 px ganz sichtbar, de/en); die breite Flächentabelle (11 Spalten) scrollt nicht mehr: in der schmalen Dock-Spalte (Container ≤ 460 px) wird jede Zeile zur Karte (Geschoss oben, Kennwerte 5 je Zeile mit Kopf über der Zahl; `.area-table.wide`, de/en bei 340 px vollständig lesbar, CSV/PDF unverändert); Fenster-/Raumbuch-/Bauteil-Tabellen (12–16 Spalten) scrollen weiterhin waagrecht. Blatt-Tabelle Baurecht (14.11. spät, als Primitive in Chromium angesehen, nicht in der Blatt-Ansicht der App): Kopf „Reserve (+) / Überschr. (−)“ und „Zulässig“/„Erfüllt“ wurden mit „…“ gekürzt → kurzer Blatt-Kopf „Reserve“, Spaltenbreiten neu (Köpfe passen ab 100 mm Rahmenbreite, Test `baurecht_tabelle_koepfe_passen`); lange Zeilentexte kürzen bei < 150 mm weiterhin mit „…“ (kein Umbruch im Blatt-Tabellenkern). ### Phase 4 (4.–12.12.): Härten und veröffentlichen - Nur noch Fehler aus dem Referenz-Ablauf; Leistung mit grossen Kontext-Importen; keine neuen Funktionen. diff --git a/src-tauri/core/src/sheet_table.rs b/src-tauri/core/src/sheet_table.rs index 1b8d77f4..4b0eac44 100644 --- a/src-tauri/core/src/sheet_table.rs +++ b/src-tauri/core/src/sheet_table.rs @@ -130,11 +130,13 @@ const COSTS: &[Col] = &[ /// [255] Baurecht-Nachweis. const SITE_PROOF: &[Col] = &[ - c("item", "siteProof.col.item", 4.6, false, true), - c("allowed", "siteProof.col.allowed", 1.4, true, true), + // Kurzer Kopf „Reserve“ (die lange Fassung „Reserve (+) / Überschr. (−)“ steht in der Panel-Tabelle): Köpfe und Zahlen passen + // schon bei 100 mm Breite ohne „…“ (Test `baurecht_nachweis_tabelle`). + c("item", "siteProof.col.item", 4.25, false, true), + c("allowed", "siteProof.col.allowed", 1.5, true, true), c("actual", "siteProof.col.actual", 1.4, true, true), - c("reserve", "siteProof.col.reserve", 1.8, true, true), - c("ok", "siteProof.col.ok", 1.0, false, true), + c("reserve", "siteProof.col.reserveShort", 1.5, true, true), + c("ok", "siteProof.col.ok", 1.35, false, true), ]; /// [158] Raumbuch-Spalten, die nur erscheinen, wenn ein Raum eine Dachschräge hat. @@ -896,4 +898,20 @@ mod tests { assert_eq!(serde_json::to_value(LayoutTableSource::SiteProof).unwrap(), "siteProof"); assert!(catalog_json()["sources"]["siteProof"].as_array().unwrap().len() == 5); } + + /// [255] Köpfe der Baurecht-Tabelle werden auch bei schmalem Rahmen (100 mm) nicht mit „…“ gekürzt (de und en, 8 pt fett). + #[test] + fn baurecht_tabelle_koepfe_passen() { + for heads in [["Prüfgrösse", "Zulässig", "Projekt", "Reserve", "Erfüllt"], ["Item", "Allowed", "Project", "Reserve", "Met"]] { + let mut t = table("n", None); + t.source = LayoutTableSource::SiteProof; + t.width_mm = 100.0; + let p = project(0, vec![t]); + let lb = Labels::parse(&json!({"siteProof.col.item": heads[0], "siteProof.col.allowed": heads[1], "siteProof.col.actual": heads[2], "siteProof.col.reserveShort": heads[3], "siteProof.col.ok": heads[4]})); + let tx = texts(&render(&p, &p.layouts.as_ref().unwrap()[0], &lb)[0]); + for h in heads { + assert!(tx.contains(&h.to_string()), "Kopf {h} gekürzt: {tx:?}"); + } + } + } } diff --git a/src/i18n/de.ts b/src/i18n/de.ts index 6737e499..d44318b9 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -4194,6 +4194,79 @@ export const de = { "anonymity.kind.file": "Dateiname", "anonymity.kind.email": "E-Mail", "anonymity.kind.phone": "Telefon", + "anonymity.area.materials": "Materialien", + "anonymity.item.rooms": "Raum", + "anonymity.item.drawingLevels": "Geschoss", + "anonymity.item.layers": "Ebene / Klasse", + "anonymity.item.groups": "Gruppe", + "anonymity.item.blockDefs": "Block", + "anonymity.item.layouts": "Blatt", + "anonymity.item.masterLayouts": "Masterlayout", + "anonymity.item.drawings2d": "Zeichnung", + "anonymity.item.walls": "Wand", + "anonymity.item.openings": "Öffnung", + "anonymity.item.stairs": "Treppe", + "anonymity.item.columns": "Stütze", + "anonymity.item.context": "Kontext", + "anonymity.item.extrudedSolids": "Körper", + "anonymity.item.viewSnapshots": "Ausschnitt", + "anonymity.item.viewSnapshotFolders": "Ausschnitt-Ordner", + "anonymity.item.viewTemplates": "Ansichtsvorlage", + "anonymity.item.layoutFolders": "Layout-Ordner", + "anonymity.item.publishSets": "Publikationssatz", + "anonymity.item.roomProgram": "Raumprogramm", + "anonymity.item.export": "Ausgabe", + "anonymity.item.cameras": "Kamera", + "anonymity.item.components": "Bauteil", + "anonymity.item.wallTypes": "Wandtyp", + "anonymity.item.textStyles": "Textstil", + "anonymity.item.ceilings": "Decke", + "anonymity.item.roofs": "Dach", + "anonymity.item.trees": "Baum", + "anonymity.item.hatches": "Schraffur", + "anonymity.item.lineStyles": "Linienstil", + "anonymity.item.materials": "Material", + "anonymity.field.name": "Name", + "anonymity.field.text": "Text", + "anonymity.field.note": "Notiz", + "anonymity.field.notes": "Notizen", + "anonymity.field.label": "Beschriftung", + "anonymity.field.title": "Titel", + "anonymity.field.description": "Beschreibung", + "anonymity.field.comment": "Kommentar", + "anonymity.field.sheetName": "Blattname", + "anonymity.field.projectName": "Projektname", + "anonymity.field.projectNumber": "Projektnummer", + "anonymity.field.author": "Bearbeiter:in", + "anonymity.field.number": "Nummer", + "anonymity.field.planNumber": "Plannummer", + "anonymity.field.revision": "Revision", + "anonymity.field.date": "Datum", + "anonymity.field.mark": "Kennzeichen", + "anonymity.field.abbrev": "Kürzel", + "anonymity.field.family": "Familie", + "anonymity.field.code": "Code", + "anonymity.field.group": "Gruppe", + "anonymity.field.layer": "Ebene", + "anonymity.field.value": "Wert", + "anonymity.field.setName": "Satzname", + "anonymity.field.namePattern": "Namensmuster", + "anonymity.field.identifiers": "Angaben", + "anonymity.field.keyword": "Kennwort", + "anonymity.field.source": "Quelle", + "anonymity.field.template": "Vorlage", + "anonymity.field.folder": "Ordner", + "anonymity.field.floorFinish": "Bodenbelag", + "anonymity.field.ceilingFinish": "Deckenbelag", + "anonymity.field.wallFinish": "Wandbelag", + "anonymity.field.floorBuildUp": "Bodenaufbau", + "anonymity.field.species": "Art", + "anonymity.field.format": "Format", + "anonymity.field.fileName": "Dateiname", + "anonymity.field.scale": "Massstab", + "anonymity.part.titleBlock": "Titelblock", + "anonymity.part.images": "Bild", + "anonymity.part.index": "Eintrag", "publish.competition.identifiers": "Weitere Angaben, die nicht vorkommen dürfen", "publish.competition.identifiersHint": "Büro, Namen, E-Mail, Telefon, getrennt durch Komma. Vor dem Export der anonymen Abgabe im Freitext gesucht.", "publish.competition.keyword": "Kennwort", @@ -4213,6 +4286,7 @@ export const de = { "siteProof.col.allowed": "Zulässig", "siteProof.col.actual": "Projekt", "siteProof.col.reserve": "Reserve (+) / Überschr. (−)", + "siteProof.col.reserveShort": "Reserve", "siteProof.col.ok": "Erfüllt", "siteProof.col.basis": "Grundlage", "siteProof.col.value": "Wert", diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 9591d38e..99b8c311 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -4180,6 +4180,79 @@ export const en: Record = { "anonymity.kind.file": "file name", "anonymity.kind.email": "e-mail", "anonymity.kind.phone": "phone", + "anonymity.area.materials": "Materials", + "anonymity.item.rooms": "Room", + "anonymity.item.drawingLevels": "Level", + "anonymity.item.layers": "Layer / class", + "anonymity.item.groups": "Group", + "anonymity.item.blockDefs": "Block", + "anonymity.item.layouts": "Sheet", + "anonymity.item.masterLayouts": "Master layout", + "anonymity.item.drawings2d": "Drawing", + "anonymity.item.walls": "Wall", + "anonymity.item.openings": "Opening", + "anonymity.item.stairs": "Stair", + "anonymity.item.columns": "Column", + "anonymity.item.context": "Context", + "anonymity.item.extrudedSolids": "Solid", + "anonymity.item.viewSnapshots": "View snapshot", + "anonymity.item.viewSnapshotFolders": "Snapshot folder", + "anonymity.item.viewTemplates": "View template", + "anonymity.item.layoutFolders": "Layout folder", + "anonymity.item.publishSets": "Publish set", + "anonymity.item.roomProgram": "Room program", + "anonymity.item.export": "Output", + "anonymity.item.cameras": "Camera", + "anonymity.item.components": "Component", + "anonymity.item.wallTypes": "Wall type", + "anonymity.item.textStyles": "Text style", + "anonymity.item.ceilings": "Ceiling", + "anonymity.item.roofs": "Roof", + "anonymity.item.trees": "Tree", + "anonymity.item.hatches": "Hatch", + "anonymity.item.lineStyles": "Line style", + "anonymity.item.materials": "Material", + "anonymity.field.name": "Name", + "anonymity.field.text": "Text", + "anonymity.field.note": "Note", + "anonymity.field.notes": "Notes", + "anonymity.field.label": "Label", + "anonymity.field.title": "Title", + "anonymity.field.description": "Description", + "anonymity.field.comment": "Comment", + "anonymity.field.sheetName": "Sheet name", + "anonymity.field.projectName": "Project name", + "anonymity.field.projectNumber": "Project number", + "anonymity.field.author": "Author", + "anonymity.field.number": "Number", + "anonymity.field.planNumber": "Plan number", + "anonymity.field.revision": "Revision", + "anonymity.field.date": "Date", + "anonymity.field.mark": "Mark", + "anonymity.field.abbrev": "Abbreviation", + "anonymity.field.family": "Family", + "anonymity.field.code": "Code", + "anonymity.field.group": "Group", + "anonymity.field.layer": "Layer", + "anonymity.field.value": "Value", + "anonymity.field.setName": "Set name", + "anonymity.field.namePattern": "Name pattern", + "anonymity.field.identifiers": "Identifiers", + "anonymity.field.keyword": "Keyword", + "anonymity.field.source": "Source", + "anonymity.field.template": "Template", + "anonymity.field.folder": "Folder", + "anonymity.field.floorFinish": "Floor finish", + "anonymity.field.ceilingFinish": "Ceiling finish", + "anonymity.field.wallFinish": "Wall finish", + "anonymity.field.floorBuildUp": "Floor build-up", + "anonymity.field.species": "Species", + "anonymity.field.format": "Format", + "anonymity.field.fileName": "File name", + "anonymity.field.scale": "Scale", + "anonymity.part.titleBlock": "Title block", + "anonymity.part.images": "Image", + "anonymity.part.index": "Entry", "publish.competition.identifiers": "Further details that must not appear", "publish.competition.identifiersHint": "Office, names, e-mail, phone, separated by commas. Searched in free text before an anonymous submission is exported.", "publish.competition.keyword": "Keyword", @@ -4199,6 +4272,7 @@ export const en: Record = { "siteProof.col.allowed": "Allowed", "siteProof.col.actual": "Project", "siteProof.col.reserve": "Reserve (+) / excess (−)", + "siteProof.col.reserveShort": "Reserve", "siteProof.col.ok": "Met", "siteProof.col.basis": "Basis", "siteProof.col.value": "Value", diff --git a/src/panels/AreaTableSection.tsx b/src/panels/AreaTableSection.tsx index b00cad03..e73a84ca 100644 --- a/src/panels/AreaTableSection.tsx +++ b/src/panels/AreaTableSection.tsx @@ -73,11 +73,11 @@ export function AreaTableSection() { {r.cells.map((c, ci) => typeof c === "string" ? ( // Kurze Textzellen in Zahlenspalten (Strich, ja/nein) stehen wie die Zahlen rechts. - 0 && c.length <= 4 ? "num" : undefined}> + 0 ? s.columns[ci] : undefined} className={ci > 0 && c.length <= 4 ? "num" : undefined}> {c} ) : ( - + 0 ? s.columns[ci] : undefined} className="num"> {c.n === null ? "–" : c.n.toFixed(c.d)} ), diff --git a/src/panels/ObjectLibraryPanel.tsx b/src/panels/ObjectLibraryPanel.tsx index 2c0fdc74..fcbf9157 100644 --- a/src/panels/ObjectLibraryPanel.tsx +++ b/src/panels/ObjectLibraryPanel.tsx @@ -2,7 +2,7 @@ // mit Vorschau-Symbol je Objekt. Klick wählt das Objekt und startet den Befehl `libobj` (Einfügepunkt klicken, // R = drehen, M = spiegeln). Der Katalog kommt aus dem Rust-Kern; die Vorschau zeichnet der Kern (grob). -import { useMemo } from "react"; +import { useMemo, useState } from "react"; import { t } from "../i18n"; import type { TranslationKey } from "../i18n"; import { usePanelHostAction } from "./host"; @@ -43,7 +43,31 @@ function Preview({ def }: { def: LibObjectDef }) { ); } +const OPEN_KEY = "cad.objlib.open"; + +/** Gemerkter Zustand der Gruppen (offen/zu) je Gruppen-Schlüssel; leer, wenn nichts gespeichert ist. */ +function loadOpen(): Record { + try { + const raw = localStorage.getItem(OPEN_KEY); + const v: unknown = raw ? JSON.parse(raw) : null; + return v && typeof v === "object" ? (v as Record) : {}; + } catch { + return {}; + } +} + export function ObjectLibraryPanel() { + const [open, setOpen] = useState>(loadOpen); + const setGroupOpen = (g: string, v: boolean) => + setOpen((o) => { + const next = { ...o, [g]: v }; + try { + localStorage.setItem(OPEN_KEY, JSON.stringify(next)); + } catch { + /* Speicher gesperrt: der Zustand gilt nur für diese Sitzung */ + } + return next; + }); const onRunCommand = usePanelHostAction("onRunCommand"); const catalog = useMemo(() => libCatalog(), []); const groups = useMemo(() => libGroups(), []); @@ -60,7 +84,7 @@ export function ObjectLibraryPanel() {
{t("lib.hint")}
{groups.map((g) => ( -
+
{ const v = e.currentTarget.open; if (v !== (open[g] ?? g === groups[0])) setGroupOpen(g, v); }} style={{ marginBottom: 4 }}> {t(`lib.g.${g}` as TranslationKey)}
{catalog.objects diff --git a/src/panels/layout.ts b/src/panels/layout.ts index e33e57a1..0c0abf9a 100644 --- a/src/panels/layout.ts +++ b/src/panels/layout.ts @@ -46,7 +46,8 @@ import type { // v13 ([238]): rechts oben (Objekt-Info/Flächenbilanz) bekommt mehr Höhe: Gewichte 1,6 : 1 statt 1 : 1,5 (die // Flächenbilanz mit Raumprogramm war nur ~300 px hoch). Die Höhe merkt sich der Gruppen-Splitter (`resizeGroups`). // v14 ([253]): Objekt-Bibliothek ("object-library") als Tab neben den Werkzeugen links oben. -export const LAYOUT_VERSION = 14; +// v15 ([253]): links oben (Werkzeuge/Objekte) bekommt mehr Höhe: Gewichte 1,6 : 1 (die Objekt-Palette war im 900-px-Fenster nur ~270 px hoch). +export const LAYOUT_VERSION = 15; /** localStorage-Schlüssel des zuletzt benutzten Layouts. */ const CURRENT_KEY = "cad.layout"; @@ -74,7 +75,7 @@ const NAMED_PREFIX = "cad.layouts."; // der Attribute-Palette darunter (Vectorworks-Bild). Das Ribbon-Band bleibt als // Reiter erreichbar, ist aber nicht mehr der primäre Weg zu den Werkzeugen. const DEFAULT_LEFT_GROUPS: DockGroup[] = [ - { tabs: ["tools", "object-library"], activeTab: "tools", weight: 1 }, + { tabs: ["tools", "object-library"], activeTab: "tools", weight: 1.6 }, { tabs: ["attributes"], activeTab: "attributes", weight: 1 }, ]; const DEFAULT_RIGHT_GROUPS: DockGroup[] = [ diff --git a/src/styles.css b/src/styles.css index 61221f88..b481d02e 100644 --- a/src/styles.css +++ b/src/styles.css @@ -8910,6 +8910,56 @@ body { font-weight: 700; border-top: 1px solid var(--ink-2); } +/* Breite Tabelle (> 6 Spalten) in schmaler Dock-Spalte: jede Zeile als Karte — Name oben, darunter die Kennwerte + als Raster (5 Spalten) „Kopf über Zahl“ (data-label der Zelle). Kein waagrechtes Scrollen, nichts abgeschnitten. */ +.area-block { + container-type: inline-size; +} +@container (max-width: 460px) { + .area-table.wide, + .area-table.wide tbody { + display: block; + } + .area-table.wide thead { + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip: rect(0 0 0 0); + } + .area-table.wide tr { + display: grid; + grid-template-columns: repeat(5, minmax(0, 1fr)); + column-gap: 4px; + padding: 3px 0; + border-bottom: 1px solid var(--line); + } + .area-table.wide td { + border-bottom: 0; + padding: 1px 3px; + min-width: 0; + } + .area-table.wide tr.total td { + border-top: 0; + } + .area-table.wide tr.total { + border-top: 1px solid var(--ink-2); + } + .area-table.wide td:first-child { + grid-column: 1 / -1; + font-weight: 600; + min-width: 0; + } + .area-table.wide td[data-label]::before { + content: attr(data-label); + display: block; + font-size: 9px; + line-height: 1.2; + font-weight: 600; + color: var(--ink-2); + text-align: right; + } +} .area-inputs { display: flex; flex-direction: column; diff --git a/src/ui/AnonymityDialog.tsx b/src/ui/AnonymityDialog.tsx index 83711bfd..ce383dc9 100644 --- a/src/ui/AnonymityDialog.tsx +++ b/src/ui/AnonymityDialog.tsx @@ -6,18 +6,32 @@ import { memo, useEffect, useSyncExternalStore } from "react"; import { getLanguage, t } from "../i18n"; import { getAnonymityRequest, subscribeAnonymityRequest } from "../state/anonymityGate"; import { useModalFocus } from "./modalFocus"; +import { anonymityPlaceParts } from "./anonymityPlace"; const AREA_KEYS = new Set([ "rooms", "drawingLevels", "layers", "groups", "blockDefs", "layouts", "masterLayouts", "drawings2d", "walls", "openings", "stairs", "columns", "context", "extrudedSolids", "viewSnapshots", "viewSnapshotFolders", "viewTemplates", "layoutFolders", "publishSets", "roomProgram", "export", "cameras", "components", "wallTypes", "textStyles", "ceilings", "roofs", "trees", - "hatches", "lineStyles", + "hatches", "lineStyles", "materials", ]); function areaLabel(area: string): string { return AREA_KEYS.has(area) ? t(`anonymity.area.${area}`) : area; } +/** Fundstelle lesbar: Elementart „Name“ · Feld (z. B. Material „Wärmedämmung“ · Name). */ +function FindingPlace({ area, place }: { area: string; place: string }) { + const p = anonymityPlaceParts(area, place); + const q = (s: string) => (getLanguage() === "en" ? `\u201C${s}\u201D` : `\u201E${s}\u201C`); + return ( + <> + {p.kind || areaLabel(area)} + {p.item ? {q(p.item)} : null} + {p.field ? · {p.field} : null} + + ); +} + const DialogBody = memo(function DialogBody() { const request = useSyncExternalStore(subscribeAnonymityRequest, getAnonymityRequest); const dialogRef = useModalFocus({}); @@ -46,8 +60,7 @@ const DialogBody = memo(function DialogBody() {
    {findings.map((f, i) => (
  • - {areaLabel(f.area)} - {f.place ? · {f.place} : null} +
    {getLanguage() === "en" ? `\u201C${f.text}\u201D` : `\u201E${f.text}\u201C`} — {t(`anonymity.kind.${f.kind}`)}: {f.term}
    diff --git a/src/ui/anonymityPlace.test.ts b/src/ui/anonymityPlace.test.ts new file mode 100644 index 00000000..db95d4c1 --- /dev/null +++ b/src/ui/anonymityPlace.test.ts @@ -0,0 +1,25 @@ +// Fundstellen-Zerlegung des Anonymitäts-Dialogs: Pfade des Kerns -> Elementart, Name, Feld (de/en). +import { afterEach, describe, expect, it } from "vitest"; +import { setLanguage } from "../i18n"; +import { anonymityPlaceParts } from "./anonymityPlace"; + +afterEach(() => setLanguage("de")); + +describe("anonymityPlaceParts", () => { + it("typische Pfade auf Deutsch", () => { + setLanguage("de"); + expect(anonymityPlaceParts("materials", "Wärmedämmung.name")).toEqual({ kind: "Material", item: "Wärmedämmung", field: "Name" }); + expect(anonymityPlaceParts("rooms", "Küche.note")).toEqual({ kind: "Raum", item: "Küche", field: "Notiz" }); + expect(anonymityPlaceParts("drawingLevels", "EG.name")).toEqual({ kind: "Geschoss", item: "EG", field: "Name" }); + expect(anonymityPlaceParts("layers", "Wände.layers.Anna.name")).toEqual({ kind: "Ebene / Klasse", item: "Wände › Anna", field: "Name" }); + expect(anonymityPlaceParts("drawings2d", "0.text")).toEqual({ kind: "Zeichnung", item: "0", field: "Text" }); + expect(anonymityPlaceParts("layouts", "Plan.titleBlock.sheetName")).toEqual({ kind: "Blatt", item: "Plan", field: "Titelblock · Blattname" }); + expect(anonymityPlaceParts("layouts", "Plan.images.logo.png.name")).toEqual({ kind: "Blatt", item: "Plan › logo.png", field: "Name" }); + }); + it("Englisch, unbekanntes Feld und Zusatztext", () => { + setLanguage("en"); + expect(anonymityPlaceParts("materials", "Insulation.name")).toEqual({ kind: "Material", item: "Insulation", field: "Name" }); + expect(anonymityPlaceParts("rooms", "Kitchen.weird")).toEqual({ kind: "Room", item: "Kitchen", field: "weird" }); + expect(anonymityPlaceParts("export", "Dateiname")).toEqual({ kind: "Output", item: "", field: "Dateiname" }); + }); +}); diff --git a/src/ui/anonymityPlace.ts b/src/ui/anonymityPlace.ts new file mode 100644 index 00000000..9d1319da --- /dev/null +++ b/src/ui/anonymityPlace.ts @@ -0,0 +1,40 @@ +// Lesbare Fundstelle für den Anonymitäts-Dialog ([208]): der Kern liefert Bereich und Pfad +// (`Wärmedämmung.name`, `Plan.titleBlock.sheetName`); hier werden Elementart, Name und Feld daraus. +// +// Bezeichner englisch, Kommentare deutsch. + +import { t } from "../i18n"; + +export interface PlaceParts { + /** Elementart im Singular („Material“), leer wenn unbekannt. */ + kind: string; + /** Name des Elements (ggf. mit Unterelement: „Plan › logo.png“). */ + item: string; + /** Feld („Name“, „Blattname“); bei Orten ohne Pfad (Zusatztexte wie „Dateiname“) der Ort selbst. */ + field: string; +} + +/** Zwischenschlüssel im Pfad, die ein Unterelement einleiten (Liste in einem Element). */ +const NESTED = ["images", "layers", "children", "items", "rows"]; + +/** Übersetzung, oder der Fallback, wenn es den Schlüssel nicht gibt (`t` gibt dann den Schlüssel zurück). */ +function tr(key: string, fallback: string): string { + const s = t(key); + return s === key ? fallback : s; +} + +/** Zerlegt Bereich und Pfad in Elementart, Elementname und Feld. */ +export function anonymityPlaceParts(area: string, place: string): PlaceParts { + const kind = tr(`anonymity.item.${area}`, ""); + const cut = place.lastIndexOf("."); + if (cut < 0) return { kind, item: "", field: place }; + const key = place.slice(cut + 1); + let item = place.slice(0, cut); + let field = /^\d+$/.test(key) ? `${tr("anonymity.part.index", "")} ${key}`.trim() : tr(`anonymity.field.${key}`, key); + if (item.endsWith(".titleBlock")) { + item = item.slice(0, -".titleBlock".length); + field = `${tr("anonymity.part.titleBlock", "titleBlock")} · ${field}`; + } + for (const n of NESTED) item = item.split(`.${n}.`).join(" › "); + return { kind, item, field }; +}