oportunidades 4
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-10 07:03:59 +02:00
parent e662230df7
commit 6ddafc95ba
179 changed files with 22750 additions and 933 deletions
@@ -1,20 +1,23 @@
import { useEffect, useState } from 'react';
import { useEffect, useState } from "react";
import TerritoryGeometryPreview from "./territory-geometry-preview";
import InteractiveInvestmentMap, {
type InvestmentMapFeature,
type InvestmentMapArea,
} from './interactive-investment-map';
} from "./interactive-investment-map";
export default function InvestmentMapPanel({
filters,
territoryId,
}: {
filters: Record<string, string | number>;
territoryId?: string;
}) {
const key = JSON.stringify(filters);
const [points, setPoints] = useState<InvestmentMapFeature[] | null>(null);
const [missing, setMissing] = useState<
{ id: number; title: string; url: string }[]
>([]);
const [error, setError] = useState('');
const [error, setError] = useState("");
const [areas, setAreas] = useState<InvestmentMapArea[]>([]);
useEffect(() => {
const controller = new AbortController();
@@ -23,10 +26,10 @@ export default function InvestmentMapPanel({
setAreas([]);
fetch(`/api/v1/investment/map?${params}`, {
signal: controller.signal,
headers: { Accept: 'application/json' },
headers: { Accept: "application/json" },
})
.then(async (response) => {
if (!response.ok) throw new Error('Mapa indisponível.');
if (!response.ok) throw new Error("Mapa indisponível.");
return response.json();
})
.then((data) => {
@@ -36,8 +39,8 @@ export default function InvestmentMapPanel({
setMissing(data.unlocated ?? []);
setError(
data.truncated
? 'Cobertura limitada: refine os filtros.'
: '',
? "Cobertura limitada: refine os filtros."
: "",
);
})
.catch((e) => {
@@ -49,6 +52,19 @@ export default function InvestmentMapPanel({
<section className="space-y-3">
{error && <p role="alert">{error}</p>}
<InteractiveInvestmentMap points={points} areas={areas} />
<TerritoryGeometryPreview
territoryId={
territoryId ||
String(
filters.locality_id ||
filters.admin_post_id ||
filters.district_id ||
filters.province_id ||
filters.geo_location_id ||
"",
)
}
/>
{missing.length > 0 && (
<div>
<p>