From 12044587c952a7a2cc609213596d3252f37ea6ba Mon Sep 17 00:00:00 2001 From: koreacomp5 Date: Wed, 5 Nov 2025 21:07:49 +0900 Subject: [PATCH 1/5] homework1 --- src/app/components/BoardPanelClient.tsx | 45 ++++++++++++++++++------- src/app/components/HeroBanner.tsx | 4 +-- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/app/components/BoardPanelClient.tsx b/src/app/components/BoardPanelClient.tsx index d9cb16d..f338646 100644 --- a/src/app/components/BoardPanelClient.tsx +++ b/src/app/components/BoardPanelClient.tsx @@ -56,6 +56,13 @@ export function BoardPanelClient({ const selectedBoardData = boardsData.find(bd => bd.board.id === selectedBoardId) || boardsData[0]; const { board, categoryName, siblingBoards } = selectedBoardData; + const isNewWithin1Hour = (createdAt: Date | string | number | null | undefined): boolean => { + if (!createdAt) return false; + const t = new Date(createdAt).getTime(); + if (Number.isNaN(t)) return false; + return (Date.now() - t) <= 60 * 60 * 1000; + }; + function formatDateYmd(d: Date) { const date = new Date(d); const yyyy = date.getFullYear(); @@ -103,7 +110,7 @@ export function BoardPanelClient({ key={sb.id} onClick={() => setSelectedBoardId(sb.id)} className={`px-[16px] py-[8px] rounded-[14px] text-[14px] shrink-0 cursor-pointer ${ - sb.id === selectedBoardId ? "bg-[#5c5c5c] text-white border border-[#5c5c5c]" : "bg-white text-[#5c5c5c] border border-[#d5d5d5]" + sb.id === selectedBoardId ? "bg-[#5c5c5c] text-white border border-[#5c5c5c]" : "bg-white text-[#5c5c5c] border border-[#d5d5d5] hover:bg-[#5c5c5c] hover:text-white hover:border-[#5c5c5c] transition-colors" }`} > {sb.name} @@ -178,8 +185,8 @@ export function BoardPanelClient({ @@ -128,45 +127,49 @@ export function BoardPanelClient({
-
-
+
+
{selectedBoardData.specialRankUsers.map((user, idx) => { const rank = idx + 1; return ( - -
- +
+ -
- +
+
-
-
-
-
- {rank === 1 && } - {rank === 2 && } - {rank === 3 && } -
-
+
+
+
+ { + (rank === 1 || rank === 2 || rank === 3) && ( +
+ {rank === 1 && } + {rank === 2 && } + {rank === 3 && } +
+ ) + } +
{rank}위
-
+
{user.nickname || "익명"}
-
- - +
+ + - {user.points.toLocaleString()} + {user.points.toLocaleString()}
@@ -189,10 +192,10 @@ export function BoardPanelClient({
{categoryName || board.name}
- + - +
@@ -201,9 +204,8 @@ export function BoardPanelClient({ @@ -212,14 +214,14 @@ export function BoardPanelClient({
-
-
+
+
{selectedBoardData.previewPosts.map((post) => { // attachments에서 이미지를 먼저 찾고, 없으면 content에서 추출 const firstImage = post.attachments?.[0]?.url || extractImageFromContent(post.content); return ( - -
+ +
{firstImage ? ( )}
-
-
-
+
+
+
{board.name}
-
- {isNewWithin1Hour(post.createdAt) && ( - <> - - - -
n
- - )} -
- {stripHtml(post.title)} + {isNewWithin1Hour(post.createdAt) && ( +
+ + + +
n
+
+ )} + {stripHtml(post.title)} {(post.stat?.commentsCount ?? 0) > 0 && ( - [{post.stat?.commentsCount}] + [{post.stat?.commentsCount}] )}
- + {formatDateYmd(post.createdAt)}
@@ -280,11 +280,11 @@ export function BoardPanelClient({ {/* 기본 아이콘 */} - + {/* 호버 아이콘 */} - +
@@ -293,9 +293,8 @@ export function BoardPanelClient({ @@ -314,19 +313,17 @@ export function BoardPanelClient({
    {selectedBoardData.textPosts.map((p) => ( -
  • +
  • -
    - {isNewWithin1Hour(p.createdAt) && ( - <> - - - -
    n
    - - )} -
    + {isNewWithin1Hour(p.createdAt) && ( +
    + + + +
    n
    +
    + )} {stripHtml(p.title)} {(p.stat?.commentsCount ?? 0) > 0 && ( [{p.stat?.commentsCount}] diff --git a/src/app/page.tsx b/src/app/page.tsx index 4d28042..2b045cc 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -146,7 +146,7 @@ export default async function Home({ searchParams }: { searchParams: Promise<{ s select: { userId: true, nickname: true, points: true, profileImage: true, grade: true }, where: { status: "active" }, orderBy: { points: "desc" }, - take: 3, + take: 6, }); } else if (isPreview) { previewPosts = await prisma.post.findMany({ @@ -165,7 +165,7 @@ export default async function Home({ searchParams }: { searchParams: Promise<{ s stat: { select: { commentsCount: true } }, }, orderBy: { createdAt: "desc" }, - take: 3, + take: 6, }); } else if (isTextMain) { textPosts = await prisma.post.findMany({ diff --git a/src/app/posts/new/page.tsx b/src/app/posts/new/page.tsx index d5e2a85..a783395 100644 --- a/src/app/posts/new/page.tsx +++ b/src/app/posts/new/page.tsx @@ -82,7 +82,7 @@ export default function NewPostPage() { className="h-16 rounded-2xl border border-neutral-300 px-6 text-base text-neutral-900 bg-white hover:bg-neutral-50" onClick={() => {/* 태그 선택 자리표시 */}} > - 테그선택 + 태그선택
    From 808fe5fc681b28fab69ce28a38a6225124942899 Mon Sep 17 00:00:00 2001 From: koreacomp5 Date: Wed, 5 Nov 2025 23:03:53 +0900 Subject: [PATCH 5/5] header --- src/app/components/AppHeader.tsx | 15 ++++++++------- src/app/components/HeroBanner.tsx | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/app/components/AppHeader.tsx b/src/app/components/AppHeader.tsx index 9fd1f5f..fea93c4 100644 --- a/src/app/components/AppHeader.tsx +++ b/src/app/components/AppHeader.tsx @@ -377,7 +377,7 @@ export function AppHeader() { if (!e.currentTarget.contains(next)) setMegaOpen(false); }} > -
    +
    {categories.map((cat, idx) => (
    {/*
    {cat.name}
    */} -
    +
    {cat.boards.map((b) => ( {b.name} diff --git a/src/app/components/HeroBanner.tsx b/src/app/components/HeroBanner.tsx index 94a871b..5481bd3 100644 --- a/src/app/components/HeroBanner.tsx +++ b/src/app/components/HeroBanner.tsx @@ -130,6 +130,32 @@ export function HeroBanner({ subItems, activeSubId, hideSubOnMobile }: { subItem ))}
    + {/* 좌우 내비게이션 버튼 */} + {numSlides > 1 && ( +
    + + +
    + )} + {/* Pagination - Figma 스타일: 활성은 주황 바, 비활성은 회색 점 (배너 위에 오버랩) */} {numSlides > 1 && (