78 lines
2.7 KiB
TypeScript
78 lines
2.7 KiB
TypeScript
import InteractiveInvestmentMap, {
|
|
type InvestmentMapArea,
|
|
type InvestmentMapFeature,
|
|
type InvestmentMapKind,
|
|
} from './interactive-investment-map';
|
|
import { TerritoryGeometryDetails } from './territory-geometry-preview';
|
|
import { useTerritoryGeometry } from './use-territory-geometry';
|
|
const noAreas: InvestmentMapArea[] = [];
|
|
|
|
export default function CatalogueInvestmentMap({
|
|
points,
|
|
areas = noAreas,
|
|
territoryId,
|
|
mapKind,
|
|
}: {
|
|
points: InvestmentMapFeature[] | null;
|
|
areas?: InvestmentMapArea[];
|
|
territoryId?: string;
|
|
mapKind?: InvestmentMapKind;
|
|
}) {
|
|
const { context, error } = useTerritoryGeometry(
|
|
territoryId,
|
|
undefined,
|
|
true,
|
|
);
|
|
return (
|
|
<InteractiveInvestmentMap
|
|
points={points}
|
|
areas={areas}
|
|
administrativeAreas={context?.areas}
|
|
layerControls
|
|
mapKind={mapKind}
|
|
administrativeInfo={
|
|
territoryId ? (
|
|
<TerritoryGeometryDetails
|
|
context={context}
|
|
error={error}
|
|
showSources={false}
|
|
/>
|
|
) : undefined
|
|
}
|
|
notice={
|
|
territoryId ? (
|
|
<>
|
|
{error && (
|
|
<p role="alert">
|
|
{error} Os restantes dados do mapa continuam
|
|
disponíveis.
|
|
</p>
|
|
)}
|
|
{!context && !error && (
|
|
<p role="status">
|
|
A carregar limites administrativos…
|
|
</p>
|
|
)}
|
|
{context && !context.selected_geometry_available && (
|
|
<p role="note">
|
|
Sem limite administrativo acessível para o
|
|
território seleccionado.
|
|
{context.areas.length > 0
|
|
? ' Os limites disponíveis são contexto administrativo e não substituem o limite da selecção.'
|
|
: ''}
|
|
</p>
|
|
)}
|
|
{context?.truncated && (
|
|
<p role="alert">
|
|
Cobertura administrativa incompleta: são
|
|
consultadas até 100 geometrias e 500
|
|
subdivisões.
|
|
</p>
|
|
)}
|
|
</>
|
|
) : undefined
|
|
}
|
|
/>
|
|
);
|
|
}
|