import { notFound } from "next/navigation"; import { MDXRemote } from "next-mdx-remote/rsc"; import { TRPCError } from "@trpc/server"; import { servTrpc } from "~/app/_trpc/ServerClient"; import { Badge } from "~/components/ui/badge"; import { mdxComponents } from "../_components/mdx-components"; type Props = { params: Promise<{ slug: string }>; }; export default async function BlogPostPage({ params }: Props) { const { slug } = await params; let post: Awaited>; try { post = await servTrpc.blog.bySlug(slug); } catch (e) { if (e instanceof TRPCError && e.code === "NOT_FOUND") notFound(); throw e; } return (

{post.title}

{post.date && ( )} {post.tags.length > 0 && (
{post.tags.map((tag) => ( {tag} ))}
)}
); }