import prisma from "@/lib/prisma"; import { notFound } from "next/navigation"; import { PostList } from "@/app/components/PostList"; import { HeroBanner } from "@/app/components/HeroBanner"; import { UserAvatar } from "@/app/components/UserAvatar"; import { GradeIcon, getGradeName } from "@/app/components/GradeIcon"; import { SendMessageButton } from "@/app/components/SendMessageButton"; import { headers } from "next/headers"; export default async function UserPublicProfile({ params }: { params: Promise<{ id: string }> }) { const p = await params; const userId = p.id; // 현재 로그인한 사용자 식별 (uid 쿠키 기반) const headerList = await headers(); const cookieHeader = headerList.get("cookie") || ""; const currentUid = cookieHeader .split(";") .map((s) => s.trim()) .find((pair) => pair.startsWith("uid=")) ?.split("=")[1] || ""; const currentUserId = currentUid ? decodeURIComponent(currentUid) : null; const user = await prisma.user.findUnique({ where: { userId }, select: { userId: true, nickname: true, profileImage: true, level: true, grade: true, points: true, }, }); if (!user) return notFound(); // 메인배너 표시 설정을 재사용(일관 UI) const SETTINGS_KEY = "mainpage_settings" as const; const settingRow = await prisma.setting.findUnique({ where: { key: SETTINGS_KEY } }); const parsed = settingRow ? JSON.parse(settingRow.value as string) : {}; const showBanner: boolean = parsed.showBanner ?? true; return (