From e132ffcefb01666a0446469ec7bc19da8c74a8a3 Mon Sep 17 00:00:00 2001 From: zetaloop Date: Fri, 20 Feb 2026 15:22:30 +0800 Subject: [PATCH] feat: community feed, post detail, and new post pages --- app/(main)/community/page.tsx | 84 +++++++++++++++- app/(main)/post/[id]/page.tsx | 161 ++++++++++++++++++++++++++++++- app/(main)/post/new/page.tsx | 177 +++++++++++++++++++++++++++++++++- 3 files changed, 412 insertions(+), 10 deletions(-) diff --git a/app/(main)/community/page.tsx b/app/(main)/community/page.tsx index e4a01ef..750dca6 100644 --- a/app/(main)/community/page.tsx +++ b/app/(main)/community/page.tsx @@ -1,8 +1,86 @@ +import { Heart, MessageCircle, PenSquare, Pin } from "lucide-react" +import Link from "next/link" +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" +import { Badge } from "@/components/ui/badge" +import { Button } from "@/components/ui/button" +import { Card, CardContent, CardFooter, CardHeader } from "@/components/ui/card" +import { mockPosts } from "@/lib/mock-data" + +const roleLabels: Record = { + consumer: "玩家", + player: "打手", + owner: "店主", +} + export default function CommunityPage() { return ( -
-

社区

-

浏览帖子、秀单、讨论

+
+
+

社区

+ +
+ +
+ {mockPosts.map((post) => ( + + + +
+ + + {post.author.nickname[0]} + +
+
+ {post.author.nickname} + + {roleLabels[post.authorRole]} + + {post.pinned && } +
+ + {new Date(post.createdAt).toLocaleDateString("zh-CN")} + +
+
+
+ +

{post.title}

+

{post.content}

+ {post.tags.length > 0 && ( +
+ {post.tags.map((tag) => ( + + {tag} + + ))} +
+ )} + {post.linkedOrderId && ( +
+ 📋 关联订单秀单 +
+ )} +
+ + + + {post.likeCount} + + + + {post.commentCount} + + +
+ + ))} +
) } diff --git a/app/(main)/post/[id]/page.tsx b/app/(main)/post/[id]/page.tsx index 603240e..2fd3f67 100644 --- a/app/(main)/post/[id]/page.tsx +++ b/app/(main)/post/[id]/page.tsx @@ -1,8 +1,161 @@ -export default function PostDetailPage({ params: _params }: { params: Promise<{ id: string }> }) { +import { ArrowLeft, Heart, MessageCircle, Pin, Star } from "lucide-react" +import Link from "next/link" +import { notFound } from "next/navigation" +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" +import { Badge } from "@/components/ui/badge" +import { Button } from "@/components/ui/button" +import { Card, CardContent, CardHeader } from "@/components/ui/card" +import { Separator } from "@/components/ui/separator" +import { Textarea } from "@/components/ui/textarea" +import { mockComments, mockOrders, mockPosts } from "@/lib/mock-data" + +const roleLabels: Record = { + consumer: "玩家", + player: "打手", + owner: "店主", +} + +export default async function PostDetailPage({ params }: { params: Promise<{ id: string }> }) { + const { id } = await params + const post = mockPosts.find((p) => p.id === id) + if (!post) notFound() + + const comments = mockComments.filter((c) => c.postId === id) + const linkedOrder = post.linkedOrderId + ? mockOrders.find((o) => o.id === post.linkedOrderId) + : null + return ( -
-

帖子详情

-

帖子内容、评论区

+
+ + + 返回社区 + + + + +
+ + + {post.author.nickname[0]} + +
+
+ {post.author.nickname} + + {roleLabels[post.authorRole]} + + {post.pinned && } +
+ + {new Date(post.createdAt).toLocaleString("zh-CN")} + +
+
+
+ +

{post.title}

+

{post.content}

+ + {post.images.length > 0 && ( +
+ {post.images.map((img) => ( +
+ 图片 +
+ ))} +
+ )} + + {linkedOrder && ( + +
+
+ + 关联订单 +
+

+ {linkedOrder.service.title} · {linkedOrder.playerName} · ¥{linkedOrder.totalPrice} +

+
+ + )} + + {post.tags.length > 0 && ( +
+ {post.tags.map((tag) => ( + + {tag} + + ))} +
+ )} + +
+ + + + {post.commentCount} + +
+
+
+ + + +
+

评论 ({comments.length})

+ +
+