From facf788ce81f289de51da7f7d522b9b29ed2695a Mon Sep 17 00:00:00 2001 From: Julian Appel Date: Fri, 31 Jul 2026 14:52:37 +0200 Subject: [PATCH] Remove circuit structure preview --- docs/circuit-list-editor-architecture.md | 4 +- src/app/globals.css | 29 --- .../[circuitListId]/tree-edit/page.tsx | 6 - .../[circuitListId]/tree/page.tsx | 38 --- .../components/circuit-tree-preview.tsx | 219 ------------------ 5 files changed, 2 insertions(+), 294 deletions(-) delete mode 100644 src/app/projects/[projectId]/circuit-lists/[circuitListId]/tree/page.tsx delete mode 100644 src/frontend/components/circuit-tree-preview.tsx diff --git a/docs/circuit-list-editor-architecture.md b/docs/circuit-list-editor-architecture.md index c58589b..a8473c9 100644 --- a/docs/circuit-list-editor-architecture.md +++ b/docs/circuit-list-editor-architecture.md @@ -111,8 +111,8 @@ Primary circuit-first editor route: - `/projects/:projectId/circuit-lists/:circuitListId/tree-edit` -The sibling `/tree` route is a read-only structure preview. Old -`/projects/:projectId/circuit-lists` bookmarks redirect to the project page. +Old `/projects/:projectId/circuit-lists` bookmarks redirect to the project +page. A future print view will provide a dedicated read-only presentation. ## Future Persistence Direction diff --git a/src/app/globals.css b/src/app/globals.css index c863b70..27b2d63 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -305,35 +305,6 @@ a.kpi:hover { min-width: 8rem; } -.circuit-tree-table .section-row td { - background: #e9eef8; - border-top: 2px solid #c6d3ea; - font-weight: 600; -} - -.circuit-tree-table .summary-row td { - background: #f5f8fd; - font-weight: 600; -} - -.circuit-tree-table .device-row td { - background: #ffffff; -} - -.circuit-tree-table .reserve-row td { - background: #f8fbff; -} - -.circuit-tree-table .placeholder-row td { - background: #f7f7f7; - color: #6c757d; - font-style: italic; -} - -.circuit-tree-table .indented-cell { - padding-left: 1.5rem; -} - .tree-editor-shell { display: flex; flex-direction: column; diff --git a/src/app/projects/[projectId]/circuit-lists/[circuitListId]/tree-edit/page.tsx b/src/app/projects/[projectId]/circuit-lists/[circuitListId]/tree-edit/page.tsx index f661942..89679cf 100644 --- a/src/app/projects/[projectId]/circuit-lists/[circuitListId]/tree-edit/page.tsx +++ b/src/app/projects/[projectId]/circuit-lists/[circuitListId]/tree-edit/page.tsx @@ -15,12 +15,6 @@ export default function CircuitTreeEditPage() {

Stromkreise und zugeordnete Geräte bearbeiten.

- - Strukturvorschau - Zum Projekt diff --git a/src/app/projects/[projectId]/circuit-lists/[circuitListId]/tree/page.tsx b/src/app/projects/[projectId]/circuit-lists/[circuitListId]/tree/page.tsx deleted file mode 100644 index 8cfea27..0000000 --- a/src/app/projects/[projectId]/circuit-lists/[circuitListId]/tree/page.tsx +++ /dev/null @@ -1,38 +0,0 @@ -"use client"; - -import Link from "next/link"; -import { useParams } from "next/navigation"; -import { CircuitTreePreview } from "../../../../../../frontend/components/circuit-tree-preview"; - -export default function CircuitTreePreviewPage() { - const params = useParams<{ projectId: string; circuitListId: string }>(); - const projectId = params.projectId; - const circuitListId = params.circuitListId; - - return ( -
-
-
-

Vorschau der Stromkreisstruktur

-

- Schreibgeschützte Vorschau der Bereiche, Stromkreise und Gerätezeilen. -

-
- - Editor öffnen - - - Zum Projekt - -
- - -
- ); -} diff --git a/src/frontend/components/circuit-tree-preview.tsx b/src/frontend/components/circuit-tree-preview.tsx deleted file mode 100644 index 207dee4..0000000 --- a/src/frontend/components/circuit-tree-preview.tsx +++ /dev/null @@ -1,219 +0,0 @@ -"use client"; - -import { useEffect, useState } from "react"; -import { Fragment } from "react"; -import { getCircuitTree } from "../utils/api"; -import type { CircuitTreeCircuitDto, CircuitTreeResponseDto } from "../types"; -import { - formatCellValue, - formatValue, - getCircuitSectionLabel, -} from "../utils/circuit-grid-model"; - -function renderCircuitSummaryLabel(circuit: CircuitTreeCircuitDto) { - if (circuit.displayName?.trim()) { - return circuit.displayName; - } - if (circuit.deviceRows.length > 1) { - return `${circuit.deviceRows.length} Geräte`; - } - return "Reserve"; -} - -export function CircuitTreePreview(props: { projectId: string; circuitListId: string }) { - const { projectId, circuitListId } = props; - const [data, setData] = useState(null); - const [isLoading, setIsLoading] = useState(true); - const [error, setError] = useState(null); - - useEffect(() => { - setIsLoading(true); - setError(null); - getCircuitTree(projectId, circuitListId) - .then(setData) - .catch((err: unknown) => - setError(err instanceof Error ? err.message : "Die Stromkreisstruktur konnte nicht geladen werden.") - ) - .finally(() => setIsLoading(false)); - }, [projectId, circuitListId]); - - if (isLoading) { - return
Stromkreisstruktur wird geladen …
; - } - - if (error) { - return
{error}
; - } - - if (!data || !data.sections.length) { - return
Keine Bereiche oder Stromkreise vorhanden.
; - } - - const hasAnyCircuits = data.sections.some((section) => section.circuits.length > 0); - if (!hasAnyCircuits) { - return
Bereiche sind vorhanden, enthalten aber noch keine Stromkreise.
; - } - - return ( -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - {data.sections.map((section) => ( - - ))} - -
BetriebsmittelkennzeichenAnzeigenamePhasenartAnschlussartKostengruppeKategorieEbeneRaumnummerRaumnameAnzahlLeistung / Gerät [kW]Gleichzeitigkeitcos φGesamtsumme [kW]SchutzartBemessungsstromCharakteristikKabeltypKabelquerschnittKabellängeBemerkung
-
-
-
- ); -} - -function SectionRows(props: { section: CircuitTreeResponseDto["sections"][number] }) { - const { section } = props; - return ( - <> - - - {getCircuitSectionLabel(section)} - - - {section.circuits.map((circuit) => { - if (circuit.deviceRows.length === 0) { - return ( - - {circuit.equipmentIdentifier} - {circuit.displayName?.trim() || "Reserve"} - - - - {formatCellValue(circuit.circuitTotalPower, "circuitTotalPower")} - - {circuit.protectionDevice?.type ?? "-"} - - {formatValue(circuit.protectionDevice?.ratedCurrentA, "protectionRatedCurrent")} - - {circuit.protectionDevice?.tripCharacteristic ?? circuit.protectionDevice?.fuseUtilizationCategory ?? "-"} - {circuit.cableType ?? "-"} - {circuit.cableCrossSection ?? "-"} - {formatValue(circuit.cableLength, "cableLength")} - {circuit.remark ?? "-"} - - ); - } - - if (circuit.deviceRows.length === 1) { - const row = circuit.deviceRows[0]; - return ( - - {circuit.equipmentIdentifier} - {row.displayName || row.name} - {formatValue(row.phaseType ?? undefined, "phaseType")} - {row.connectionKind ?? "-"} - {row.costGroup ?? "-"} - {row.category ?? "-"} - {row.level ?? "-"} - {row.roomNumberSnapshot ?? "-"} - {row.roomNameSnapshot ?? "-"} - {formatCellValue(row.quantity, "quantity")} - {formatCellValue(row.powerPerUnit, "powerPerUnit")} - - {formatValue(row.simultaneityFactor, "simultaneityFactor")} - - {formatValue(row.cosPhi, "cosPhi")} - {formatCellValue(row.rowTotalPower, "rowTotalPower")} - {circuit.protectionDevice?.type ?? "-"} - - {formatValue(circuit.protectionDevice?.ratedCurrentA, "protectionRatedCurrent")} - - {circuit.protectionDevice?.tripCharacteristic ?? circuit.protectionDevice?.fuseUtilizationCategory ?? "-"} - {circuit.cableType ?? "-"} - {circuit.cableCrossSection ?? "-"} - {formatValue(circuit.cableLength, "cableLength")} - {row.remark ?? circuit.remark ?? "-"} - - ); - } - - return ( - - - {circuit.equipmentIdentifier} - {renderCircuitSummaryLabel(circuit)} - - - - {formatCellValue(circuit.circuitTotalPower, "circuitTotalPower")} - - {circuit.protectionDevice?.type ?? "-"} - - {formatValue(circuit.protectionDevice?.ratedCurrentA, "protectionRatedCurrent")} - - {circuit.protectionDevice?.tripCharacteristic ?? circuit.protectionDevice?.fuseUtilizationCategory ?? "-"} - {circuit.cableType ?? "-"} - {circuit.cableCrossSection ?? "-"} - {formatValue(circuit.cableLength, "cableLength")} - {circuit.remark ?? "-"} - - {circuit.deviceRows.map((row) => ( - - - {row.displayName || row.name} - {formatValue(row.phaseType ?? undefined, "phaseType")} - {row.connectionKind ?? "-"} - {row.costGroup ?? "-"} - {row.category ?? "-"} - {row.level ?? "-"} - {row.roomNumberSnapshot ?? "-"} - {row.roomNameSnapshot ?? "-"} - {formatCellValue(row.quantity, "quantity")} - {formatCellValue(row.powerPerUnit, "powerPerUnit")} - - {formatValue(row.simultaneityFactor, "simultaneityFactor")} - - {formatValue(row.cosPhi, "cosPhi")} - {formatCellValue(row.rowTotalPower, "rowTotalPower")} - - - - - - - - - - - - - {row.remark ?? "-"} - - ))} - - ); - })} - - -frei- - Freie Zeile - - - ); -}