vrsao 2
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-08 14:02:01 +02:00
parent bdd766c68a
commit 1106509116
354 changed files with 48275 additions and 24635 deletions
@@ -1,5 +1,7 @@
import { useEffect, useState } from "react";
import InteractiveInvestmentMap, { type InvestmentMapFeature } from "./interactive-investment-map";
import { useEffect, useState } from 'react';
import InteractiveInvestmentMap, {
type InvestmentMapFeature,
} from './interactive-investment-map';
export default function InvestmentMapPanel({
filters,
@@ -8,25 +10,31 @@ export default function InvestmentMapPanel({
}) {
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 [missing, setMissing] = useState<
{ id: number; title: string; url: string }[]
>([]);
const [error, setError] = useState('');
useEffect(() => {
const controller = new AbortController();
const params = new URLSearchParams(JSON.parse(key));
setPoints(null);
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) => {
if (controller.signal.aborted) return;
setPoints(data.features);
setMissing(data.unlocated ?? []);
setError(data.truncated ? "Cobertura limitada: refine os filtros." : "");
setError(
data.truncated
? 'Cobertura limitada: refine os filtros.'
: '',
);
})
.catch((e) => {
if (!controller.signal.aborted) setError(e.message);
@@ -39,7 +47,10 @@ export default function InvestmentMapPanel({
<InteractiveInvestmentMap points={points} />
{missing.length > 0 && (
<div>
<p>{missing.length} investimentos aguardam coordenadas do local:</p>
<p>
{missing.length} investimentos aguardam coordenadas do
local:
</p>
<ul>
{missing.map((record) => (
<li key={record.id}>