컴잇
Some checks failed
deploy-on-main / deploy (push) Failing after 23s

This commit is contained in:
koreacomp5
2025-11-10 01:39:44 +09:00
parent 4337a8f69a
commit b579b32138
25 changed files with 361 additions and 70 deletions

View File

@@ -3,9 +3,12 @@ import { headers } from "next/headers";
import { HeroBanner } from "@/app/components/HeroBanner";
import { RelatedPosts } from "./RelatedPosts";
import prisma from "@/lib/prisma";
import Link from "next/link";
import { CommentSection } from "@/app/components/CommentSection";
import { UserNameMenu } from "@/app/components/UserNameMenu";
import { ViewTracker } from "./ViewTracker";
import ViewsIcon from "@/app/svgs/ViewsIcon";
import LikeIcon from "@/app/svgs/LikeIcon";
// 서버 전용 페이지: params가 Promise일 수 있어 안전 언랩 후 절대 URL로 fetch합니다.
export default async function PostDetail({ params }: { params: any }) {
@@ -53,6 +56,8 @@ export default async function PostDetail({ params }: { params: any }) {
}
}
const backHref = post?.board?.slug ? `/boards/${post.board.slug}` : "/";
return (
<div className="space-y-6">
<ViewTracker postId={id} />
@@ -67,6 +72,16 @@ export default async function PostDetail({ params }: { params: any }) {
</section>
)}
{/* 목록으로 버튼 */}
<div className="px-1">
<Link
href={backHref}
className="inline-flex items-center gap-1 h-9 px-3 rounded-md border border-neutral-300 bg-white text-sm text-neutral-900 hover:bg-neutral-100"
>
</Link>
</div>
{/* 본문 카드 */}
<section className="rounded-xl overflow-hidden bg-white">
<header className="px-4 py-3 border-b border-neutral-200">
@@ -82,6 +97,20 @@ export default async function PostDetail({ params }: { params: any }) {
</span>
{createdAt && <span aria-hidden></span>}
{createdAt && <span>{createdAt.toLocaleString()}</span>}
{/* 지표: 조회수 / 좋아요수 / 댓글수 */}
{(() => {
const views = post?.stat?.views ?? 0;
const likes = post?.stat?.recommendCount ?? 0;
const comments = post?.stat?.commentsCount ?? 0;
return (
<>
<span aria-hidden></span>
<span className="inline-flex items-center gap-1"><ViewsIcon width={14} height={14} />{views}</span>
<span className="inline-flex items-center gap-1"><LikeIcon width={14} height={14} />{likes}</span>
<span className="inline-flex items-center gap-1"> {comments}</span>
</>
);
})()}
</div>
</header>
<div className="p-4 md:p-6">