import { readSchema } from "@/lib/schema.server";
import AppClient from "@/components/AppClient";

export const dynamic = "force-dynamic";

export default async function Page({
  params,
}: {
  params: Promise<{ path?: string[] }>;
}) {
  const { path } = await params;
  const segments = (path ?? []).filter(Boolean);
  const currentPath = segments.length === 0 ? "/" : "/" + segments.join("/");
  const pages = await readSchema();

  return (
    <div style={{ height: "100vh", width: "100vw" }}>
      <AppClient pages={pages} currentPath={currentPath} />
    </div>
  );
}
