feat: display precise public labour and economic observations in map context
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -18,6 +18,7 @@ import { useEffect, useRef, useState } from 'react';
|
||||
import Map, {
|
||||
type ThematicMapRecord,
|
||||
} from '@/components/thematic-investment-map';
|
||||
import type { QuantitativeMapContext } from '@/components/investment-map-indicators';
|
||||
import type { InvestmentMapArea } from '@/components/interactive-investment-map';
|
||||
import { type TerritoryOption } from '@/components/investment-territory';
|
||||
import { Frame, button, card, money, api } from './shared';
|
||||
@@ -183,6 +184,8 @@ export default function Catalogue({
|
||||
const [thematicRecords, setThematicRecords] = useState<ThematicMapRecord[]>(
|
||||
[],
|
||||
);
|
||||
const [quantitativeContext, setQuantitativeContext] =
|
||||
useState<QuantitativeMapContext | null>(null);
|
||||
const [areas, setAreas] = useState<InvestmentMapArea[]>([]);
|
||||
const [unlocated, setUnlocated] = useState<
|
||||
{ id: number; title: string; location: string; url: string }[]
|
||||
@@ -326,6 +329,7 @@ export default function Catalogue({
|
||||
setPoints(null);
|
||||
setAreas([]);
|
||||
setThematicRecords([]);
|
||||
setQuantitativeContext(null);
|
||||
setUnlocated([]);
|
||||
setMapContext([]);
|
||||
setTruncated(false);
|
||||
@@ -336,16 +340,29 @@ export default function Catalogue({
|
||||
setPoints(data.features);
|
||||
setAreas(data.areas ?? []);
|
||||
setThematicRecords(data.thematic_records ?? []);
|
||||
setQuantitativeContext(
|
||||
data.quantitative_context ?? {
|
||||
state: 'unavailable',
|
||||
records: [],
|
||||
truncated: false,
|
||||
},
|
||||
);
|
||||
setUnlocated(data.unlocated ?? []);
|
||||
setMapContext(data.territorial_context ?? []);
|
||||
setTruncated(Boolean(data.truncated));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
if (active)
|
||||
if (active) {
|
||||
setQuantitativeContext({
|
||||
state: 'error',
|
||||
records: [],
|
||||
truncated: false,
|
||||
});
|
||||
setError(
|
||||
'Mapa indisponível. A lista e os filtros continuam disponíveis.',
|
||||
);
|
||||
}
|
||||
});
|
||||
return () => {
|
||||
active = false;
|
||||
@@ -655,6 +672,7 @@ export default function Catalogue({
|
||||
points={error ? [] : points}
|
||||
areas={areas}
|
||||
records={thematicRecords}
|
||||
quantitative={quantitativeContext}
|
||||
truncated={truncated}
|
||||
territoryId={
|
||||
String(
|
||||
|
||||
Reference in New Issue
Block a user