import { notFound } from "next/navigation";

import { Workbench } from "@/components/workbench/Workbench";
import { fetchProject } from "@/lib/api/server";

interface PageProps {
  params: Promise<{ id: string }>;
}

// 写作工作台页（UX §6.3）。Server Component 取项目，Workbench 负责编辑/流式/保存。
export default async function WritePage({ params }: PageProps) {
  const { id } = await params;
  try {
    const project = await fetchProject(id);
    return <Workbench project={project} />;
  } catch {
    notFound();
  }
}
