From ee69c62adc5943a1dbd154df5142c0e726bdd317 Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Fri, 13 Mar 2026 16:49:10 +0100 Subject: feat(routes): add realtime estimates panel with pattern-aware styling - New GET /api/stops/estimates endpoint (nano mode: tripId, patternId, estimate, delay only) - useStopEstimates hook wiring estimates to routes-$id stop panel - Pattern-aware styling: dim schedules and estimates from other patterns - Past scheduled departures shown with strikethrough instead of hidden - Persist selected pattern in URL hash (replace navigation, no history push) - Fix planner arrivals using new estimates endpoint --- src/frontend/app/api/schema.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/frontend/app/api/schema.ts') diff --git a/src/frontend/app/api/schema.ts b/src/frontend/app/api/schema.ts index 0c55969..f68d413 100644 --- a/src/frontend/app/api/schema.ts +++ b/src/frontend/app/api/schema.ts @@ -64,10 +64,16 @@ export const ArrivalSchema = z.object({ shift: ShiftBadgeSchema.optional().nullable(), shape: z.any().optional().nullable(), currentPosition: PositionSchema.optional().nullable(), - stopShapeIndex: z.number().optional().nullable(), vehicleInformation: VehicleInformationSchema.optional().nullable(), }); +export const ArrivalEstimateSchema = z.object({ + tripId: z.string(), + patternId: z.string().optional().nullable(), + estimate: ArrivalDetailsSchema, + delay: DelayBadgeSchema.optional().nullable(), +}); + export const StopArrivalsResponseSchema = z.object({ stopCode: z.string(), stopName: z.string(), @@ -77,6 +83,10 @@ export const StopArrivalsResponseSchema = z.object({ usage: z.array(BusStopUsagePointSchema).optional().nullable(), }); +export const StopEstimatesResponseSchema = z.object({ + arrivals: z.array(ArrivalEstimateSchema), +}); + export type RouteInfo = z.infer; export type HeadsignInfo = z.infer; export type ArrivalPrecision = z.infer; @@ -85,8 +95,10 @@ export type DelayBadge = z.infer; export type ShiftBadge = z.infer; export type Position = z.infer; export type Arrival = z.infer; +export type ArrivalEstimate = z.infer; export type BusStopUsagePoint = z.infer; export type StopArrivalsResponse = z.infer; +export type StopEstimatesResponse = z.infer; // Transit Routes export const RouteSchema = z.object({ -- cgit v1.3