@@ -16,6 +16,7 @@ import { GradeIcon, getGradeName } from "@/app/components/GradeIcon";
|
||||
import prisma from "@/lib/prisma";
|
||||
import { headers } from "next/headers";
|
||||
import { InlineLoginForm } from "@/app/components/InlineLoginForm";
|
||||
import UnreadMessagesModal from "@/app/components/UnreadMessagesModal";
|
||||
|
||||
export default async function Home({ searchParams }: { searchParams: Promise<{ sort?: "recent" | "popular" } | undefined> }) {
|
||||
const sp = await searchParams;
|
||||
@@ -56,9 +57,13 @@ export default async function Home({ searchParams }: { searchParams: Promise<{ s
|
||||
// 내가 쓴 게시글/댓글 수
|
||||
let myPostsCount = 0;
|
||||
let myCommentsCount = 0;
|
||||
let unreadMessagesCount = 0;
|
||||
if (currentUser) {
|
||||
myPostsCount = await prisma.post.count({ where: { authorId: currentUser.userId, status: "published" } });
|
||||
myCommentsCount = await prisma.comment.count({ where: { authorId: currentUser.userId } });
|
||||
unreadMessagesCount = await prisma.message.count({
|
||||
where: { receiverId: currentUser.userId, readAt: null },
|
||||
});
|
||||
}
|
||||
|
||||
// 메인페이지 설정 불러오기
|
||||
@@ -193,6 +198,9 @@ export default async function Home({ searchParams }: { searchParams: Promise<{ s
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
{currentUser && unreadMessagesCount > 0 && (
|
||||
<UnreadMessagesModal count={unreadMessagesCount} />
|
||||
)}
|
||||
{/* 히어로 섹션: 상단 대형 비주얼 영역 (설정 온오프) */}
|
||||
{showBanner && (
|
||||
<section>
|
||||
@@ -264,12 +272,13 @@ export default async function Home({ searchParams }: { searchParams: Promise<{ s
|
||||
</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]">
|
||||
<Link href={`/my-page?tab=messages-received`} 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>
|
||||
</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">{unreadMessagesCount.toLocaleString()}개</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]">
|
||||
|
||||
Reference in New Issue
Block a user