- Add `currentTrainMetadata.ts` to manage carrying forward official position metadata between train snapshots. - Introduce `lineDisplayName.ts` for mapping line IDs to display names. - Create `officialPositionCache.ts` for parsing and serializing official position data with cache validation. - Enhance `officialPositionService.ts` to support persistent caching of official positions and improve resolver functionality. - Update `requestCoordinator.ts` to allow cancellation of polling requests without disposing of the coordinator. - Modify `trainTimeFiltering.ts` to incorporate line ID context when checking for duplicate train data. - Refactor `useCurrentTrain.tsx` to support polling for current train data with official position enrichment. - Add tests for new features, including persistent cache behavior and handling of ambiguous train data.
15 lines
422 B
TypeScript
15 lines
422 B
TypeScript
const LINE_DISPLAY_NAMES: Record<string, string> = {
|
|
yosan: "予讃線",
|
|
koutoku: "高徳線",
|
|
tokushima: "徳島線",
|
|
dosan: "土讃線",
|
|
dosan2: "土讃線",
|
|
uwajima: "予讃線",
|
|
uwajima2: "予讃線/愛ある伊予灘線",
|
|
naruto: "鳴門線",
|
|
seto: "瀬戸大橋線",
|
|
};
|
|
|
|
export const lineDisplayName = (lineId: string | undefined): string =>
|
|
lineId ? LINE_DISPLAY_NAMES[lineId] ?? lineId : "";
|