fix(geoportal): layer toggle + enrichment update + refresh button

1. Layer toggle fix: removed isStyleLoaded() check that silently blocked
   visibility changes when OpenFreeMap style has pending sprite/font loads
2. Enrichment: "Actualizeaza" button always visible (re-fetch from eTerra)
   replaces "Enrichment" button when data already exists
3. Panel updates with returned enrichment data immediately

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-24 13:53:18 +02:00
parent 19bed6724b
commit 024ee0f21a
2 changed files with 11 additions and 11 deletions
@@ -158,16 +158,16 @@ export function FeatureInfoPanel({ feature, onClose }: FeatureInfoPanelProps) {
{/* Action buttons */}
<div className="flex gap-1.5 pt-2 border-t mt-2">
{!hasRealEnrichment && (
<Button
variant="outline" size="sm" className="h-7 text-xs gap-1 flex-1"
onClick={handleEnrich} disabled={enriching}
title="Obtine date detaliate de la eTerra (proprietari, CF, categorie). Se salveaza permanent."
>
{enriching ? <Loader2 className="h-3 w-3 animate-spin" /> : <Sparkles className="h-3 w-3" />}
{enriching ? "Se incarca..." : "Enrichment"}
</Button>
)}
<Button
variant="outline" size="sm" className="h-7 text-xs gap-1 flex-1"
onClick={handleEnrich} disabled={enriching}
title={hasRealEnrichment
? "Actualizeaza datele de la eTerra (re-fetch proprietari, CF, categorie)"
: "Obtine date detaliate de la eTerra (proprietari, CF, categorie). Se salveaza permanent."}
>
{enriching ? <Loader2 className="h-3 w-3 animate-spin" /> : <Sparkles className="h-3 w-3" />}
{enriching ? "Se incarca..." : hasRealEnrichment ? "Actualizeaza" : "Enrichment"}
</Button>
{cfStatus?.available && cfStatus.downloadUrl ? (
<Button
@@ -303,7 +303,7 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
/* ---- Apply layer visibility ---- */
const applyLayerVisibility = useCallback((vis: LayerVisibility) => {
const map = mapRef.current;
if (!map || !map.isStyleLoaded()) return;
if (!map) return;
const mapping: Record<string, string[]> = {
uats: [
LAYER_IDS.uatsZ0Line,