'use client'; import { useState } from 'react'; import { formatDate } from "@/lib/utils"; import parse from 'html-react-parser'; import CommentReply from "@/components/shared/CommentReply"; import Form from "../product/detail/comments/Form"; export default function CommentItem({ item }: any) { const [activeFormId, setActiveFormId] = useState(null); const handleReply = () => { setActiveFormId(prev => prev === item.id ? null : item.id ); }; console.log('aaaaaaaaaa', item) return ( <> { item.is_user_admin == 1 || item.approved == 1 &&
{ item.is_user_admin == 1 ? parse(``) : parse(` ${item.user_name.substring(0,1)} `) }
{item.user_name.split(' -')[0]} {formatDate(item.post_time)}
{item.content}
{activeFormId === item.id && (
)} { item.new_replies.length > 0 &&
{ item.new_replies.map( (reply:any) => ) }
}
} ) }