import { useState } from 'react'; import { MessageSquare, Pencil, Trash2 } from 'lucide-react'; import type { DiffComment } from '@/stores/useDiffCommentStore'; import { InlineReviewEditor } from './InlineReviewEditor'; interface InlineReviewThreadProps { comments: DiffComment[]; onEditComment: (id: string, body: string) => void; onDeleteComment: (id: string) => void; } export function InlineReviewThread({ comments, onEditComment, onDeleteComment, }: InlineReviewThreadProps) { const [expanded, setExpanded] = useState(true); const [editingId, setEditingId] = useState(null); const [editBody, setEditBody] = useState(''); if (comments.length === 0) return null; const handleStartEdit = (id: string, body: string) => { setEditingId(id); setEditBody(body); }; const handleSaveEdit = (body: string) => { if (editingId) { onEditComment(editingId, body); setEditingId(null); } }; const handleCancelEdit = () => { setEditingId(null); }; return (
{expanded && (
{comments.map((comment) => (
{editingId === comment.id ? ( ) : (
{comment.body}
)}
))}
)}
); }