Carteira 4.3: ficha sem ligações mostra oportunidades da mesma província e sector, indicadas como não ligadas

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzJmxFy3izprXr5dSq91jM
This commit is contained in:
Claude
2026-12-05 11:01:59 +02:00
committed by nala
parent 0556d15e37
commit e6888e790f
4 changed files with 167 additions and 2 deletions
+45 -1
View File
@@ -68,6 +68,18 @@ type Props = {
summary: string;
}[];
chains?: { id: string; name: string; stage: string }[];
nearby?: {
provinces: string[];
sector: string;
items: {
id: number;
title: string;
slug: string;
summary: string;
sector: string;
province: string;
}[];
} | null;
};
function Editor({
@@ -80,6 +92,7 @@ function Editor({
management,
origin,
opportunities = [],
nearby = null,
chains = [],
zones = [],
anchorProject = null,
@@ -393,11 +406,42 @@ function Editor({
<p>{opportunity.summary}</p>
</article>
))}
{!opportunities.length && (
{!opportunities.length && !nearby?.items.length && (
<PublishedOpportunitiesEmpty
href={searchTerritoryHref('/oportunidades', pageUrl)}
/>
)}
{!opportunities.length && !!nearby?.items.length && (
<div
className="space-y-3"
aria-label="Oportunidades não ligadas"
>
<p role="status">
Esta ficha ainda não tem oportunidades ligadas.
Estas oportunidades publicadas são da mesma
província ({nearby.provinces.join(', ')}) e de um
sector próximo; não estão ligadas a esta ficha.
</p>
{nearby.items.map((opportunity) => (
<article key={opportunity.id}>
<Link
className="font-semibold underline"
href={searchTerritoryHref(
`/oportunidades/${opportunity.slug}`,
pageUrl,
)}
>
{opportunity.title}
</Link>
<p className="text-sm">
{opportunity.province} ·{' '}
{opportunity.sector}
</p>
<p>{opportunity.summary}</p>
</article>
))}
</div>
)}
</section>
{management ? (
<>