diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2025-12-28 22:40:52 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-12-28 22:40:52 +0100 |
| commit | 9618229477439d1604869aa68fc21d4eae7d8bb1 (patch) | |
| tree | 8ada23e40a81e30941a453dda3f7c4552f805f29 /src/frontend/app | |
| parent | 48ec0aae80a200d7eb50639ff4c4ca8ae564f29b (diff) | |
feat: Enhance route details to include agency information and update map attribution
Diffstat (limited to 'src/frontend/app')
| -rw-r--r-- | src/frontend/app/api/schema.ts | 1 | ||||
| -rw-r--r-- | src/frontend/app/root.css | 4 | ||||
| -rw-r--r-- | src/frontend/app/routes/routes-$id.tsx | 18 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/frontend/app/api/schema.ts b/src/frontend/app/api/schema.ts index f7f0a39..95c7b6f 100644 --- a/src/frontend/app/api/schema.ts +++ b/src/frontend/app/api/schema.ts @@ -108,6 +108,7 @@ export const RouteDetailsSchema = z.object({ longName: z.string().nullable(), color: z.string().nullable(), textColor: z.string().nullable(), + agencyName: z.string().nullable().optional(), patterns: z.array(PatternSchema), }); diff --git a/src/frontend/app/root.css b/src/frontend/app/root.css index 3f41591..a517be6 100644 --- a/src/frontend/app/root.css +++ b/src/frontend/app/root.css @@ -224,3 +224,7 @@ textarea { .maplibregl-ctrl-attrib-inner { line-height: 1rem !important; } + +.maplibregl-ctrl.maplibregl-ctrl-attrib { + min-height: unset !important; +} diff --git a/src/frontend/app/routes/routes-$id.tsx b/src/frontend/app/routes/routes-$id.tsx index 8dd7e1c..3b61ba6 100644 --- a/src/frontend/app/routes/routes-$id.tsx +++ b/src/frontend/app/routes/routes-$id.tsx @@ -1,7 +1,12 @@ import { useQuery } from "@tanstack/react-query"; import { useRef, useState } from "react"; import { useTranslation } from "react-i18next"; -import { Layer, Source, type MapRef } from "react-map-gl/maplibre"; +import { + AttributionControl, + Layer, + Source, + type MapRef, +} from "react-map-gl/maplibre"; import { useParams } from "react-router"; import { fetchRouteDetails } from "~/api/transit"; import { AppMap } from "~/components/shared/AppMap"; @@ -137,7 +142,9 @@ export default function RouteDetailsPage() { > {patterns.map((pattern) => ( <option key={pattern.id} value={pattern.id}> - {pattern.code ? `${pattern.code.slice(-2)}: ` : ""} + {pattern.code + ? `${parseInt(pattern.code.slice(-2)).toString()}: ` + : ""} {pattern.headsign || pattern.name}{" "} {t("routes.trip_count_short", { count: pattern.tripCount })} </option> @@ -169,7 +176,14 @@ export default function RouteDetailsPage() { handleStopClick(id, lat, lon, true); } }} + showTraffic={false} + attributionControl={false} > + <AttributionControl + position="bottom-right" + compact={false} + customAttribution={route.agencyName || undefined} + /> {selectedPattern?.geometry && ( <Source type="geojson" data={geojson}> <Layer |
