feat(web-next): render /blog/[slug] article detail via blog.articleBySlug

This commit is contained in:
2026-05-05 08:55:41 +02:00
parent 293d855d06
commit 7809f21151

View File

@@ -0,0 +1,34 @@
import { notFound } from "next/navigation";
import { appRouter } from "@repo/core-api";
import { bindAllProduction } from "../../../server/bind-production";
type PageProps = {
params: Promise<{ slug: string }>;
};
export default async function BlogPostPage({ params }: PageProps) {
await bindAllProduction();
const { slug } = await params;
const caller = appRouter.createCaller({});
const article = await caller.blog.articleBySlug({ slug });
if (!article) notFound();
return (
<main>
<article>
<header>
<h1>{article.title}</h1>
{article.createdAt ? (
<time dateTime={article.createdAt.toISOString()}>
{article.createdAt.toLocaleDateString()}
</time>
) : null}
</header>
<pre style={{ whiteSpace: "pre-wrap" }}>
{JSON.stringify(article.content, null, 2)}
</pre>
</article>
</main>
);
}