import { listDocuments, extractFoldersForSection } from "@mcpedia/core"; import { cookies } from "next/headers"; import { redirect } from "next/navigation"; import DocForm from "@/components/DocForm"; import { WEBHOOK_SECRET } from "@mcpedia/config"; export const dynamic = "force-dynamic"; export default async function CreatePage() { const cookieStore = await cookies(); const canEdit = cookieStore.get("mcpedia_admin")?.value != null; if (!canEdit) redirect("/login"); const allDocs = await listDocuments(); // Build folder suggestions per section using the shared helper from core const sections = ["docs", "writeups", "research", "notes"]; const docPaths = allDocs.map((d) => d.path); const foldersBySection: Record = {}; for (const sec of sections) { foldersBySection[sec] = extractFoldersForSection(docPaths, sec); } return (

Create Document

); }