diff --git a/src/modules/geoportal/components/feature-info-panel.tsx b/src/modules/geoportal/components/feature-info-panel.tsx index a70855c..79262b4 100644 --- a/src/modules/geoportal/components/feature-info-panel.tsx +++ b/src/modules/geoportal/components/feature-info-panel.tsx @@ -76,7 +76,13 @@ export function FeatureInfoPanel({ feature, onClose }: FeatureInfoPanelProps) { }); const d = await resp.json(); if (resp.ok) { - setEnrichMsg(d.message ?? "Enrichment pornit"); + // Update panel with enrichment data immediately + if (d.enrichment && detail) { + setDetail({ ...detail, enrichment: d.enrichment, enrichedAt: new Date().toISOString() }); + setEnrichMsg(""); + } else { + setEnrichMsg(d.message ?? "Enrichment finalizat"); + } } else { setEnrichMsg(d.error ?? "Eroare la enrichment"); } diff --git a/src/modules/geoportal/components/map-viewer.tsx b/src/modules/geoportal/components/map-viewer.tsx index 56290d0..703974f 100644 --- a/src/modules/geoportal/components/map-viewer.tsx +++ b/src/modules/geoportal/components/map-viewer.tsx @@ -362,14 +362,16 @@ export const MapViewer = forwardRef( map.on("load", () => { const m = resolvedMartinUrl; - // Hide OpenFreeMap's built-in layers we don't need + // Hide OpenFreeMap's built-in boundary/admin layers for (const layer of map.getStyle().layers) { - const id = layer.id.toLowerCase(); - if ( - id.includes("boundar") || id.includes("admin") || - (id.includes("border") && !id.includes("water")) || - id.includes("oneway") || id.includes("one-way") || id.includes("arrow") - ) { + const id = layer.id; + // Match common OpenMapTiles boundary layer naming patterns + if (/boundar|admin|border(?!.*water)|oneway|arrow/i.test(id)) { + try { map.setLayoutProperty(layer.id, "visibility", "none"); } catch { /* noop */ } + } + // Also hide by source-layer (more reliable) + const sl = ("source-layer" in layer && typeof layer["source-layer"] === "string") ? layer["source-layer"] : ""; + if (sl === "boundary" || sl === "admin") { try { map.setLayoutProperty(layer.id, "visibility", "none"); } catch { /* noop */ } } } @@ -456,9 +458,15 @@ export const MapViewer = forwardRef( paint: { "line-color": "#f59e0b", "line-width": 2, "line-dasharray": [3, 2] }, }); - // Apply initial visibility — HIDE ALL by default, then show only enabled ones - const allOff: Record = { uats: false, terenuri: false, cladiri: false, administrativ: false }; - applyLayerVisibility(layerVisibility ? { ...allOff, ...layerVisibility } : allOff); + // HIDE ALL data layers immediately after creation + const allLayerIds = [ + ...Object.values(LAYER_IDS).filter(id => !id.includes("draw") && !id.includes("selection")), + ]; + for (const lid of allLayerIds) { + try { map.setLayoutProperty(lid, "visibility", "none"); } catch { /* noop */ } + } + // Then show only the ones that should be visible + if (layerVisibility) applyLayerVisibility(layerVisibility); setMapReady(true); });