forked from jappel/leistungsbilanz-ts
Standardize phase type labels
This commit is contained in:
parent
084103bf54
commit
096ba8aa1c
23 changed files with 6117 additions and 52 deletions
|
|
@ -6,16 +6,6 @@ import { getCircuitTree } from "../utils/api";
|
|||
import type { CircuitTreeCircuitDto, CircuitTreeResponseDto } from "../types";
|
||||
import { formatValue } from "../utils/circuit-grid-model";
|
||||
|
||||
function formatPhaseType(value: string | undefined) {
|
||||
if (value === "three_phase") {
|
||||
return "Dreiphasig";
|
||||
}
|
||||
if (value === "single_phase") {
|
||||
return "Einphasig";
|
||||
}
|
||||
return value ?? "-";
|
||||
}
|
||||
|
||||
function renderCircuitSummaryLabel(circuit: CircuitTreeCircuitDto) {
|
||||
if (circuit.displayName?.trim()) {
|
||||
return circuit.displayName;
|
||||
|
|
@ -140,7 +130,7 @@ function SectionRows(props: { section: CircuitTreeResponseDto["sections"][number
|
|||
<tr key={circuit.id} className={circuit.isReserve ? "reserve-row" : ""}>
|
||||
<td>{circuit.equipmentIdentifier}</td>
|
||||
<td>{row.displayName || row.name}</td>
|
||||
<td>{formatPhaseType(row.phaseType)}</td>
|
||||
<td>{formatValue(row.phaseType ?? undefined, "phaseType")}</td>
|
||||
<td>{row.connectionKind ?? "-"}</td>
|
||||
<td>{row.costGroup ?? "-"}</td>
|
||||
<td>{row.category ?? "-"}</td>
|
||||
|
|
@ -190,7 +180,7 @@ function SectionRows(props: { section: CircuitTreeResponseDto["sections"][number
|
|||
<tr key={row.id} className="device-row">
|
||||
<td className="text-muted"> </td>
|
||||
<td className="indented-cell">{row.displayName || row.name}</td>
|
||||
<td>{formatPhaseType(row.phaseType)}</td>
|
||||
<td>{formatValue(row.phaseType ?? undefined, "phaseType")}</td>
|
||||
<td>{row.connectionKind ?? "-"}</td>
|
||||
<td>{row.costGroup ?? "-"}</td>
|
||||
<td>{row.category ?? "-"}</td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue