From f030f1806255c66b86689489d24f8f5ad9b832ce Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Wed, 19 Nov 2025 23:54:49 +0100 Subject: feat: Implement StopMapModal component for displaying bus stop locations with live tracking; enhance styles and add interaction features --- src/frontend/app/maps/styleloader.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/frontend/app/maps/styleloader.ts') diff --git a/src/frontend/app/maps/styleloader.ts b/src/frontend/app/maps/styleloader.ts index 43118a0..8109e0b 100644 --- a/src/frontend/app/maps/styleloader.ts +++ b/src/frontend/app/maps/styleloader.ts @@ -1,10 +1,17 @@ import type { StyleSpecification } from "react-map-gl/maplibre"; import type { Theme } from "~/AppContext"; +export interface StyleLoaderOptions { + includeTraffic?: boolean; +} + export async function loadStyle( styleName: string, - colorScheme: Theme + colorScheme: Theme, + options?: StyleLoaderOptions ): Promise { + const { includeTraffic = true } = options || {}; + if (colorScheme == "system") { const isDarkMode = window.matchMedia( "(prefers-color-scheme: dark)" @@ -21,6 +28,15 @@ export async function loadStyle( } const style = await resp.json(); + + // Remove traffic layers if not requested + if (!includeTraffic) { + style.layers = (style.layers || []).filter( + (layer: any) => !layer.id?.startsWith("vigo_traffic") + ); + delete style.sources?.vigo_traffic; + } + return style as StyleSpecification; } @@ -33,6 +49,14 @@ export async function loadStyle( const style = await resp.json(); + // Remove traffic layers if not requested + if (!includeTraffic) { + style.layers = (style.layers || []).filter( + (layer: any) => !layer.id?.startsWith("vigo_traffic") + ); + delete style.sources?.vigo_traffic; + } + const baseUrl = window.location.origin; const spritePath = style.sprite; -- cgit v1.3