refactor(community): extract comment store and post/comment API adapters

This commit is contained in:
zetaloop
2026-02-23 11:04:40 +08:00
parent 8e62b15403
commit 77d23d0c9d
9 changed files with 201 additions and 63 deletions
+21
View File
@@ -0,0 +1,21 @@
"use client"
import { MessageCircle } from "lucide-react"
import { useCommentStore } from "@/store/comments"
interface PostCommentCountProps {
postId: string
}
export function PostCommentCount({ postId }: PostCommentCountProps) {
const count = useCommentStore(
(state) => state.comments.filter((comment) => comment.postId === postId).length,
)
return (
<span className="flex items-center gap-1">
<MessageCircle className="h-4 w-4" />
{count}
</span>
)
}