"use client"; import { MessageSquarePlus } from "lucide-react"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { CommentComposer } from "../comment-composer/comment-composer"; import { CommentThread } from "../comment-thread/comment-thread"; import type { CommentPanelProps } from "./types"; export function CommentPanel({ threads, members, membersLoading = false, isLoading = false, onCreateComment, onCreateReply, onEditComment, onDeleteComment, isSubmitting = false, maxHeight = 400, }: CommentPanelProps) { const [isComposerOpen, setIsComposerOpen] = useState(false); const handleCommentSubmit = (content: string) => { onCreateComment(content); setIsComposerOpen(false); }; const handleComposerCancel = () => { setIsComposerOpen(false); }; if (isLoading) { return (
Loading comments...
); } const hasThreads = threads.length > 0; const showEmptyState = !hasThreads && !isComposerOpen; return (
{hasThreads && (
{threads.map((thread) => ( ))}
)} {showEmptyState && (

No comments yet

Start a conversation about this response

)}
{isComposerOpen ? ( ) : ( )}
); }