"use client";

import { useParams } from "next/navigation";
import { Render } from "@reacteditor/core";
import { appConfig } from "@/editor.config";
import resolveRoute from "@/lib/resolve-route";
import schema from "@/app.schema.json";

export default function Page() {
  const params = useParams();
  const slug = Array.isArray(params?.slug) ? (params.slug as string[]) : [];
  const { key } = resolveRoute(slug);
  const pageData = (schema as any)[key];
  return <Render config={appConfig as any} data={pageData} />;
}
