import Comment from "./Comment";

function Comments({ user, loading }) {
  const comments = user?.comments ?? [];

  if (comments.length === 0) {
    return (
      <p className="text-[#7E7E7E] opacity-page text-[14px] md:text-[16px] font-medium text-center py-[56px]">
        نظری ثبت نکرده‌اید.
      </p>
    );
  }

  return (
    <ul className="flex opacity-page flex-col items-start justify-start gap-[24px] md:gap-[22px] lg:gap-[20px]">
      {comments.map((item, idx) => (
        <Comment
          key={idx}
          idx={idx}
          data={item}
          loading={loading}
          length={comments.length}
        />
      ))}
    </ul>
  );
}

export default Comments;
