import React, { useState } from 'react'; import { RiMoreLine, RiDeleteBinLine, RiEditLine, RiArrowDownSLine, RiArrowUpSLine } from '@remixicon/react'; import type { InlineCommentDraft } from '@/stores/useInlineCommentDraftStore'; import { useOptionalThemeSystem } from '@/contexts/useThemeSystem'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'; import { useI18n } from '@/lib/i18n'; interface InlineCommentCardProps { draft: InlineCommentDraft; onEdit: () => void; onDelete: () => void; className?: string; maxWidth?: number; } export function InlineCommentCard({ draft, onEdit, onDelete, className, maxWidth, }: InlineCommentCardProps) { const { t } = useI18n(); const themeContext = useOptionalThemeSystem(); const currentTheme = themeContext?.currentTheme; const [isOpen, setIsOpen] = useState(false); const draftText = typeof draft.text === 'string' ? draft.text : ''; // Check if content is long enough to warrant collapsing (rough estimate) // In a real app we might measure line height, but length check is a good proxy for now const isLongContent = draftText.length > 150 || draftText.split('\n').length > 3; return (
{draft.fileLabel} {t('inlineComment.range.lines', { start: draft.startLine, end: draft.endLine })} {draft.side && ({draft.side})}
{draftText}
{isLongContent && ( )} {/* Used for animation purposes if we want to animate height */}
{t('inlineComment.actions.editComment')} {t('inlineComment.actions.deleteComment')}
); }