fix: keep terminal charts visible during scan refresh

This commit is contained in:
2569718930@qq.com
2026-05-28 09:07:09 +08:00
parent 651a93cacf
commit b239ad131f
5 changed files with 31 additions and 7 deletions
@@ -702,7 +702,7 @@ export function LiveTemperatureThresholdChart({
actions={timeframeActions}
className={PEAK_GLOW_PANEL_CLASS[peakGlow.state]}
>
<div className="flex h-full min-h-[300px] flex-col">
<div className={clsx("flex h-full flex-col", compact ? "min-h-0" : "min-h-[300px]")}>
<TemperatureStatsBars
isEn={isEn}
compact={compact}
@@ -115,7 +115,8 @@ export function TemperatureChartCanvas({
const canRenderChart = chartSize.width > 0 && chartSize.height > 0;
const chartWidth = Math.max(1, chartSize.width);
const chartHeight = Math.max(220, chartSize.height);
const minChartHeight = compact ? 120 : 220;
const chartHeight = Math.max(minChartHeight, chartSize.height);
const individualRunwaySeriesCount = chartSeries.filter(
(series) => series.key.startsWith("runway_") && series.key !== "runway_max",
).length;
@@ -125,7 +126,7 @@ export function TemperatureChartCanvas({
chartSeries.some((series) => series.key === "runway_max");
return (
<div className="relative flex min-h-[240px] flex-1 flex-col p-2">
<div className={clsx("relative flex flex-1 flex-col p-2", compact ? "min-h-[120px]" : "min-h-[240px]")}>
<div className="flex flex-wrap items-center gap-x-4 gap-y-1.5 px-3 py-1.5 text-[11px] border-b border-[#e2e8f0] bg-white">
{chartSeries.length > 1 &&
chartSeries
@@ -187,7 +188,7 @@ export function TemperatureChartCanvas({
</span>
)}
</div>
<div ref={chartHostRef} className="relative min-h-[220px] flex-1">
<div ref={chartHostRef} className={clsx("relative flex-1", compact ? "min-h-[120px]" : "min-h-[220px]")}>
{canRenderChart && (
<ReComposedChart
width={chartWidth}
@@ -19,6 +19,10 @@ export function runTests() {
path.join(projectRoot, "components", "dashboard", "scan-terminal", "LiveTemperatureThresholdChart.tsx"),
"utf8",
);
const chartCanvasSource = fs.readFileSync(
path.join(projectRoot, "components", "dashboard", "scan-terminal", "TemperatureChartCanvas.tsx"),
"utf8",
);
assert(
dashboardSource.includes("MAX_TERMINAL_CHARTS = 9"),
@@ -55,4 +59,10 @@ export function runTests() {
chartSource.includes("lastAppliedPatchRevisionRef.current = 0;"),
"switching city slots must clear the previous live temperature so Fahrenheit values cannot leak into Celsius charts",
);
assert(
chartSource.includes('compact ? "min-h-0" : "min-h-[300px]"') &&
chartCanvasSource.includes("const minChartHeight = compact ? 120 : 220") &&
chartCanvasSource.includes('compact ? "min-h-[120px]" : "min-h-[220px]"'),
"compact grid charts must not force desktop minimum heights that get clipped inside 3x3 terminal slots",
);
}