@@ -1,5 +1,6 @@
|
||||
import { Head, Link } from '@inertiajs/react';
|
||||
import { dashboard } from '@/routes';
|
||||
import type { InvestmentContext } from '@/pages/investor-path/index';
|
||||
|
||||
type Summary = {
|
||||
requestsByStatus: Record<string, number>;
|
||||
@@ -23,7 +24,23 @@ const states: Record<string, string> = {
|
||||
const card =
|
||||
'rounded-xl border p-5 transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-primary';
|
||||
|
||||
export default function Dashboard({ summary }: { summary: Summary | null }) {
|
||||
export default function Dashboard({
|
||||
summary,
|
||||
investorPath,
|
||||
}: {
|
||||
summary: Summary | null;
|
||||
investorPath?: {
|
||||
contexts: InvestmentContext[];
|
||||
current: {
|
||||
id: string;
|
||||
next: { code: string; title: string } | null;
|
||||
pending: number;
|
||||
documents: number;
|
||||
results: number;
|
||||
tasks: number;
|
||||
} | null;
|
||||
} | null;
|
||||
}) {
|
||||
return (
|
||||
<main className="space-y-8 p-4 md:p-8">
|
||||
<Head title="Painel" />
|
||||
@@ -160,6 +177,60 @@ export default function Dashboard({ summary }: { summary: Summary | null }) {
|
||||
</Link>
|
||||
</nav>
|
||||
</>
|
||||
) : investorPath ? (
|
||||
<section className="space-y-4 rounded-xl border p-6">
|
||||
<h2 className="text-lg font-semibold">
|
||||
Os meus investimentos
|
||||
</h2>
|
||||
{investorPath.current && (
|
||||
<div className="space-y-2">
|
||||
<p>
|
||||
{investorPath.current.pending} etapas pendentes
|
||||
· {investorPath.current.documents} documentos ·{' '}
|
||||
{investorPath.current.results} resultados ·{' '}
|
||||
{investorPath.current.tasks} tarefas
|
||||
</p>
|
||||
{investorPath.current.next && (
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/investimentos/${investorPath.current.id}#${investorPath.current.next.code}`}
|
||||
>
|
||||
Próxima acção:{' '}
|
||||
{investorPath.current.next.code} ·{' '}
|
||||
{investorPath.current.next.title}
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{investorPath.contexts.map((item, index) => (
|
||||
<div className="rounded border p-4" key={item.id}>
|
||||
<p>
|
||||
{index === 0
|
||||
? 'Investimento actualizado mais recentemente'
|
||||
: 'Outro investimento'}
|
||||
</p>
|
||||
<Link
|
||||
className="font-semibold underline"
|
||||
href={`/investimentos/${item.id}`}
|
||||
>
|
||||
{item.title}
|
||||
</Link>
|
||||
<p>
|
||||
Percurso, pendências, documentos, resultados e
|
||||
próxima acção no dossier.
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
{!investorPath.contexts.length && (
|
||||
<p>
|
||||
Comece pela sua ideia e prepare as etapas ao seu
|
||||
ritmo.
|
||||
</p>
|
||||
)}
|
||||
<Link className="underline" href="/investimentos">
|
||||
Preparar ou escolher um investimento
|
||||
</Link>
|
||||
</section>
|
||||
) : (
|
||||
<section className="max-w-2xl space-y-4 rounded-xl border p-6">
|
||||
<h2 className="text-lg font-semibold">
|
||||
|
||||
Reference in New Issue
Block a user