'use client'; import { memo } from 'react'; import { Trash2 } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; import { useObjectUrls } from '@/components/video-page/hooks/use-object-urls'; import type { CommentImage } from '@/components/video-page/types'; interface ImageAttachmentStripProps { /** Images already saved on the comment being edited, if any. */ existingUrls?: string[]; onRemoveExisting?: (url: string) => void; /** Files staged in this editor and not uploaded yet. */ files: File[]; onRemoveFile: (index: number) => void; compact?: boolean; className?: string; } /** * The row of thumbnails under an editor, showing what will be sent with it. * Saved images come first, then the ones staged in this session. */ export const ImageAttachmentStrip = memo(function ImageAttachmentStrip({ existingUrls = [], onRemoveExisting, files, onRemoveFile, compact = false, className, }: ImageAttachmentStripProps) { const previewUrls = useObjectUrls(files); if (existingUrls.length === 0 && previewUrls.length === 0) return null; const tileSize = compact ? 'h-14 w-14' : 'h-20 w-20'; const buttonSize = compact ? 'h-5 w-5' : 'h-6 w-6'; const iconSize = compact ? 'h-2.5 w-2.5' : 'h-3 w-3'; const tile = (key: string, src: string, alt: string, onRemove: () => void) => (