From 4420def7411a053e930b44117e2bf63625d824dc Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Fri, 7 Nov 2025 12:43:18 +0100 Subject: Make "stops" page be the home (renaming only) --- .../Controllers/VigoController.cs | 21 +- src/frontend/app/components/NavBar.tsx | 7 +- src/frontend/app/components/StopGalleryItem.tsx | 2 +- src/frontend/app/root.tsx | 14 +- src/frontend/app/routes.tsx | 3 +- src/frontend/app/routes/home.css | 310 ++++++++++++++++++++ src/frontend/app/routes/home.tsx | 322 +++++++++++++++++++++ src/frontend/app/routes/index.tsx | 5 - src/frontend/app/routes/settings.tsx | 2 +- src/frontend/app/routes/stoplist.css | 310 -------------------- src/frontend/app/routes/stoplist.tsx | 321 -------------------- src/frontend/public/manifest.webmanifest | 6 +- 12 files changed, 655 insertions(+), 668 deletions(-) create mode 100644 src/frontend/app/routes/home.css create mode 100644 src/frontend/app/routes/home.tsx delete mode 100644 src/frontend/app/routes/index.tsx delete mode 100644 src/frontend/app/routes/stoplist.css delete mode 100644 src/frontend/app/routes/stoplist.tsx diff --git a/src/Costasdev.Busurbano.Backend/Controllers/VigoController.cs b/src/Costasdev.Busurbano.Backend/Controllers/VigoController.cs index 5b03b6d..2d35a4c 100644 --- a/src/Costasdev.Busurbano.Backend/Controllers/VigoController.cs +++ b/src/Costasdev.Busurbano.Backend/Controllers/VigoController.cs @@ -86,19 +86,19 @@ public class VigoController : ControllerBase return JsonSerializer.Deserialize(contents)!; }*/ - [HttpGet("GetStopArrivalsMerged")] - public async Task GetStopArrivalsMerged( + [HttpGet("GetConsolidatedCirculations")] + public async Task GetConsolidatedCirculations( [FromQuery] int stopId ) { StringBuilder outputBuffer = new(); - // Use Europe/Madrid timezone consistently to avoid UTC/local skew - var tz = TimeZoneInfo.FindSystemTimeZoneById("Europe/Madrid"); - var nowLocal = TimeZoneInfo.ConvertTime(DateTime.UtcNow, tz); + // Use Europe/Madrid timezone consistently to avoid UTC/local skew + var tz = TimeZoneInfo.FindSystemTimeZoneById("Europe/Madrid"); + var nowLocal = TimeZoneInfo.ConvertTime(DateTime.UtcNow, tz); - var realtimeTask = _api.GetStopEstimates(stopId); - var timetableTask = LoadTimetable(stopId.ToString(), nowLocal.Date.ToString("yyyy-MM-dd")); + var realtimeTask = _api.GetStopEstimates(stopId); + var timetableTask = LoadTimetable(stopId.ToString(), nowLocal.Date.ToString("yyyy-MM-dd")); await Task.WhenAll(realtimeTask, timetableTask); @@ -108,14 +108,14 @@ public class VigoController : ControllerBase .Where(c => c.StartingDateTime() != null && c.CallingDateTime() != null) .ToList(); - var now = nowLocal.AddSeconds(60 - nowLocal.Second); + var now = nowLocal.AddSeconds(60 - nowLocal.Second); // Define the scope end as the time of the last realtime arrival (no extra buffer) var scopeEnd = realTimeEstimates.Count > 0 ? now.AddMinutes(realTimeEstimates.Max(e => e.Minutes)) : now; - List consolidatedCirculations = []; - var usedTripIds = new HashSet(); + List consolidatedCirculations = []; + var usedTripIds = new HashSet(); foreach (var estimate in realTimeEstimates) { @@ -256,6 +256,7 @@ public class VigoController : ControllerBase }); } } + // Sort by ETA (RealTime minutes if present; otherwise Schedule minutes) var sorted = consolidatedCirculations .OrderBy(c => c.RealTime?.Minutes ?? c.Schedule!.Minutes) diff --git a/src/frontend/app/components/NavBar.tsx b/src/frontend/app/components/NavBar.tsx index 6a06e63..bb73d58 100644 --- a/src/frontend/app/components/NavBar.tsx +++ b/src/frontend/app/components/NavBar.tsx @@ -27,7 +27,8 @@ export default function NavBar() { { name: t("navbar.stops", "Paradas"), icon: MapPin, - path: "/stops", + path: "/", + exact: true }, { name: t("navbar.map", "Mapa"), @@ -65,7 +66,9 @@ export default function NavBar() {