refactor(frontend): remove featured post component and simplify home page logic

移除了不再使用的FeaturePost组件,同时调整首页帖子展示逻辑:不再单独拆分今日精选帖,将所有非置顶帖子统一纳入普通列表展示,更新了置顶区的注释说明。
This commit is contained in:
2026-09-12 05:05:58 +08:00
parent 1bb565c687
commit 995e0b2c1f
3 changed files with 3 additions and 106 deletions

View File

@@ -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 (
<div>
@@ -63,11 +60,6 @@ export default async function HomePage({ searchParams }: HomePageProps) {
{/* 主列 */}
<div>
<PinnedPosts posts={pinned} />
{feature && (
<div className="mb-6">
<FeaturePost post={feature} />
</div>
)}
<div className="panel overflow-hidden">
{rows.length > 0 ? (