diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Enmarcha.Backend/Controllers/TileController.cs | 32 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Services/OtpService.cs | 2 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Services/Processors/VitrasaRealTimeProcessor.cs | 6 | ||||
| -rw-r--r-- | src/frontend/app/components/map/StopSummarySheet.tsx | 11 | ||||
| -rw-r--r-- | src/frontend/app/routes/map.tsx | 24 |
5 files changed, 6 insertions, 69 deletions
diff --git a/src/Enmarcha.Backend/Controllers/TileController.cs b/src/Enmarcha.Backend/Controllers/TileController.cs index 44a2473..856f2c6 100644 --- a/src/Enmarcha.Backend/Controllers/TileController.cs +++ b/src/Enmarcha.Backend/Controllers/TileController.cs @@ -5,7 +5,6 @@ using NetTopologySuite.IO.VectorTiles.Mapbox; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Caching.Memory; -using System.Text.Json; using Enmarcha.Sources.OpenTripPlannerGql; using Enmarcha.Sources.OpenTripPlannerGql.Queries; using Enmarcha.Backend.Configuration; @@ -126,36 +125,7 @@ public class TileController : ControllerBase { "code", $"{idParts[0]}:{codeWithinFeed}" }, { "name", _feedService.NormalizeStopName(feedId, stop.Name) }, { "icon", GetIconNameForFeed(feedId) }, - { "transitKind", GetTransitKind(feedId) }, - // Routes - { "routes", JsonSerializer - .Serialize( - distinctRoutes.Select(r => { - var colour = r.Color ?? Color; - string textColour; - - if (r.Color is null) // None is present, use fallback - { - textColour = TextColor; - } - else if (r.TextColor is null || r.TextColor.EndsWith("000000")) - { - // Text colour not provided, or default-black; check the better contrasting - textColour = ContrastHelper.GetBestTextColour(colour); - } - else - { - // Use provided text colour - textColour = r.TextColor; - } - - return new { - shortName = r.ShortName, - colour, - textColour - }; - })) - } + { "transitKind", GetTransitKind(feedId) } } }; diff --git a/src/Enmarcha.Backend/Services/OtpService.cs b/src/Enmarcha.Backend/Services/OtpService.cs index a01079f..aadff77 100644 --- a/src/Enmarcha.Backend/Services/OtpService.cs +++ b/src/Enmarcha.Backend/Services/OtpService.cs @@ -180,7 +180,7 @@ public class OtpService var feedId = otpPlace.StopId?.Split(':')[0] ?? "unknown"; return new PlannerPlace { - Name = _feedService.NormalizeStopName(feedId, otpPlace.Name), + Name = _feedService.NormalizeStopName(feedId, otpPlace.Name!), Lat = otpPlace.Lat, Lon = otpPlace.Lon, StopId = otpPlace.StopId, // Use string directly diff --git a/src/Enmarcha.Backend/Services/Processors/VitrasaRealTimeProcessor.cs b/src/Enmarcha.Backend/Services/Processors/VitrasaRealTimeProcessor.cs index d1d1e7d..e374f24 100644 --- a/src/Enmarcha.Backend/Services/Processors/VitrasaRealTimeProcessor.cs +++ b/src/Enmarcha.Backend/Services/Processors/VitrasaRealTimeProcessor.cs @@ -134,9 +134,6 @@ public class VitrasaRealTimeProcessor : AbstractRealTimeProcessor scheduledHeadsign = otpArr.Trip.TripHeadsign; } - _logger.LogDebug("Matched RT estimate: Line {Line}, RT: {RTRoute} ({RTMin}m), Scheduled: {ScheduledRoute} ({ScheduledMin}m), Delay: {Delay}m", - estimate.Line, estimate.Route, estimate.Minutes, scheduledHeadsign, scheduledMinutes, delayMinutes); - // Prefer real-time headsign UNLESS it's just the last stop name (which is less informative) if (!string.IsNullOrWhiteSpace(estimate.Route)) { @@ -152,9 +149,6 @@ public class VitrasaRealTimeProcessor : AbstractRealTimeProcessor } } - _logger.LogDebug("Headsign: RT='{RT}' vs Scheduled='{Scheduled}', IsJustLastStop={Last}, WillUseRT={Use}", - estimate.Route, scheduledHeadsign, isJustLastStop, !isJustLastStop); - // Use real-time headsign unless it's just the final stop name if (!isJustLastStop) { diff --git a/src/frontend/app/components/map/StopSummarySheet.tsx b/src/frontend/app/components/map/StopSummarySheet.tsx index 7024f41..7b4dd7b 100644 --- a/src/frontend/app/components/map/StopSummarySheet.tsx +++ b/src/frontend/app/components/map/StopSummarySheet.tsx @@ -18,11 +18,6 @@ export interface StopSheetProps { stopCode?: string; stopFeed?: string; name: string; - lines: { - line: string; - colour?: string; - textColour?: string; - }[]; }; } @@ -57,10 +52,10 @@ export const StopSummarySheet: React.FC<StopSheetProps> = ({ </div> <div className={`flex flex-wrap flex-row gap-2`}> - {stop.lines.map((lineObj) => ( + {data?.routes.map((lineObj) => ( <LineIcon - key={lineObj.line} - line={lineObj.line} + key={lineObj.shortName} + line={lineObj.shortName} mode="pill" colour={lineObj.colour} textColour={lineObj.textColour} diff --git a/src/frontend/app/routes/map.tsx b/src/frontend/app/routes/map.tsx index a8d745e..c9c4850 100644 --- a/src/frontend/app/routes/map.tsx +++ b/src/frontend/app/routes/map.tsx @@ -111,10 +111,7 @@ export default function StopMap() { }; const stopLayerFilter = useMemo(() => { - const filter: any[] = [ - "any", - ["==", ["get", "transitKind"], "unknown"] - ]; + const filter: any[] = ["any", ["==", ["get", "transitKind"], "unknown"]]; if (showCitybusStops) { filter.push(["==", ["get", "transitKind"], "bus"]); } @@ -127,11 +124,6 @@ export default function StopMap() { return filter as FilterSpecification; }, [showCitybusStops, showIntercityBusStops, showTrainStops]); - const getLatitude = (center: any) => - Array.isArray(center) ? center[0] : center.lat; - const getLongitude = (center: any) => - Array.isArray(center) ? center[1] : center.lng; - const handlePointClick = (feature: any) => { const props: { id: string; @@ -145,24 +137,10 @@ export default function StopMap() { return; } - const stopId = props.id; - const routes: { - shortName: string; - colour: string; - textColour: string; - }[] = JSON.parse(props.routes || "[]"); - setSelectedStop({ stopId: props.id, stopCode: props.code, name: props.name || "Unknown Stop", - lines: routes.map((route) => { - return { - line: route.shortName, - colour: route.colour, - textColour: route.textColour, - }; - }), }); setIsSheetOpen(true); }; |
