From b46eb7a70f5d18546afc43c49a3db829216a62c5 Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Sat, 28 Mar 2026 18:53:12 +0200 Subject: [PATCH] feat(parcel-sync): add building status layer to Harta tab (gis_cladiri_status) Buildings now color-coded on legal status in ParcelSync map view: - Blue fill: building has legal documents (build_legal = 1) - Red fill: building without legal documents (build_legal = 0) Previously only parcels had status coloring; buildings were plain blue. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../parcel-sync/components/tabs/map-tab.tsx | 62 ++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/src/modules/parcel-sync/components/tabs/map-tab.tsx b/src/modules/parcel-sync/components/tabs/map-tab.tsx index 1c72065..5b2d6e6 100644 --- a/src/modules/parcel-sync/components/tabs/map-tab.tsx +++ b/src/modules/parcel-sync/components/tabs/map-tab.tsx @@ -363,7 +363,67 @@ export function MapTab({ siruta, sirutaValid, sessionConnected, syncLocalCount, } } - // Buildings: keep base layer visible with siruta filter (already applied above) + // ── 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: 14, + maxzoom: 18, + }); + + // Data-driven fill: red = no legal docs, blue = has legal docs + 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"], 1], + "#3b82f6", // blue: legal docs OK + "#ef4444", // red: no legal docs + ], + "fill-opacity": 0.55, + }, + }, + "l-terenuri-fill", + ); + + 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"], 1], + "#1e40af", // dark blue: legal + "#b91c1c", // dark red: no legal + ], + "line-width": 1.5, + }, + }, + "l-terenuri-fill", + ); + } 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 */ + } + } }, [mapReady, siruta, sirutaValid]); /* ── Boundary cross-check: load mismatched parcels ─────────── */