import React, { useState } from 'react'; import type { Attachment } from '@backspace/shared'; import { useUIStore } from '../../stores/uiStore'; import { useTransferStore } from '../../stores/transferStore'; import { Tooltip } from '../ui/Tooltip'; interface AttachmentRendererProps { attachment: Attachment; } function formatFileSize(bytes: number): string { if (bytes < 1024) return `${bytes} B`; if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)} KB`; return `${(bytes / 1048576).toFixed(1)} MB`; } /** Format a duration in seconds as `m:ss` (or `h:mm:ss` for long clips). */ function formatDuration(seconds: number): string { const total = Math.round(seconds); const h = Math.floor(total / 3600); const m = Math.floor((total % 3600) / 60); const s = total % 60; if (h > 0) return `${h}:${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`; return `${m}:${s.toString().padStart(2, '0')}`; } /** * Whether *this* browser can decode HEVC (H.265) in a