import { pool } from "@/lib/db"; import { notFound } from "next/navigation"; type Post = { id: number; title: string; description: string; content: string; created_at: string; author: string | null; }; export default async function PostPage({ params, }: { params: Promise<{ id: string }>; }) { const { id } = await params; let post: Post | null = null; try { const conn = await pool.getConnection(); const rows = await conn.query( ` SELECT p.id, p.title, p.description, p.content, p.created_at, u.username AS author FROM posts p LEFT JOIN users u ON p.author_id = u.id WHERE p.id = ? `, [id] ); conn.release(); post = rows[0] ?? null; } catch (err) { console.error("Failed to load post:", err); } if (!post) { notFound(); } return (
{/* ================= LEFT: ARTICLE CONTENT ================= */}
{/* ================= RIGHT: META PANEL ================= */}
); }