From 4fcf9ad479441e7661933b954cc878355bde1e5d Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Fri, 21 Nov 2025 10:29:33 +0100 Subject: feat: Update ConsolidatedCirculationCard to support readonly mode; enhance button behavior based on GPS availability --- .../Controllers/VigoController.cs | 1 - src/frontend/app/components/StopSheet.tsx | 1 + .../Stops/ConsolidatedCirculationCard.tsx | 42 +++++++++++++++------- 3 files changed, 30 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/Costasdev.Busurbano.Backend/Controllers/VigoController.cs b/src/Costasdev.Busurbano.Backend/Controllers/VigoController.cs index 0591230..6423c2f 100644 --- a/src/Costasdev.Busurbano.Backend/Controllers/VigoController.cs +++ b/src/Costasdev.Busurbano.Backend/Controllers/VigoController.cs @@ -107,7 +107,6 @@ public class VigoController : ControllerBase var realtimeTask = _api.GetStopEstimates(stopId); var todayDate = nowLocal.Date.ToString("yyyy-MM-dd"); - var tomorrowDate = nowLocal.Date.AddDays(1).ToString("yyyy-MM-dd"); // Load both today's and tomorrow's schedules to handle night services var timetableTask = LoadStopArrivalsProto(stopId.ToString(), todayDate); diff --git a/src/frontend/app/components/StopSheet.tsx b/src/frontend/app/components/StopSheet.tsx index 8749fe8..f32c435 100644 --- a/src/frontend/app/components/StopSheet.tsx +++ b/src/frontend/app/components/StopSheet.tsx @@ -167,6 +167,7 @@ export const StopSheet: React.FC = ({ key={idx} estimate={estimate} regionConfig={regionConfig} + readonly /> ))} diff --git a/src/frontend/app/components/Stops/ConsolidatedCirculationCard.tsx b/src/frontend/app/components/Stops/ConsolidatedCirculationCard.tsx index 47fa56b..97f0682 100644 --- a/src/frontend/app/components/Stops/ConsolidatedCirculationCard.tsx +++ b/src/frontend/app/components/Stops/ConsolidatedCirculationCard.tsx @@ -10,6 +10,7 @@ interface ConsolidatedCirculationCardProps { estimate: ConsolidatedCirculation; regionConfig: RegionConfig; onMapClick?: () => void; + readonly?: boolean; } // Utility function to parse service ID and get the turn number @@ -71,7 +72,7 @@ const parseServiceId = (serviceId: string): string => { export const ConsolidatedCirculationCard: React.FC< ConsolidatedCirculationCardProps -> = ({ estimate, regionConfig, onMapClick }) => { +> = ({ estimate, regionConfig, onMapClick, readonly }) => { const { t } = useTranslation(); const absoluteArrivalTime = (minutes: number) => { @@ -172,15 +173,30 @@ export const ConsolidatedCirculationCard: React.FC< // Check if bus has GPS position (live tracking) const hasGpsPosition = !!estimate.currentPosition; + const Tag = readonly ? "div" : "button"; + const interactiveProps = readonly + ? {} + : { + onClick: onMapClick, + type: "button" as const, + disabled: !hasGpsPosition, + }; + return ( - + ); }; -- cgit v1.3