From 81abd5a591a1ac38c14fa904bc113eac6c44ff39 Mon Sep 17 00:00:00 2001 From: sepehr Date: Sun, 19 Jul 2026 16:55:46 +0200 Subject: [PATCH] Add missing SolvedVariablesBlock component for properties panel. Fixes the UI compile break from referencing an undefined helper when showing z_dp and other solved actuators. Co-authored-by: Cursor --- .../src/components/panels/PropertiesPanel.tsx | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/apps/web/src/components/panels/PropertiesPanel.tsx b/apps/web/src/components/panels/PropertiesPanel.tsx index 005573f..14e3e37 100644 --- a/apps/web/src/components/panels/PropertiesPanel.tsx +++ b/apps/web/src/components/panels/PropertiesPanel.tsx @@ -977,6 +977,43 @@ function ModelicaResultsView({ ); } +function SolvedVariablesBlock({ + items, + title, +}: { + items: SolvedVariable[]; + title: string; +}) { + if (items.length === 0) return null; + return ( +
+
+ {title} +
+ + + + + + + + + + + {items.map((sv) => ( + + + + + + + ))} + +
VarValueMinMax
{sv.variable}{fmtOpt(sv.value, 4)}{fmtOpt(sv.min, 3)}{fmtOpt(sv.max, 3)}
+
+ ); +} + function MiniMetric({ label, value }: { label: string; value: string }) { return (
@@ -989,3 +1026,50 @@ function MiniMetric({ label, value }: { label: string; value: string }) { function fmtOpt(v: number | null | undefined, digits: number): string { return typeof v === "number" && Number.isFinite(v) ? v.toFixed(digits) : "—"; } + +/** + * Formats a solved-unknown value compactly: 4 significant digits with trailing + * zeros trimmed (e.g. 1.024, 0.62, 0.02, 2). Non-finite → "—". + */ +function fmtSolved(v: number): string { + if (!Number.isFinite(v)) return "—"; + return Number(v.toPrecision(4)).toString(); +} + +/** + * Compact block listing solver-computed unknowns for the selected component. + * Renders one row per variable: `variable = value (min..max)`. Only shown when + * the component owns at least one solved variable. + */ +function SolvedVariablesBlock({ + items, + title, +}: { + items: SolvedVariable[]; + title: string; +}) { + if (items.length === 0) return null; + return ( +
+
+ {title} +
+
+ {items.map((sv) => ( +
+ {sv.variable} + = + {fmtSolved(sv.value)} + + ({fmtSolved(sv.min)}..{fmtSolved(sv.max)}) + +
+ ))} +
+
+ ); +}