import { WikiView } from "@/components/wiki-view";
import { listWikiPages, readWikiPage } from "@/lib/wiki";

export const dynamic = "force-dynamic";

export default async function WikiPage() {
  const pages = listWikiPages();
  const firstPage = pages[0] ? readWikiPage(pages[0].filename) : null;

  return (
    <WikiView
      pages={pages}
      initialPageContent={
        firstPage
          ? {
              title: firstPage.metadata.title,
              content: firstPage.content,
            }
          : null
      }
    />
  );
}
