ecbba9160d
The intraday chart data builder lived inside dashboard-utils with observation-source and TAF helpers, so chart consumers had to depend on the large dashboard utility surface. This moves chart data preparation, observation-source helpers, and TAF marker labels into focused modules while keeping dashboard-utils re-export compatibility. Constraint: Preserve existing chart data shape, observation labels, TAF labels, and legacy dashboard-utils exports. Rejected: Rewrite chart data generation while moving it | this pass is a boundary move only so visual behavior remains stable. Confidence: high Scope-risk: moderate Reversibility: clean Tested: TypeScript diagnostics for chart-utils, dashboard-utils, observation-source-utils, and taf-utils Tested: npm run build Not-tested: Browser visual regression across every chart city.
36 lines
944 B
TypeScript
36 lines
944 B
TypeScript
import type { Locale } from "@/lib/i18n";
|
|
|
|
function isEnglish(locale: Locale) {
|
|
return locale === "en-US";
|
|
}
|
|
|
|
export function formatTafMarkerType(type: string, locale: Locale = "zh-CN") {
|
|
const normalized = String(type || "").trim().toUpperCase();
|
|
if (isEnglish(locale)) {
|
|
return (
|
|
{
|
|
BASE: "Base regime",
|
|
FM: "Hard shift",
|
|
TEMPO: "Temporary swing",
|
|
BECMG: "Gradual shift",
|
|
PROB30: "30% risk window",
|
|
PROB40: "40% risk window",
|
|
"PROB30 TEMPO": "30% temporary swing",
|
|
"PROB40 TEMPO": "40% temporary swing",
|
|
}[normalized] || normalized
|
|
);
|
|
}
|
|
return (
|
|
{
|
|
BASE: "基础时段",
|
|
FM: "明确切换",
|
|
TEMPO: "临时波动",
|
|
BECMG: "逐步转变",
|
|
PROB30: "30% 风险窗",
|
|
PROB40: "40% 风险窗",
|
|
"PROB30 TEMPO": "30% 临时波动",
|
|
"PROB40 TEMPO": "40% 临时波动",
|
|
}[normalized] || normalized
|
|
);
|
|
}
|