'use client';

import Comments from '@/components/comment/Comments';
import Modal from '@/components/modal/Modal';

interface HookCommentsModalProps {
  hookId: string;
  numComments: number;
  onClose: () => void;
  deeplinkedCommentId?: string;
  isUserContentOwner?: boolean;
  allowComments?: boolean;
}

const HookCommentsModal: React.FC<HookCommentsModalProps> = ({
  hookId,
  numComments,
  onClose,
  deeplinkedCommentId,
  isUserContentOwner = false,
  allowComments = true,
}) => {
  return (
    <Modal
      title='Comments'
      onClose={onClose}
      width={600}
      disablePadding
      titleClassName='text-2xl pl-4'
      className='px-2 xl:px-0'
      wrapperClasses='overflow-y-auto min-h-[50vh] max-h-[75vh]'
    >
      <Comments
        entityId={hookId}
        entityType='hook'
        numComments={numComments}
        allowComments={allowComments}
        disablePortal={true}
        className='relative min-h-0 flex-1'
        bodyClassName='flex-1 overflow-y-auto pb-4'
        style={
          {
            '--comment-input-bg': 'var(--color-background-tertiary)',
          } as React.CSSProperties
        }
        deeplinkedCommentId={deeplinkedCommentId}
        isUserContentOwner={isUserContentOwner}
      />
    </Modal>
  );
};

export default HookCommentsModal;
