Mapa de erros 4.1 e 4.5: diferenças em tabela e próximos passos agrupados
- Diferenças entre localizações em tabela por ano, população inteira com separador de milhares e a advertência uma só vez (legenda da tabela). - Componente NextActions: opções seguintes agrupadas numa lista com título, separadas do texto; aplicado às alternativas de exploração da carteira. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzJmxFy3izprXr5dSq91jm
This commit is contained in:
@@ -280,17 +280,35 @@ export default function DemographicEvidence({
|
||||
<h2 className="text-xl font-semibold">
|
||||
Diferenças entre localizações
|
||||
</h2>
|
||||
{Array.from(
|
||||
new Set(evidence.comparisons.map((c) => c.year)),
|
||||
)
|
||||
.sort((a, b) => a - b)
|
||||
.map((year) => (
|
||||
<section key={year} className="space-y-2">
|
||||
<h3 className="font-semibold">{year}</h3>
|
||||
{evidence.comparisons
|
||||
.filter((c) => c.year === year)
|
||||
<div className="overflow-auto">
|
||||
<table className="w-full min-w-[36rem] text-left text-sm">
|
||||
<caption className="text-left">
|
||||
População total por ano (pessoas). A diferença
|
||||
compara os totais do mesmo ano e da mesma
|
||||
edição; não mede procura efectiva.
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
{[
|
||||
'Ano',
|
||||
'Localização',
|
||||
'População',
|
||||
'Comparada com',
|
||||
'População',
|
||||
'Diferença',
|
||||
].map((h, index) => (
|
||||
<th className="p-2" key={index}>
|
||||
{h}
|
||||
</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{[...evidence.comparisons]
|
||||
.sort((a, b) => a.year - b.year)
|
||||
.map((c) => (
|
||||
<p
|
||||
<tr
|
||||
className="border-t"
|
||||
key={[
|
||||
c.year,
|
||||
c.left_import,
|
||||
@@ -299,25 +317,31 @@ export default function DemographicEvidence({
|
||||
c.right,
|
||||
].join(':')}
|
||||
>
|
||||
{c.left} (
|
||||
{populationValueLabel(c.left_value)}
|
||||
) / {c.right} (
|
||||
{populationValueLabel(
|
||||
c.right_value,
|
||||
)}
|
||||
). Diferença:{' '}
|
||||
{c.difference === null
|
||||
? 'não comparável: âmbitos ou metadados distintos'
|
||||
: populationValueLabel(
|
||||
c.difference,
|
||||
)}
|
||||
{c.difference !== null &&
|
||||
' pessoas'}
|
||||
.
|
||||
</p>
|
||||
<td className="p-2">{c.year}</td>
|
||||
<td className="p-2">{c.left}</td>
|
||||
<td className="p-2">
|
||||
{populationValueLabel(
|
||||
c.left_value,
|
||||
)}
|
||||
</td>
|
||||
<td className="p-2">{c.right}</td>
|
||||
<td className="p-2">
|
||||
{populationValueLabel(
|
||||
c.right_value,
|
||||
)}
|
||||
</td>
|
||||
<td className="p-2">
|
||||
{c.difference === null
|
||||
? 'Não comparável: âmbitos ou metadados distintos'
|
||||
: populationValueLabel(
|
||||
c.difference,
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</section>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
{evidence.differences.some(
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import { Link } from '@inertiajs/react';
|
||||
|
||||
export type NextAction = { label: string; href: string; description?: string };
|
||||
|
||||
/**
|
||||
* Next steps grouped in one place, one per line, apart from the surrounding text
|
||||
* (mapa de erros 4.5: options mixed into a line of text are hard to find).
|
||||
*/
|
||||
export default function NextActions({
|
||||
title = 'Próximos passos',
|
||||
actions,
|
||||
}: {
|
||||
title?: string;
|
||||
actions: NextAction[];
|
||||
}) {
|
||||
if (!actions.length) return null;
|
||||
return (
|
||||
<nav aria-label={title} className="space-y-2">
|
||||
<h3 className="font-semibold">{title}</h3>
|
||||
<ul className="grid gap-2 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{actions.map((action) => (
|
||||
<li key={action.href + action.label}>
|
||||
<Link
|
||||
className="block h-full rounded border bg-white p-3 font-medium text-emerald-900 underline-offset-4 hover:underline"
|
||||
href={action.href}
|
||||
>
|
||||
{action.label}
|
||||
{action.description && (
|
||||
<span className="mt-1 block text-sm font-normal text-slate-700">
|
||||
{action.description}
|
||||
</span>
|
||||
)}
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user