@@ -1,15 +1,27 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import { notFound } from "next/navigation";
|
||||
import { PostList } from "@/app/components/PostList";
|
||||
import { headers } from "next/headers";
|
||||
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: {
|
||||
@@ -52,6 +64,9 @@ export default async function UserPublicProfile({ params }: { params: Promise<{
|
||||
<div className="flex items-center gap-2">
|
||||
<h1 className="text-xl font-bold text-neutral-900 truncate">{user.nickname}</h1>
|
||||
<GradeIcon grade={user.grade} width={20} height={20} />
|
||||
{currentUserId && currentUserId !== user.userId && (
|
||||
<SendMessageButton receiverId={user.userId} receiverNickname={user.nickname} />
|
||||
)}
|
||||
</div>
|
||||
<div className="text-sm text-neutral-600 mt-1 flex items-center gap-3">
|
||||
<span>Lv. {user.level}</span>
|
||||
|
||||
Reference in New Issue
Block a user