aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2025-12-01 17:41:47 +0100
committerAriel Costas Guerrero <ariel@costas.dev>2025-12-01 17:41:47 +0100
commit3999423cf2517a63802421410a1565bd9a63125d (patch)
treefa16f00584352d0ae075196a07918e6ddc858c60
parent1f0a677dd354e71b9559c6121b3ed7159ccdd3d3 (diff)
Fix some terminus formatting, add marquee-d next streets
-rw-r--r--src/Costasdev.Busurbano.Backend/Controllers/VigoController.cs2
-rw-r--r--src/Costasdev.Busurbano.Backend/Services/LineFormatterService.cs90
-rw-r--r--src/frontend/app/components/Stops/ConsolidatedCirculationCard.css1
-rw-r--r--src/frontend/app/components/Stops/ConsolidatedCirculationCard.tsx8
-rw-r--r--src/frontend/app/routes/stops-$id.tsx1
-rw-r--r--src/frontend/package-lock.json11
-rw-r--r--src/frontend/package.json1
7 files changed, 51 insertions, 63 deletions
diff --git a/src/Costasdev.Busurbano.Backend/Controllers/VigoController.cs b/src/Costasdev.Busurbano.Backend/Controllers/VigoController.cs
index a6aafe8..288cc98 100644
--- a/src/Costasdev.Busurbano.Backend/Controllers/VigoController.cs
+++ b/src/Costasdev.Busurbano.Backend/Controllers/VigoController.cs
@@ -281,7 +281,7 @@ public partial class VigoController : ControllerBase
consolidatedCirculations.Add(new ConsolidatedCirculation
{
Line = estimate.Line,
- Route = estimate.Route,
+ Route = estimate.Route == closestCirculation.TerminusName ? closestCirculation.Route : estimate.Route,
NextStreets = [.. closestCirculation.NextStreets],
Schedule = new ScheduleData
{
diff --git a/src/Costasdev.Busurbano.Backend/Services/LineFormatterService.cs b/src/Costasdev.Busurbano.Backend/Services/LineFormatterService.cs
index 986ded4..2108b2f 100644
--- a/src/Costasdev.Busurbano.Backend/Services/LineFormatterService.cs
+++ b/src/Costasdev.Busurbano.Backend/Services/LineFormatterService.cs
@@ -11,75 +11,43 @@ public class LineFormatterService
if (circulation.Route == "FORA DE SERVIZO.G.B.")
{
circulation.Route = "García Barbón, 7 (fora de servizo)";
- }
-
- if (circulation.Line == "18A")
- {
- circulation.Route = circulation.Route
- .Replace("\"A\" ", "")
- .Trim()
- .Replace("SARDOMA por MANTELAS", "Praza de Miraflores");
- return circulation;
- }
-
- if (circulation.Line == "5A")
- {
- circulation.Route = circulation.Route
- .Replace("Rúa da Travesía de Vigo, 220", "URZAIZ - TVA DE VIGO");
- return circulation;
- }
-
- if (circulation.Line == "5B")
- {
- circulation.Route = circulation.Route
- .Replace("Rúa de Sanjurjo Badía, 252", "S. BADIA - TVA DE VIGO");
- return circulation;
- }
-
- if (circulation.Line == "11")
- {
- circulation.Route = circulation.Route
- .Replace("Avda. de Cesáreo Vázquez, 61", "SAN MIGUEL por FLORIDA");
return circulation;
}
- if (circulation.Line == "4C")
+ switch (circulation.Line)
{
- circulation.Route = circulation.Route
- .Replace("Rúa do Porriño (fronte 9)", "COIA POR CASTELAO");
- return circulation;
- }
-
- if (circulation.Line == "6")
- {
- circulation.Route = circulation.Route
- .Replace("\"", "");
- return circulation;
- }
-
- if (circulation.Line == "FUT")
- {
- if (circulation.Route == "CASTELAO-CAMELIAS-G.BARBÓN.M.GARRIDO")
+ case "A" when circulation.Route.StartsWith("\"1\""):
+ circulation.Line = "A1";
+ circulation.Route = circulation.Route.Replace("\"1\"", "");
+ return circulation;
+ case "6":
+ circulation.Route = circulation.Route
+ .Replace("\"", "");
+ return circulation;
+ case "FUT":
{
- circulation.Line = "MAR";
- circulation.Route = "MARCADOR ⚽: CASTELAO-CAMELIAS-G.BARBÓN.M.GARRIDO";
- }
+ if (circulation.Route == "CASTELAO-CAMELIAS-G.BARBÓN.M.GARRIDO")
+ {
+ circulation.Line = "MAR";
+ circulation.Route = "MARCADOR ⚽: CASTELAO-CAMELIAS-G.BARBÓN.M.GARRIDO";
+ }
- if (circulation.Route == "P. ESPAÑA-T.VIGO-S.BADÍA")
- {
- circulation.Line = "RIO";
- circulation.Route = "RÍO ⚽: P. ESPAÑA-T.VIGO-S.BADÍA";
- }
+ if (circulation.Route == "P. ESPAÑA-T.VIGO-S.BADÍA")
+ {
+ circulation.Line = "RIO";
+ circulation.Route = "RÍO ⚽: P. ESPAÑA-T.VIGO-S.BADÍA";
+ }
- if (circulation.Route == "NAVIA-BOUZAS-URZAIZ-G. ESPINO")
- {
- circulation.Line = "GOL";
- circulation.Route = "GOL ⚽: NAVIA-BOUZAS-URZAIZ-G. ESPINO";
- }
+ if (circulation.Route == "NAVIA-BOUZAS-URZAIZ-G. ESPINO")
+ {
+ circulation.Line = "GOL";
+ circulation.Route = "GOL ⚽: NAVIA-BOUZAS-URZAIZ-G. ESPINO";
+ }
- return circulation;
+ return circulation;
+ }
+ default:
+ return circulation;
}
-
- return circulation;
}
}
diff --git a/src/frontend/app/components/Stops/ConsolidatedCirculationCard.css b/src/frontend/app/components/Stops/ConsolidatedCirculationCard.css
index e61ac25..57d30c8 100644
--- a/src/frontend/app/components/Stops/ConsolidatedCirculationCard.css
+++ b/src/frontend/app/components/Stops/ConsolidatedCirculationCard.css
@@ -118,7 +118,6 @@
}
.consolidated-circulation-card .card-row.meta {
- flex-wrap: wrap;
justify-content: flex-start;
gap: 0.4rem;
}
diff --git a/src/frontend/app/components/Stops/ConsolidatedCirculationCard.tsx b/src/frontend/app/components/Stops/ConsolidatedCirculationCard.tsx
index 6f92644..7198c7b 100644
--- a/src/frontend/app/components/Stops/ConsolidatedCirculationCard.tsx
+++ b/src/frontend/app/components/Stops/ConsolidatedCirculationCard.tsx
@@ -1,4 +1,5 @@
import { useMemo } from "react";
+import Marquee from 'react-fast-marquee';
import { useTranslation } from "react-i18next";
import LineIcon from "~components/LineIcon";
import { type ConsolidatedCirculation } from "~routes/stops-$id";
@@ -220,6 +221,13 @@ export const ConsolidatedCirculationCard: React.FC<
{chip.label}
</span>
))}
+
+ {estimate.nextStreets && estimate.nextStreets.length > 0 && (
+ <Marquee speed={85}>
+ <div className="mr-64"></div>
+ {estimate.nextStreets.join(" — ")}
+ </Marquee>
+ )}
</div>
)}
</Tag>
diff --git a/src/frontend/app/routes/stops-$id.tsx b/src/frontend/app/routes/stops-$id.tsx
index cdc74eb..25aa3e7 100644
--- a/src/frontend/app/routes/stops-$id.tsx
+++ b/src/frontend/app/routes/stops-$id.tsx
@@ -37,6 +37,7 @@ export interface ConsolidatedCirculation {
};
isPreviousTrip?: boolean;
previousTripShapeId?: string;
+ nextStreets?: string[];
}
export const getCirculationId = (c: ConsolidatedCirculation): string => {
diff --git a/src/frontend/package-lock.json b/src/frontend/package-lock.json
index 65509fc..c51f69b 100644
--- a/src/frontend/package-lock.json
+++ b/src/frontend/package-lock.json
@@ -20,6 +20,7 @@
"maplibre-theme": "^1.0.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
+ "react-fast-marquee": "^1.6.5",
"react-i18next": "^16.3.5",
"react-leaflet": "^5.0.0",
"react-leaflet-markercluster": "^5.0.0-rc.0",
@@ -5827,6 +5828,16 @@
"react": "^19.2.0"
}
},
+ "node_modules/react-fast-marquee": {
+ "version": "1.6.5",
+ "resolved": "https://registry.npmjs.org/react-fast-marquee/-/react-fast-marquee-1.6.5.tgz",
+ "integrity": "sha512-swDnPqrT2XISAih0o74zQVE2wQJFMvkx+9VZXYYNSLb/CUcAzU9pNj637Ar2+hyRw6b4tP6xh4GQZip2ZCpQpg==",
+ "license": "MIT",
+ "peerDependencies": {
+ "react": ">= 16.8.0 || ^18.0.0",
+ "react-dom": ">= 16.8.0 || ^18.0.0"
+ }
+ },
"node_modules/react-i18next": {
"version": "16.3.5",
"resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-16.3.5.tgz",
diff --git a/src/frontend/package.json b/src/frontend/package.json
index 38d05f9..90c9ea7 100644
--- a/src/frontend/package.json
+++ b/src/frontend/package.json
@@ -26,6 +26,7 @@
"maplibre-theme": "^1.0.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
+ "react-fast-marquee": "^1.6.5",
"react-i18next": "^16.3.5",
"react-leaflet": "^5.0.0",
"react-leaflet-markercluster": "^5.0.0-rc.0",