Replace reverse-proxy/iframe approach with @ebook/@community/@navmini imports under /nav /book /community so localhost:3000 serves all three products directly. Co-authored-by: Cursor <cursoragent@cursor.com>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { notFound } from "next/navigation";
|
|
import { api } from "@community/lib/api";
|
|
import SiteShell from "@community/components/SiteShell";
|
|
import ToolRunnerClient from "@community/components/ToolRunnerClient";
|
|
import { TOOL_LINKS } from "@community/lib/tools";
|
|
import { isRunnableTool } from "@community/lib/toolsRegistry";
|
|
|
|
export const revalidate = 60;
|
|
|
|
export function generateStaticParams() {
|
|
return TOOL_LINKS.filter((t) => isRunnableTool(t.id)).map((t) => ({ id: t.id }));
|
|
}
|
|
|
|
export async function generateMetadata({
|
|
params,
|
|
}: {
|
|
params: Promise<{ id: string }>;
|
|
}): Promise<Metadata> {
|
|
const { id } = await params;
|
|
const tool = TOOL_LINKS.find((t) => t.id === id);
|
|
if (!tool) return { title: "工具 · nomadro" };
|
|
return {
|
|
title: `${tool.title} · nomadro 工具箱`,
|
|
description: tool.desc,
|
|
};
|
|
}
|
|
|
|
export default async function ToolPage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ id: string }>;
|
|
}) {
|
|
const { id } = await params;
|
|
if (!isRunnableTool(id)) notFound();
|
|
|
|
const destinations = await api.getDestinations().catch(() => []);
|
|
|
|
return (
|
|
<SiteShell showFooter>
|
|
<ToolRunnerClient toolId={id} destinations={destinations} />
|
|
</SiteShell>
|
|
);
|
|
}
|