refactor: add hydrogen station drilldown

This commit is contained in:
kkfluous
2026-08-07 14:41:29 +08:00
parent d53257c65c
commit 71d0091457
9 changed files with 361 additions and 25 deletions
+12
View File
@@ -0,0 +1,12 @@
export type HydrogenCustomerKind = 'external' | 'lingniu' | 'all';
export function parseHydrogenCustomerKind(value: string | undefined): HydrogenCustomerKind {
if (value === 'external' || value === 'all') return value;
return 'lingniu';
}
export function parseHydrogenStationId(value: string | undefined): number | null {
if (value == null || !/^\d+$/.test(value)) return null;
const parsed = Number(value);
return Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : null;
}