diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx index 63e0431..8d53cf9 100644 --- a/apps/web/app/page.tsx +++ b/apps/web/app/page.tsx @@ -1,82 +1,194 @@ import Link from "next/link"; import { listDocuments } from "@mcpedia/core"; import { cookies } from "next/headers"; +import type { DocSection } from "@mcpedia/core"; export const dynamic = "force-dynamic"; -const SECTIONS = [ - { id: "docs", label: "Documentation" }, - { id: "writeups", label: "Writeups" }, - { id: "research", label: "Research" }, - { id: "notes", label: "Notes" }, -] as const; +const SECTIONS: { id: DocSection; label: string; icon: string; desc: string }[] = [ + { + id: "docs", + label: "Documentation", + icon: "📄", + desc: "Setup guides, API references, and protocol specs.", + }, + { id: "writeups", label: "Writeups", icon: "📝", desc: "Post-mortems, debugging stories, and case studies." }, + { id: "research", label: "Research", icon: "🔬", desc: "Deep-dive analysis, architecture notes, and experiments." }, + { id: "notes", label: "Notes", icon: "📌", desc: "Quick references, patterns, and gotchas." }, +]; export default async function HomePage() { const all = await listDocuments(); - const bySection = SECTIONS.map((section) => ({ - ...section, - docs: all.filter((d) => d.section === section.id), - })); - const cookieStore = await cookies(); const canEdit = cookieStore.get("mcpedia_admin")?.value != null; - return ( -
-
-

- MCPedia -

-

- A content-first knowledge base. Humans read the Web UI; AI agents - use the MCP server. Both share one Core. -

-
+ const recent = [...all] + .sort( + (a, b) => + new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime(), + ) + .slice(0, 6); - {canEdit && ( -
+ const bySection = SECTIONS.map((s) => ({ + ...s, + docs: all.filter((d) => d.section === s.id).slice(0, 4), + total: all.filter((d) => d.section === s.id).length, + })); + + return ( + <> + {/* ── Hero ── */} +
+
+

+ MCPedia +

+

+ A content-first knowledge base for humans and AI agents. Read the + web docs, call the MCP server, or browse the full document archive. +

+ +
+ + Browse Documents + + + Search + +
+ + {/* Search box */} - + Create Document + + + + + Search documents, tags, authors... +
+
+ + {/* ── Section Overview ── */} +
+

+ Browse by section +

+
+ {bySection.map((s) => ( + +
{s.icon}
+

+ {s.label} +

+

+ {s.desc} +

+ + {s.total} document{s.total !== 1 ? "s" : ""} + + + ))} +
+
+ + {/* ── Recent Documents ── */} + {recent.length > 0 && ( +
+
+

+ Recently updated +

+ + View all → + +
+
+ {recent.map((d) => ( + +
+ + {SECTIONS.find((s) => s.id === d.section)?.icon || "📄"} + + +
+

+ {d.title} +

+
+ {d.tags.slice(0, 3).map((t) => ( + + #{t} + + ))} +
+ + ))} +
+
)} - {bySection.map(({ id, label, docs }) => { - if (docs.length === 0) return null; - return ( -
-

- {label} -

-
    - {docs.map((d) => ( -
  • - - - • - - - {d.title} - {d.tags.length > 0 && ( - - {" "} - {d.tags.slice(0, 3).map((t) => `#${t}`).join(" ")} - - )} - - -
  • - ))} -
-
- ); - })} -
+ {/* ── MCP info ── */} +
+
+
+

AI agents

+

+ MCP server at{" "} + + mcp.asepharyana.my.id/mcp + + . All tools available via Streamable HTTP transport. +

+
+ + MCP spec → + +
+
+ ); }