Reconciliar fontes instaladas 423bd512d8c5 com main

This commit is contained in:
2026-10-20 14:45:19 +02:00
parent 507387502c
commit 9ab721c97f
108 changed files with 2766 additions and 494 deletions
@@ -1,3 +1,4 @@
import SearchState from '@/components/search-state';
import { useEffect, useId, useState } from 'react';
import { api } from '@/pages/investment/shared';
import { replaceTerritoryPath } from '@/lib/territory-path.js';
@@ -110,12 +111,10 @@ export function ProvinceSelect({
.then((data) => {
if (!controller.signal.aborted) setOptions(data.data);
})
.catch((cause) => {
.catch(() => {
if (!controller.signal.aborted)
setError(
cause instanceof Error
? cause.message
: 'Erro de ligação.',
'Não foi possível concluir a pesquisa.',
);
})
.finally(() => {
@@ -131,6 +130,7 @@ export function ProvinceSelect({
return (
<>
<SearchState loading={loading} error={error} total={options.length} retry={() => setRetry(value => value + 1)} />
<input
className={className}
aria-label={`Pesquisar ${label}`}
@@ -162,17 +162,6 @@ export function ProvinceSelect({
</option>
))}
</select>
{error && (
<span role="alert" className="block text-sm">
{error}{' '}
<button
type="button"
onClick={() => setRetry((current) => current + 1)}
>
Tentar novamente
</button>
</span>
)}
{geometryFeedback && <p role="status">{geometryFeedback}</p>}
<TerritoryGeometryPreview
territoryId={
@@ -309,10 +298,10 @@ export function TerritoryLevel({
if (controller.signal.aborted) return;
setOptions(data.data);
setMore(Boolean(data.next_page_url));
} catch (e) {
} catch {
if (!controller.signal.aborted)
setError(
e instanceof Error ? e.message : 'Erro de ligação.',
'Não foi possível concluir a pesquisa.',
);
} finally {
if (!controller.signal.aborted) setLoading(false);
@@ -325,6 +314,7 @@ export function TerritoryLevel({
}, [index, parent, page, enabled, endpoint, retry, search]);
return (
<div className="space-y-2">
{enabled && <SearchState loading={loading} error={error} total={options.length} retry={() => setRetry(value => value + 1)} />}
<label htmlFor={id} className="font-medium">
{labels[index]}
</label>
@@ -370,22 +360,11 @@ export function TerritoryLevel({
))}
</select>
{loading && <p role="status">A carregar…</p>}
{error && (
<div role="alert">
{error}{' '}
<button type="button" onClick={() => setRetry(retry + 1)}>
Tentar novamente
</button>
</div>
)}
{fieldError && (
<p id={`${id}-error`} role="alert">
{fieldError}
</p>
)}
{enabled && !loading && !error && options.length === 0 && (
<p className="text-sm">Sem opções para esta pesquisa.</p>
)}
<div className="flex gap-3 text-sm">
{page > 1 && (
<button type="button" onClick={() => setPage(page - 1)}>