37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { getMyDocuments } from "@/lib/api";
|
|
import { formatDate } from "@/lib/utils";
|
|
import { getTranslations, setRequestLocale } from "next-intl/server";
|
|
|
|
export default async function CabinetDocumentsPage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ locale: string }>;
|
|
}) {
|
|
const { locale } = await params;
|
|
setRequestLocale(locale);
|
|
const t = await getTranslations("cabinet");
|
|
const documents = await getMyDocuments();
|
|
|
|
return (
|
|
<div>
|
|
<h2 className="mb-4 text-xl font-semibold">{t("documents")}</h2>
|
|
{documents.length === 0 ? (
|
|
<p className="text-[var(--text-muted)]">{t("emptyDocuments")}</p>
|
|
) : (
|
|
<ul className="space-y-3">
|
|
{documents.map((doc) => (
|
|
<li key={doc.id} className="rounded-[12px] border border-[var(--border)] bg-white px-4 py-3">
|
|
<a href={doc.href} className="font-semibold text-[var(--brand-700)]" target="_blank" rel="noreferrer">
|
|
{doc.title}
|
|
</a>
|
|
{doc.issuedAt ? (
|
|
<p className="mt-1 text-sm text-[var(--text-muted)]">{formatDate(doc.issuedAt, locale)}</p>
|
|
) : null}
|
|
</li>
|
|
))}
|
|
</ul>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|