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>
38 lines
976 B
TypeScript
38 lines
976 B
TypeScript
import type { Metadata } from "next";
|
|
import { notFound } from "next/navigation";
|
|
import { api } from "@community/lib/api";
|
|
import SiteShell from "@community/components/SiteShell";
|
|
import DiscussionDetailClient from "@community/components/DiscussionDetailClient";
|
|
|
|
export const revalidate = 60;
|
|
|
|
export async function generateMetadata({
|
|
params,
|
|
}: {
|
|
params: Promise<{ id: string }>;
|
|
}): Promise<Metadata> {
|
|
const { id } = await params;
|
|
try {
|
|
const d = await api.getDiscussion(id);
|
|
return { title: `${d.title} · nomadro 社区` };
|
|
} catch {
|
|
return { title: "讨论 · nomadro" };
|
|
}
|
|
}
|
|
|
|
export default async function DiscussionPage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ id: string }>;
|
|
}) {
|
|
const { id } = await params;
|
|
const discussion = await api.getDiscussion(id).catch(() => null);
|
|
if (!discussion) notFound();
|
|
|
|
return (
|
|
<SiteShell showFooter>
|
|
<DiscussionDetailClient discussionId={id} initial={discussion} />
|
|
</SiteShell>
|
|
);
|
|
}
|