CI / typecheck + build (turbo) (push) Canceled after 0s
- Delete apps/web/app/docs/page.tsx (superseded by generic [section]/page.tsx) - Homepage: inline folder tree per section card (📁📄), removed Suspense - Doc page breadcrumbs: dynamic path from doc.slug (was hardcoded 'Docs') - Header nav: added Writeups/Research/Notes section links - DocForm: parent folder dropdown populated from existing folders, slug read- only in edit mode, edit mode keeps section disabled, resolved slug shown - create/page.tsx: use extractFoldersForSection from @mcpedia/core (dedup) - Removed unused extractFoldersForSection import from page.tsx
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
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();
|
|
const docPaths = allDocs.map((d) => d.path);
|
|
|
|
// Build folder suggestions per section using the shared core helper
|
|
const sections = ["docs", "writeups", "research", "notes"];
|
|
const foldersBySection: Record<string, string[]> = {};
|
|
for (const sec of sections) {
|
|
foldersBySection[sec] = extractFoldersForSection(docPaths, sec);
|
|
}
|
|
|
|
return (
|
|
<div>
|
|
<h1 className="text-3xl font-medium text-[#f7f8f8] mb-6">Create Document</h1>
|
|
<DocForm
|
|
mode="create"
|
|
secret={WEBHOOK_SECRET}
|
|
existingFolders={foldersBySection}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|