125 lines
5.1 KiB
TypeScript
125 lines
5.1 KiB
TypeScript
import { Link, router } from "@inertiajs/react";
|
|
import { Frame, labels, button, type Partnership } from "./shared";
|
|
type Props = {
|
|
mine: Pick<Partnership, "id" | "title" | "status">[];
|
|
interests: {
|
|
id: number;
|
|
partnership_id: number;
|
|
title: string;
|
|
status: string;
|
|
decision_reason: string | null;
|
|
room_id: number | null;
|
|
}[];
|
|
moderation: Pick<Partnership, "id" | "title" | "status">[];
|
|
notifications: {
|
|
id: number;
|
|
title: string;
|
|
href: string;
|
|
read_at: string | null;
|
|
}[];
|
|
};
|
|
export default function Dashboard(p: Props) {
|
|
return (
|
|
<Frame title="O meu painel de parcerias">
|
|
<div className="space-y-8">
|
|
<section>
|
|
<h2 className="mb-4 text-xl font-bold">
|
|
Ideias e propostas
|
|
</h2>
|
|
<Link className={button} href="/parcerias/criar">
|
|
Preparar uma parceria
|
|
</Link>
|
|
{p.mine.map((x) => (
|
|
<article className="mt-4 rounded border p-4" key={x.id}>
|
|
<Link
|
|
className="font-semibold underline"
|
|
href={"/parcerias/" + x.id}
|
|
>
|
|
{x.title || "Ideia sem título"}
|
|
</Link>
|
|
<p>{labels[x.status] ?? x.status}</p>
|
|
<p>
|
|
Próxima ação:{" "}
|
|
{["draft", "returned", "rejected"].includes(
|
|
x.status,
|
|
)
|
|
? "Completar e pré-visualizar para submissão"
|
|
: x.status === "published"
|
|
? "Consultar candidatos e esclarecer pendências"
|
|
: "Acompanhar a decisão"}
|
|
</p>
|
|
</article>
|
|
))}
|
|
</section>
|
|
<section>
|
|
<h2 className="text-xl font-bold">
|
|
As minhas candidaturas
|
|
</h2>
|
|
{p.interests.map((x) => (
|
|
<article className="my-4 rounded border p-4" key={x.id}>
|
|
<Link
|
|
className="underline"
|
|
href={"/parcerias/" + x.partnership_id}
|
|
>
|
|
{x.title}
|
|
</Link>
|
|
<p>
|
|
{labels[x.status]} · {x.decision_reason}
|
|
</p>
|
|
{x.room_id && (
|
|
<Link
|
|
className={button}
|
|
href={"/parcerias/salas/" + x.room_id}
|
|
>
|
|
Abrir conexão privada
|
|
</Link>
|
|
)}
|
|
</article>
|
|
))}
|
|
</section>
|
|
{p.moderation.length > 0 && (
|
|
<section>
|
|
<h2 className="text-xl font-bold">Fila de moderação</h2>
|
|
{p.moderation.map((x) => (
|
|
<p key={x.id}>
|
|
<Link
|
|
className="underline"
|
|
href={"/parcerias/" + x.id}
|
|
>
|
|
{x.title} · {labels[x.status]}
|
|
</Link>
|
|
</p>
|
|
))}
|
|
</section>
|
|
)}
|
|
<section>
|
|
<h2 className="text-xl font-bold">
|
|
Notificações no portal
|
|
</h2>
|
|
{p.notifications.map((n) => (
|
|
<article className="my-3 rounded border p-3" key={n.id}>
|
|
<Link href={n.href} className="underline">
|
|
{n.title}
|
|
</Link>
|
|
{!n.read_at && (
|
|
<button
|
|
className="ml-4 underline"
|
|
onClick={() =>
|
|
router.post(
|
|
"/parcerias/notificacoes/" +
|
|
n.id +
|
|
"/ler",
|
|
)
|
|
}
|
|
>
|
|
Marcar como lida
|
|
</button>
|
|
)}
|
|
</article>
|
|
))}
|
|
</section>
|
|
</div>
|
|
</Frame>
|
|
);
|
|
}
|