diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx index 89e7bc9..232f0a3 100644 --- a/frontend/app/page.tsx +++ b/frontend/app/page.tsx @@ -5,7 +5,6 @@ import { PenSquare, SearchX, MessagesSquare, Check, ArrowRight } from "lucide-re import { fetchPosts, fetchBoards } from "@/lib/api"; import Pagination from "@/components/Pagination"; import PostRow from "@/components/PostRow"; -import FeaturePost from "@/components/FeaturePost"; import PinnedPosts from "@/components/PinnedPosts"; export const metadata: Metadata = { @@ -27,12 +26,10 @@ export default async function HomePage({ searchParams }: HomePageProps) { fetchBoards(), ]); - // 第一页且非搜索时拆分为三段:管理员置顶 → 今日精选(首条非置顶)→ 普通列表 + // 第一页且非搜索时:管理员置顶独立成区,其余进入普通列表 const split = page === 1 && !keyword; const pinned = split ? postsData.posts.filter((p) => p.pinned > 0) : []; - const normal = split ? postsData.posts.filter((p) => p.pinned <= 0) : postsData.posts; - const feature = split && normal.length > 0 ? normal[0] : null; - const rows = feature ? normal.slice(1) : normal; + const rows = split ? postsData.posts.filter((p) => p.pinned <= 0) : postsData.posts; return (
@@ -63,11 +60,6 @@ export default async function HomePage({ searchParams }: HomePageProps) { {/* 主列 */}
- {feature && ( -
- -
- )}
{rows.length > 0 ? ( diff --git a/frontend/components/FeaturePost.tsx b/frontend/components/FeaturePost.tsx deleted file mode 100644 index e3a4c70..0000000 --- a/frontend/components/FeaturePost.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import Link from "next/link"; -import type { PostListItem } from "@/lib/api"; -import LikeButton from "./LikeButton"; -import Avatar from "./Avatar"; -import { IconComment, IconEye } from "./Icons"; - -function formatTime(dateStr: string) { - return new Date(dateStr).toLocaleDateString("zh-CN"); -} - -/** - * 首页精选主卡:取自非置顶帖中的最新一帖(置顶帖由 PinnedPosts 承载) - */ -export default function FeaturePost({ post }: { post: PostListItem }) { - return ( -
- {/* 柔和装饰块,非发光 */} - -
-
- - - 今日精选 - - {post.recommended && 推荐} - - {post.board.name} - -
- - -

- {post.title} -

- - {post.tags && ( -
- {[ - ...new Set( - post.tags - .split(",") - .map((t) => t.trim()) - .filter(Boolean) - ), - ] - .slice(0, 4) - .map((t, i) => ( - - # {t} - - ))} -
- )} - -
-
- - - - - {post.user.nickname} - - {formatTime(post.created_at)} - - - - {post.comment_count} - - - {post.view_count} - -
- -
-
-
- ); -} diff --git a/frontend/components/PinnedPosts.tsx b/frontend/components/PinnedPosts.tsx index a620730..1f996a3 100644 --- a/frontend/components/PinnedPosts.tsx +++ b/frontend/components/PinnedPosts.tsx @@ -12,7 +12,7 @@ function formatTime(dateStr: string) { } /** - * 管理员置顶区:独立于"今日精选"和普通列表。 + * 管理员置顶区:独立于普通帖子列表。 * 陶土色语义(与 badge-pin 一致),紧凑排列,一眼识别为公告性质内容。 */ export default function PinnedPosts({