22 lines
492 B
TypeScript
22 lines
492 B
TypeScript
"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>
|
|
)
|
|
}
|