"use client"; import { useRef, useState, useCallback } from "react"; import dynamic from "next/dynamic"; import { BasemapSwitcher, type BasemapId } from "./basemap-switcher"; import { SearchBar, type FeatureHit, type UatHit } from "./search-bar"; import { FeatureInfoPanel, type ClickedFeatureLite, } from "./feature-info-panel"; import type { MapViewerHandle } from "./map-viewer"; const MapViewer = dynamic( () => import("./map-viewer").then((m) => ({ default: m.MapViewer })), { ssr: false, loading: () => (

Se încarcă harta…

), }, ); export function GeoportalV2() { const mapRef = useRef(null); const [basemap, setBasemap] = useState("liberty"); const [clicked, setClicked] = useState(null); const handleFeatureClick = useCallback((f: ClickedFeatureLite | null) => { setClicked(f); }, []); const handleUatSelect = useCallback((uat: UatHit) => { // gis-api search doesn't return UAT bounds today, so we can't flyTo // server-side. Workaround: deep-link to eterra.live/harta which has // bbox lookup (their /api/geoportal/uat-bounds + flyTo). Future: // add GET /api/v1/uat/:siruta/bounds to gis-api and fitBounds here. const url = `https://eterra.live/harta?siruta=${encodeURIComponent(uat.siruta)}`; window.open(url, "_blank", "noopener,noreferrer"); }, []); const handleFeatureSelect = useCallback((f: FeatureHit) => { // Show panel directly (feature ID is known) setClicked({ id: f.id, siruta: "", cadastralRef: f.cadastralRef, layerId: f.layerId, areaValue: f.areaValue, }); }, []); return (
{/* Top-left: search */}
{/* Top-right: basemap + panel */}
{clicked && ( setClicked(null)} /> )}
{/* Bottom-right: cutover badge (visible until full rollout) */}
gis.ac · v2
); }