"use client";

import React from "react";
import Modal from "@/components/elements/Modal";
import CourseCommentsContent from "./CourseCommentsContent";
import { Course } from "@/types/types";

interface CommentsModalProps {
  isOpen: boolean;
  onClose: () => void;
  postData: Course;
  onCommentAdded?: () => void;
}

function CommentsModal({
  isOpen,
  onClose,
  postData,
  onCommentAdded,
}: CommentsModalProps) {
  return (
    <Modal isOpen={isOpen} onClose={onClose} height="min(82vh, 520px)">
      <CourseCommentsContent
        courseId={postData._id}
        courseName={postData.cuorse_name}
        variant="modal"
        onClose={onClose}
        onCommentAdded={onCommentAdded}
        className="h-full"
      />
    </Modal>
  );
}

export default CommentsModal;

export type { CourseComment as Comments } from "./CourseCommentsContent";
