aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/app/routes/routes.tsx
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2026-03-05 01:38:13 +0100
committerAriel Costas Guerrero <ariel@costas.dev>2026-03-05 01:38:13 +0100
commitcde15534041499a0baf4153476805ee7f2db7f0d (patch)
tree33617fa52bf17ff901a6982c8d784304cbe9e0cc /src/frontend/app/routes/routes.tsx
parent6bc0b28d68f9b4d2779cea403e4af987d6e9dd0e (diff)
Support for Ourense!!
Squashed commit of the following: commit 6c70396fe66ff8bc64655dd8e8c393001d2df8c3 Author: Ariel Costas Guerrero <ariel@costas.dev> Date: Thu Mar 5 01:35:52 2026 +0100 feat: enhance stop sorting logic for bus and coach in map component commit 380396c78a0b9dc8b0435a479236031e0910b57e Author: Ariel Costas Guerrero <ariel@costas.dev> Date: Thu Mar 5 01:30:46 2026 +0100 Update sprite and map colours commit cc3662922d8cf7d8d87c52444bc582c8332160c1 Author: Ariel Costas Guerrero <ariel@costas.dev> Date: Thu Mar 5 01:02:22 2026 +0100 update ourense colour codes and refactor route fetching logic commit a2d8e8b0ecc57989dc79214947ed805d98ebddaa Author: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Date: Wed Mar 4 23:42:49 2026 +0000 feat: add ourense urban bus feed (schedule-only, no real-time) Co-authored-by: arielcostas <94913521+arielcostas@users.noreply.github.com> commit 639a9cf75a71dabc07d1cdf2b39edfd264ccc220 Author: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Date: Wed Mar 4 23:35:44 2026 +0000 Initial plan
Diffstat (limited to 'src/frontend/app/routes/routes.tsx')
-rw-r--r--src/frontend/app/routes/routes.tsx76
1 files changed, 48 insertions, 28 deletions
diff --git a/src/frontend/app/routes/routes.tsx b/src/frontend/app/routes/routes.tsx
index 6d50186..1e85cfb 100644
--- a/src/frontend/app/routes/routes.tsx
+++ b/src/frontend/app/routes/routes.tsx
@@ -12,9 +12,18 @@ export default function RoutesPage() {
usePageTitle(t("navbar.routes", "Rutas"));
const [searchQuery, setSearchQuery] = useState("");
+ const orderedAgencies = [
+ "vitrasa",
+ "tranvias",
+ "tussa",
+ "ourense",
+ "feve",
+ "shuttle",
+ ];
+
const { data: routes, isLoading } = useQuery({
queryKey: ["routes"],
- queryFn: () => fetchRoutes(["vitrasa", "tranvias", "tussa", "feve", "shuttle"]),
+ queryFn: () => fetchRoutes(orderedAgencies),
});
const filteredRoutes = routes?.filter(
@@ -53,34 +62,45 @@ export default function RoutesPage() {
<div className="space-y-8">
{routesByAgency &&
- Object.entries(routesByAgency).map(([agency, agencyRoutes]) => (
- <div key={agency}>
- <h2 className="text-xl font-bold text-text mb-4 border-b border-border pb-2">
- {agency}
- </h2>
- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
- {agencyRoutes.map((route) => (
- <Link
- key={route.id}
- to={`/routes/${route.id}`}
- className="flex items-center gap-3 p-4 bg-surface rounded-lg shadow hover:shadow-lg transition-shadow border border-border"
- >
- <LineIcon
- line={route.shortName ?? "?"}
- mode="pill"
- colour={route.color ?? undefined}
- textColour={route.textColor ?? undefined}
- />
- <div className="flex-1 min-w-0">
- <p className="text-sm md:text-md font-semibold text-text">
- {route.longName}
- </p>
- </div>
- </Link>
- ))}
+ Object.entries(routesByAgency)
+ .sort(([a], [b]) => {
+ const indexA = orderedAgencies.indexOf(a.toLowerCase());
+ const indexB = orderedAgencies.indexOf(b.toLowerCase());
+ if (indexA === -1 && indexB === -1) {
+ return a.localeCompare(b);
+ }
+ if (indexA === -1) return 1;
+ if (indexB === -1) return -1;
+ return indexA - indexB;
+ })
+ .map(([agency, agencyRoutes]) => (
+ <div key={agency}>
+ <h2 className="text-xl font-bold text-text mb-4 border-b border-border pb-2">
+ {agency}
+ </h2>
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
+ {agencyRoutes.map((route) => (
+ <Link
+ key={route.id}
+ to={`/routes/${route.id}`}
+ className="flex items-center gap-3 p-4 bg-surface rounded-lg shadow hover:shadow-lg transition-shadow border border-border"
+ >
+ <LineIcon
+ line={route.shortName ?? "?"}
+ mode="pill"
+ colour={route.color ?? undefined}
+ textColour={route.textColor ?? undefined}
+ />
+ <div className="flex-1 min-w-0">
+ <p className="text-sm md:text-md font-semibold text-text">
+ {route.longName}
+ </p>
+ </div>
+ </Link>
+ ))}
+ </div>
</div>
- </div>
- ))}
+ ))}
</div>
</div>
);