From 3a1a1e6dc2f6f0abceac5da0cfb530fdb45fc6f5 Mon Sep 17 00:00:00 2001
From: Ariel Costas Guerrero <ariel@costas.dev>
Date: Fri, 12 Dec 2025 10:24:43 +0100
Subject: Initial ultra-ñapa implementation of OTP integration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/frontend/app/routes/map.tsx | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

(limited to 'src/frontend/app/routes/map.tsx')

diff --git a/src/frontend/app/routes/map.tsx b/src/frontend/app/routes/map.tsx
index 187e9f2..182f4ce 100644
--- a/src/frontend/app/routes/map.tsx
+++ b/src/frontend/app/routes/map.tsx
@@ -1,7 +1,7 @@
 import StopDataProvider, { type Stop } from "../data/StopDataProvider";
 import "./map.css";
 
-import { loadStyle } from "app/maps/styleloader";
+import { DEFAULT_STYLE, loadStyle } from "app/maps/styleloader";
 import type { Feature as GeoJsonFeature, Point } from "geojson";
 import { useEffect, useRef, useState } from "react";
 import { useTranslation } from "react-i18next";
@@ -19,15 +19,6 @@ import { REGION_DATA } from "~/config/RegionConfig";
 import { usePageTitle } from "~/contexts/PageTitleContext";
 import { useApp } from "../AppContext";
 
-// Default minimal fallback style before dynamic loading
-const defaultStyle: StyleSpecification = {
-  version: 8,
-  glyphs: `${window.location.origin}/maps/fonts/{fontstack}/{range}.pbf`,
-  sprite: `${window.location.origin}/maps/spritesheet/sprite`,
-  sources: {},
-  layers: [],
-};
-
 // Componente principal del mapa
 export default function StopMap() {
   const { t } = useTranslation();
@@ -48,10 +39,9 @@ export default function StopMap() {
   const [isSheetOpen, setIsSheetOpen] = useState(false);
   const { mapState, updateMapState, theme } = useApp();
   const mapRef = useRef<MapRef>(null);
-  const [mapStyleKey, setMapStyleKey] = useState<string>("light");
 
   // Style state for Map component
-  const [mapStyle, setMapStyle] = useState<StyleSpecification>(defaultStyle);
+  const [mapStyle, setMapStyle] = useState<StyleSpecification>(DEFAULT_STYLE);
 
   // Handle click events on clusters and individual stops
   const onMapClick = (e: MapLayerMouseEvent) => {
@@ -111,7 +101,7 @@ export default function StopMap() {
     loadStyle(styleName, theme)
       .then((style) => setMapStyle(style))
       .catch((error) => console.error("Failed to load map style:", error));
-  }, [mapStyleKey, theme]);
+  }, [theme]);
 
   useEffect(() => {
     const handleMapChange = () => {
-- 
cgit v1.3

