Files
writer-work-flow/apps/web/app/projects/[id]/toolbox/page.tsx

34 lines
1011 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { BackendDownNotice } from "@/components/BackendDownNotice";
import { ToolboxPage } from "@/components/toolbox/ToolboxPage";
import { fetchProject, fetchToolbox } from "@/lib/api/server";
interface PageProps {
params: Promise<{ id: string }>;
searchParams: Promise<{ open?: string }>;
}
// 创作工具箱页。Server Component 取项目 + 工具描述符GET /skills/toolbox错误降级为空
// ?open=<tool_key> 由命令面板 action-gen-<key> 跳转,进页直开对应生成器(仅新工具)。
export default async function ToolboxRoutePage({
params,
searchParams,
}: PageProps) {
const { id } = await params;
const { open } = await searchParams;
try {
const [project, toolbox] = await Promise.all([
fetchProject(id),
fetchToolbox(),
]);
return (
<ToolboxPage
project={project}
tools={toolbox.tools ?? []}
initialOpenKey={open}
/>
);
} catch {
return <BackendDownNotice className="m-6" />;
}
}