2026-08-20 13:21:53 +07:00
|
|
|
import Link from "next/link";
|
|
|
|
|
import { listDocuments } from "@mcpedia/core";
|
|
|
|
|
|
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
|
|
2026-08-20 16:57:30 +07:00
|
|
|
const SECTIONS = [
|
|
|
|
|
{ id: "docs", label: "Documentation" },
|
|
|
|
|
{ id: "writeups", label: "Writeups" },
|
|
|
|
|
{ id: "research", label: "Research" },
|
|
|
|
|
{ id: "notes", label: "Notes" },
|
|
|
|
|
] as const;
|
2026-08-20 13:21:53 +07:00
|
|
|
|
|
|
|
|
export default async function DocsIndexPage() {
|
|
|
|
|
const all = await listDocuments();
|
|
|
|
|
const bySection = SECTIONS.map((section) => ({
|
|
|
|
|
section,
|
2026-08-20 16:57:30 +07:00
|
|
|
docs: all.filter((d) => d.section === section.id),
|
2026-08-20 13:21:53 +07:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
return (
|
2026-08-20 16:57:30 +07:00
|
|
|
<div>
|
|
|
|
|
<h1 className="text-2xl font-light text-[#f7f8f8] mb-6">All Documents</h1>
|
|
|
|
|
|
|
|
|
|
{bySection.map(({ section, docs }) => {
|
|
|
|
|
if (docs.length === 0) return null;
|
|
|
|
|
return (
|
|
|
|
|
<section key={section.id} className="mb-10">
|
|
|
|
|
<h2 className="text-sm font-medium text-[#d0d6e0] uppercase mb-4">
|
|
|
|
|
{section.label}
|
|
|
|
|
</h2>
|
2026-08-20 13:21:53 +07:00
|
|
|
<ul className="space-y-2">
|
|
|
|
|
{docs.map((d) => (
|
|
|
|
|
<li key={d.slug}>
|
2026-08-20 16:57:30 +07:00
|
|
|
<Link
|
|
|
|
|
href={`/${d.slug}`}
|
|
|
|
|
className="text-[#d0d6e0] hover:text-[#f7f8f8] transition-colors"
|
|
|
|
|
>
|
2026-08-20 13:21:53 +07:00
|
|
|
{d.title}
|
|
|
|
|
</Link>
|
2026-08-20 16:57:30 +07:00
|
|
|
<span className="text-xs text-[#62666d] ml-2">
|
|
|
|
|
{d.tags.slice(0, 2).map((t) => `#${t}`).join(" ") || "—"}
|
2026-08-20 13:21:53 +07:00
|
|
|
</span>
|
|
|
|
|
</li>
|
|
|
|
|
))}
|
|
|
|
|
</ul>
|
2026-08-20 16:57:30 +07:00
|
|
|
</section>
|
|
|
|
|
);
|
|
|
|
|
})}
|
2026-08-20 13:21:53 +07:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|