Update to use react-editor <App /> component
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import { readSchema } from "@/lib/schema.server";
|
||||
import { resolveSchemaEntry } from "@/lib/schema-resolver";
|
||||
import RenderClient from "@/components/RenderClient";
|
||||
import AppClient from "@/components/AppClient";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -12,16 +10,12 @@ export default async function Page({
|
||||
}) {
|
||||
const { path } = await params;
|
||||
const segments = (path ?? []).filter(Boolean);
|
||||
const currentPath = segments.length === 0 ? "/" : "/" + segments.join("/");
|
||||
const pages = await readSchema();
|
||||
|
||||
// The /edit branch is handled by app/edit; this catch-all only serves view.
|
||||
if (segments[0] === "edit") return notFound();
|
||||
|
||||
const route = "/" + segments.join("/");
|
||||
const lookup = route === "/" ? "/" : route.replace(/\/$/, "");
|
||||
|
||||
const schema = await readSchema();
|
||||
const resolved = resolveSchemaEntry(schema, lookup);
|
||||
if (!resolved) return notFound();
|
||||
|
||||
return <RenderClient data={resolved.data} route={lookup} />;
|
||||
return (
|
||||
<div style={{ height: "100vh", width: "100vw" }}>
|
||||
<AppClient pages={pages} currentPath={currentPath} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user