174
src/app/page.tsx
174
src/app/page.tsx
@@ -50,14 +50,7 @@ export default async function Home({ searchParams }: { searchParams: Promise<{ s
|
||||
// 에러 무시
|
||||
}
|
||||
|
||||
// 로그인되지 않은 경우 어드민 사용자 가져오기
|
||||
if (!currentUser) {
|
||||
const admin = await prisma.user.findUnique({
|
||||
where: { nickname: "admin" },
|
||||
select: { userId: true, nickname: true, profileImage: true, points: true, level: true, grade: true },
|
||||
});
|
||||
if (admin) currentUser = admin;
|
||||
}
|
||||
// 로그인되지 않은 경우 어드민 사용자로 대체하지 않음 (요청사항)
|
||||
|
||||
// 내가 쓴 게시글/댓글 수
|
||||
let myPostsCount = 0;
|
||||
@@ -219,84 +212,97 @@ export default async function Home({ searchParams }: { searchParams: Promise<{ s
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 xl:flex xl:gap-[23px] gap-4 h-full min-h-0">
|
||||
<div className="hidden xl:grid relative overflow-hidden rounded-xl bg-white px-[25px] py-[34px] grid-rows-[120px_120px_1fr] gap-y-[32px] h-[514px] w-[350px] shrink-0">
|
||||
<div className="absolute inset-x-0 top-0 h-[56px] bg-[#d5d5d5] z-0" />
|
||||
<div className="h-[120px] flex items-center justify-center relative z-10">
|
||||
<div className="flex items-center justify-center gap-[8px]">
|
||||
<UserAvatar
|
||||
src={currentUser?.profileImage || null}
|
||||
alt={currentUser?.nickname || "프로필"}
|
||||
width={120}
|
||||
height={120}
|
||||
className="rounded-full"
|
||||
/>
|
||||
{currentUser && (
|
||||
<div className="w-[62px] h-[62px] flex items-center justify-center">
|
||||
<GradeIcon grade={currentUser.grade} width={62} height={62} />
|
||||
{currentUser ? (
|
||||
<>
|
||||
<div className="h-[120px] flex items-center justify-center relative z-10">
|
||||
<div className="flex items-center justify-center gap-[8px]">
|
||||
<UserAvatar
|
||||
src={currentUser.profileImage || null}
|
||||
alt={currentUser.nickname || "프로필"}
|
||||
width={120}
|
||||
height={120}
|
||||
className="rounded-full"
|
||||
/>
|
||||
<div className="w-[62px] h-[62px] flex items-center justify-center">
|
||||
<GradeIcon grade={currentUser.grade} width={62} height={62} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="h-[120px] flex flex-col items-center relative z-10">
|
||||
<div className="text-[18px] text-[#5c5c5c] font-[700] truncate text-center mb-[20px]">{currentUser.nickname}</div>
|
||||
<div className="w-[300px] pl-[67px] flex flex-col gap-[12px]">
|
||||
<div className="grid grid-cols-[64px_auto] gap-x-[24px] items-center h-[16px]">
|
||||
<div className="w-[64px] flex items-center">
|
||||
<ProfileLabelIcon width={16} height={16} />
|
||||
<span className="ml-[8px] text-[12px] text-[#8c8c8c] font-[700]">레벨</span>
|
||||
</div>
|
||||
<div className="text-[16px] text-[#5c5c5c] font-[700]">Lv. {currentUser.level}</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-[64px_auto] gap-x-[24px] items-center h-[16px]">
|
||||
<div className="w-[64px] flex items-center">
|
||||
<ProfileLabelIcon width={16} height={16} />
|
||||
<span className="ml-[8px] text-[12px] text-[#8c8c8c] font-[700]">등급</span>
|
||||
</div>
|
||||
<div className="text-[16px] text-[#5c5c5c] font-[700]">{getGradeName(currentUser.grade)}</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-[64px_auto] gap-x-[24px] items-center h-[16px]">
|
||||
<div className="w-[64px] flex items-center">
|
||||
<ProfileLabelIcon width={16} height={16} />
|
||||
<span className="ml-[8px] text-[12px] text-[#8c8c8c] font-[700]">포인트</span>
|
||||
</div>
|
||||
<div className="text-[16px] text-[#5c5c5c] font-[700]">{currentUser.points.toLocaleString()}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col gap-[12px] relative z-10">
|
||||
<Link href="/my-page" className="w-[300px] h-[32px] rounded-full bg-[#8c8c8c] hover:bg-[#5c5c5c] text-white text-[12px] font-[700] flex items-center px-[12px]">
|
||||
<span className="flex items-center w-full pl-[88px]">
|
||||
<span className="flex items-center gap-[8px]">
|
||||
<SearchIcon width={16} height={16} />
|
||||
<span>내 정보 페이지</span>
|
||||
</span>
|
||||
</span>
|
||||
</Link>
|
||||
<Link href="/my-page?tab=points" className="w-[300px] h-[32px] rounded-full bg-[#8c8c8c] hover:bg-[#5c5c5c] text-white text-[12px] font-[700] flex items-center px-[12px]">
|
||||
<span className="flex items-center w-full pl-[88px]">
|
||||
<span className="flex items-center gap-[8px]">
|
||||
<SearchIcon width={16} height={16} />
|
||||
<span>포인트 히스토리</span>
|
||||
</span>
|
||||
</span>
|
||||
</Link>
|
||||
<Link href={`/my-page?tab=posts`} className="w-[300px] h-[32px] rounded-full bg-[#8c8c8c] hover:bg-[#5c5c5c] text-white text-[12px] font-[700] flex items-center px-[12px]">
|
||||
<span className="flex items-center w-full pl-[88px]">
|
||||
<span className="flex items-center gap-[8px]">
|
||||
<SearchIcon width={16} height={16} />
|
||||
<span>내가 쓴 게시글</span>
|
||||
</span>
|
||||
<span className="ml-auto inline-flex items-center justify-center h-[20px] px-[8px] rounded-full bg-white text-[#5c5c5c] text-[12px] leading-[20px] shrink-0">{myPostsCount.toLocaleString()}개</span>
|
||||
</span>
|
||||
</Link>
|
||||
<Link href={`/my-page?tab=comments`} className="w-[300px] h-[32px] rounded-full bg-[#8c8c8c] hover:bg-[#5c5c5c] text-white text-[12px] font-[700] flex items-center px-[12px]">
|
||||
<span className="flex items-center w-full pl-[88px]">
|
||||
<span className="flex items-center gap-[8px]">
|
||||
<SearchIcon width={16} height={16} />
|
||||
<span>내가 쓴 댓글</span>
|
||||
</span>
|
||||
<span className="ml-auto inline-flex items-center justify-center h-[20px] px-[8px] rounded-full bg-white text-[#5c5c5c] text-[12px] leading-[20px] shrink-0">{myCommentsCount.toLocaleString()}개</span>
|
||||
</span>
|
||||
</Link>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="flex flex-col items-center justify-center gap-6 relative z-10">
|
||||
<div className="mt-[56px] flex flex-col items-center gap-4">
|
||||
<div className="w-[120px] h-[120px] rounded-full bg-[#e9e9e9] border border-neutral-200" />
|
||||
<div className="text-[18px] text-[#5c5c5c] font-[700]">로그인이 필요합니다</div>
|
||||
<div className="text-[13px] text-neutral-600">내 정보와 등급/포인트를 확인하려면 로그인하세요.</div>
|
||||
</div>
|
||||
<Link href={`/login?next=/`} className="w-[300px] h-[40px] rounded-full bg-[#8c8c8c] hover:bg-[#5c5c5c] text-white text-[14px] font-[700] flex items-center justify-center">
|
||||
로그인 하러 가기
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className="h-[120px] flex flex-col items-center relative z-10">
|
||||
<div className="text-[18px] text-[#5c5c5c] font-[700] truncate text-center mb-[20px]">{currentUser?.nickname || "사용자"}</div>
|
||||
<div className="w-[300px] pl-[67px] flex flex-col gap-[12px]">
|
||||
<div className="grid grid-cols-[64px_auto] gap-x-[24px] items-center h-[16px]">
|
||||
<div className="w-[64px] flex items-center">
|
||||
<ProfileLabelIcon width={16} height={16} />
|
||||
<span className="ml-[8px] text-[12px] text-[#8c8c8c] font-[700]">레벨</span>
|
||||
</div>
|
||||
<div className="text-[16px] text-[#5c5c5c] font-[700]">Lv. {currentUser?.level || 1}</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-[64px_auto] gap-x-[24px] items-center h-[16px]">
|
||||
<div className="w-[64px] flex items-center">
|
||||
<ProfileLabelIcon width={16} height={16} />
|
||||
<span className="ml-[8px] text-[12px] text-[#8c8c8c] font-[700]">등급</span>
|
||||
</div>
|
||||
<div className="text-[16px] text-[#5c5c5c] font-[700]">{getGradeName(currentUser?.grade || 0)}</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-[64px_auto] gap-x-[24px] items-center h-[16px]">
|
||||
<div className="w-[64px] flex items-center">
|
||||
<ProfileLabelIcon width={16} height={16} />
|
||||
<span className="ml-[8px] text-[12px] text-[#8c8c8c] font-[700]">포인트</span>
|
||||
</div>
|
||||
<div className="text-[16px] text-[#5c5c5c] font-[700]">{(currentUser?.points || 0).toLocaleString()}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col gap-[12px] relative z-10">
|
||||
<Link href="/my-page" className="w-[300px] h-[32px] rounded-full bg-[#8c8c8c] hover:bg-[#5c5c5c] text-white text-[12px] font-[700] flex items-center px-[12px]">
|
||||
<span className="flex items-center w-full pl-[88px]">
|
||||
<span className="flex items-center gap-[8px]">
|
||||
<SearchIcon width={16} height={16} />
|
||||
<span>내 정보 페이지</span>
|
||||
</span>
|
||||
</span>
|
||||
</Link>
|
||||
<Link href="/my-page?tab=points" className="w-[300px] h-[32px] rounded-full bg-[#8c8c8c] hover:bg-[#5c5c5c] text-white text-[12px] font-[700] flex items-center px-[12px]">
|
||||
<span className="flex items-center w-full pl-[88px]">
|
||||
<span className="flex items-center gap-[8px]">
|
||||
<SearchIcon width={16} height={16} />
|
||||
<span>포인트 히스토리</span>
|
||||
</span>
|
||||
</span>
|
||||
</Link>
|
||||
<Link href={`/my-page?tab=posts`} className="w-[300px] h-[32px] rounded-full bg-[#8c8c8c] hover:bg-[#5c5c5c] text-white text-[12px] font-[700] flex items-center px-[12px]">
|
||||
<span className="flex items-center w-full pl-[88px]">
|
||||
<span className="flex items-center gap-[8px]">
|
||||
<SearchIcon width={16} height={16} />
|
||||
<span>내가 쓴 게시글</span>
|
||||
</span>
|
||||
<span className="ml-auto inline-flex items-center justify-center h-[20px] px-[8px] rounded-full bg-white text-[#5c5c5c] text-[12px] leading-[20px] shrink-0">{myPostsCount.toLocaleString()}개</span>
|
||||
</span>
|
||||
</Link>
|
||||
<Link href={`/my-page?tab=comments`} className="w-[300px] h-[32px] rounded-full bg-[#8c8c8c] hover:bg-[#5c5c5c] text-white text-[12px] font-[700] flex items-center px-[12px]">
|
||||
<span className="flex items-center w-full pl-[88px]">
|
||||
<span className="flex items-center gap-[8px]">
|
||||
<SearchIcon width={16} height={16} />
|
||||
<span>내가 쓴 댓글</span>
|
||||
</span>
|
||||
<span className="ml-auto inline-flex items-center justify-center h-[20px] px-[8px] rounded-full bg-white text-[#5c5c5c] text-[12px] leading-[20px] shrink-0">{myCommentsCount.toLocaleString()}개</span>
|
||||
</span>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{(await Promise.all(firstTwo.map((b) => prepareBoardPanelData(b)))).map((panelData, idx) => (
|
||||
<div key={firstTwo[idx].id} className="overflow-hidden xl:h-[514px] h-full min-h-0 flex flex-col flex-1">
|
||||
|
||||
Reference in New Issue
Block a user