import { unixToDate } from "#/api/utils"; import { useEffect, useState } from "react"; import { ENDPOINTS } from "#/api/config"; export const CommentsComment = (props: { profile: { login: string; avatar: string; id: number }; comment: { id: number; timestamp: number; message: string; likes: number; reply_count: number; }; isSubComment?: boolean; }) => { const [replies, setReplies] = useState([]); useEffect(() => { async function _fetchReplies() { await fetch( `${ENDPOINTS.release.info}/comment/replies/${props.comment.id}/0?sort=2` ) .then((res) => res.json()) .then((data) => { setReplies(data.content); }); } if (!props.isSubComment && props.comment.reply_count > 0) { _fetchReplies(); } }, []); return (

{props.comment.message}

{replies.length > 0 && replies.map((comment: any) => ( ))}
); };