diff --git a/src/modules/parcel-sync/components/tabs/map-tab.tsx b/src/modules/parcel-sync/components/tabs/map-tab.tsx index 4533a67..8af9d15 100644 --- a/src/modules/parcel-sync/components/tabs/map-tab.tsx +++ b/src/modules/parcel-sync/components/tabs/map-tab.tsx @@ -203,7 +203,7 @@ export function MapTab({ siruta, sirutaValid }: MapTabProps) { maxzoom: 18, }); - // Data-driven fill: yellowish = no enrichment, dark green = enriched + // Data-driven fill: red = building no legal, green = enriched, yellow = no enrichment map.addLayer( { id: "l-ps-terenuri-fill", @@ -215,11 +215,33 @@ export function MapTab({ siruta, sirutaValid }: MapTabProps) { paint: { "fill-color": [ "case", + // Building without legal docs: RED fill (covers building too) + [ + "all", + ["==", ["get", "has_building"], 1], + ["==", ["get", "build_legal"], 0], + ], + "#ef4444", + // Building with legal: light blue + ["==", ["get", "has_building"], 1], + "#93c5fd", + // Enriched, no building: green ["==", ["get", "has_enrichment"], 1], - "#22c55e", // green: enriched - "#fbbf24", // amber/yellow: no enrichment + "#22c55e", + // No enrichment: amber/yellow + "#fbbf24", + ], + "fill-opacity": [ + "case", + // Stronger opacity for building issues so it shows through + [ + "all", + ["==", ["get", "has_building"], 1], + ["==", ["get", "build_legal"], 0], + ], + 0.45, + 0.25, ], - "fill-opacity": 0.3, }, }, "l-terenuri-fill", // below the transparent click-catcher @@ -268,77 +290,7 @@ export function MapTab({ siruta, sirutaValid }: MapTabProps) { } } - // ── Enrichment overlay for BUILDINGS ── - if (!map.getSource("gis_cladiri_status")) { - map.addSource("gis_cladiri_status", { - type: "vector", - tiles: [`${martinBase}/gis_cladiri_status/{z}/{x}/{y}`], - minzoom: 12, - maxzoom: 18, - }); - - // Hide base cladiri layers - try { - if (map.getLayer("l-cladiri-fill")) - map.setPaintProperty("l-cladiri-fill", "fill-opacity", 0); - } catch { - /* noop */ - } - - // Buildings: red fill = no legal, blue fill = legal, gray = unknown - map.addLayer( - { - id: "l-ps-cladiri-fill", - type: "fill", - source: "gis_cladiri_status", - "source-layer": "gis_cladiri_status", - minzoom: 14, - filter, - paint: { - "fill-color": [ - "case", - ["==", ["get", "build_legal"], 0], - "#ef4444", // red: no legal - ["==", ["get", "build_legal"], 1], - "#3b82f6", // blue: legal - "#6b7280", // gray: unknown (-1) - ], - "fill-opacity": 0.5, - }, - }, - "l-cladiri-line", - ); - - map.addLayer( - { - id: "l-ps-cladiri-line", - type: "line", - source: "gis_cladiri_status", - "source-layer": "gis_cladiri_status", - minzoom: 14, - filter, - paint: { - "line-color": [ - "case", - ["==", ["get", "build_legal"], 0], - "#dc2626", // dark red - "#1e3a5f", // dark blue - ], - "line-width": 0.8, - }, - }, - "l-cladiri-line", - ); - } else { - try { - if (map.getLayer("l-ps-cladiri-fill")) - map.setFilter("l-ps-cladiri-fill", filter); - if (map.getLayer("l-ps-cladiri-line")) - map.setFilter("l-ps-cladiri-line", filter); - } catch { - /* noop */ - } - } + // Buildings: keep base layer visible with siruta filter (already applied above) }, [mapReady, siruta, sirutaValid]); /* ── Boundary cross-check: load mismatched parcels ─────────── */ @@ -525,23 +477,22 @@ export function MapTab({ siruta, sirutaValid }: MapTabProps) { {/* Bottom-right: legend */}