diff --git a/frontend/app/board/[id]/page.tsx b/frontend/app/board/[id]/page.tsx index 7d7f385..16e4005 100644 --- a/frontend/app/board/[id]/page.tsx +++ b/frontend/app/board/[id]/page.tsx @@ -1,9 +1,11 @@ import Link from "next/link"; -import { Metadata } from "next"; +import type { Metadata } from "next"; import { cookies } from "next/headers"; +import { PenSquare, MessagesSquare, ChevronRight } from "lucide-react"; import { fetchPosts, fetchBoards } from "@/lib/api"; import Pagination from "@/components/Pagination"; -import LikeButton from "@/components/LikeButton"; +import PostRow from "@/components/PostRow"; +import PinnedPosts from "@/components/PinnedPosts"; interface PageProps { params: Promise<{ id: string }>; @@ -15,7 +17,7 @@ export async function generateMetadata({ params }: PageProps): Promise const { boards } = await fetchBoards(); const board = boards.find((b) => b.id === Number(id)); return { - title: board ? `${board.name} - 姜十三论坛` : "板块 - 姜十三论坛", + title: board ? `${board.name} · 姜十三论坛` : "板块 · 姜十三论坛", description: board?.description || "板块帖子列表", }; } @@ -29,62 +31,111 @@ export default async function BoardPage({ params, searchParams }: PageProps) { fetchPosts(page, 20, Number(id), "latest", "", cookie), fetchBoards(), ]); - const board = boardsData.boards.find((b) => b.id === Number(id)); + const boardIndex = boardsData.boards.findIndex((b) => b.id === Number(id)); + const board = boardIndex >= 0 ? boardsData.boards[boardIndex] : null; + + // 第一页:置顶帖独立成区,列表只保留非置顶 + const pinned = page === 1 ? postsData.posts.filter((p) => p.pinned > 0) : []; + const rows = page === 1 ? postsData.posts.filter((p) => p.pinned <= 0) : postsData.posts; return (
-