104 lines
3.8 KiB
TypeScript
104 lines
3.8 KiB
TypeScript
import { Link, router } from '@inertiajs/react';
|
|
import { Frame, card, button } from './shared';
|
|
export default function Workspace({
|
|
submissions,
|
|
favourites,
|
|
}: {
|
|
submissions: {
|
|
data: {
|
|
id: string;
|
|
status: string;
|
|
reference: string | null;
|
|
request_status: string | null;
|
|
created_at: string;
|
|
}[];
|
|
prev_page_url: string | null;
|
|
next_page_url: string | null;
|
|
};
|
|
favourites: { id: number; title: string; slug: string }[];
|
|
}) {
|
|
const states: Record<string, string> = {
|
|
received: 'Recebido',
|
|
in_review: 'Em análise',
|
|
contacted: 'Contactado',
|
|
closed: 'Encerrado',
|
|
};
|
|
return (
|
|
<Frame title="Área do investidor">
|
|
<nav className="flex flex-wrap gap-4">
|
|
<Link href="/investidor/profile" className="underline">
|
|
Perfil e empresas
|
|
</Link>
|
|
<Link href="/investidor/notifications" className="underline">
|
|
Notificações
|
|
</Link>
|
|
<Link href="/investidor" className="underline">
|
|
Fichas territoriais guardadas
|
|
</Link>
|
|
<Link href="/balcao-virtual" className="underline">
|
|
Apoio e parcerias
|
|
</Link>
|
|
</nav>
|
|
<button
|
|
className={button}
|
|
onClick={() => router.post('/investidor/manifestacoes')}
|
|
>
|
|
Preparar nova manifestação
|
|
</button>
|
|
<section className="space-y-4">
|
|
<h2 className="text-2xl font-bold">
|
|
Rascunhos e manifestações
|
|
</h2>
|
|
{submissions.data.map((s) => (
|
|
<article className={card} key={s.id}>
|
|
<Link
|
|
href={`/investidor/manifestacoes/${s.id}`}
|
|
className="font-semibold underline"
|
|
>
|
|
{s.reference ?? 'Continuar rascunho'}
|
|
</Link>
|
|
<p>
|
|
{s.status === 'draft'
|
|
? 'Rascunho privado'
|
|
: (states[s.request_status ?? ''] ??
|
|
s.request_status)}
|
|
</p>
|
|
<p>
|
|
{new Date(s.created_at).toLocaleDateString('pt-MZ')}
|
|
</p>
|
|
</article>
|
|
))}
|
|
{!submissions.data.length && (
|
|
<p>Ainda não existem manifestações neste percurso.</p>
|
|
)}
|
|
<nav aria-label="Paginação" className="flex gap-4">
|
|
{submissions.prev_page_url && (
|
|
<Link href={submissions.prev_page_url}>Anterior</Link>
|
|
)}
|
|
{submissions.next_page_url && (
|
|
<Link href={submissions.next_page_url}>Seguinte</Link>
|
|
)}
|
|
</nav>
|
|
</section>
|
|
<section className="space-y-4">
|
|
<h2 className="text-2xl font-bold">Oportunidades favoritas</h2>
|
|
{favourites.map((f) => (
|
|
<Link
|
|
href={`/oportunidades/${f.slug}`}
|
|
className={card + ' block'}
|
|
key={f.id}
|
|
>
|
|
{f.title}
|
|
</Link>
|
|
))}
|
|
{!favourites.length && (
|
|
<p>
|
|
Explore o catálogo e guarde as oportunidades que
|
|
pretende acompanhar.
|
|
</p>
|
|
)}
|
|
</section>
|
|
</Frame>
|
|
);
|
|
}
|