import { useEffect, useMemo, useRef, useState } from 'react' import { getRoomFileUrl, getRoomImageUrl } from '../api/rooms' import { useAuth } from '../context/AuthContext' import { formatFileSize } from '../lib/fileSize' import { avatarUrlFor, displayNameFor, senderColorIndex, statusFor } from '../lib/messageGrouping' import type { ChatMessageEnvelope, Message, MessageFileInfo, RoomMember } from '../types' import { EMOJI_PICKER_MAX_HEIGHT, EmojiPicker } from './EmojiPicker' import { FilePreviewModal, getPreviewKind } from './FilePreviewModal' import { ImageLightbox } from './ImageLightbox' import { LinkPreviewCard } from './LinkPreviewCard' import { EmojiGlyph, MessageContent } from './MessageContent' import { UserAvatar } from './UserAvatar' import { VideoLightbox } from './VideoLightbox' import './MessageList.css' export function FileAttachmentIcon() { return ( ) } interface FileAttachmentCardProps { file: MessageFileInfo roomId: string onPreview: () => void } // Previewable files (markdown/text) open a modal on click, with a small // explicit download icon alongside; everything else keeps the original // click-to-download behavior unchanged. function FileAttachmentCard({ file, roomId, onPreview }: FileAttachmentCardProps) { const info = ( {file.filename} {formatFileSize(file.size_bytes)} ) if (getPreviewKind(file.filename)) { return ( ) } return ( {info} ) } // #65: kept in sync with backend/app/storage.py's INLINE_SAFE_VIDEO_ // CONTENT_TYPES -- the server only ever serves these particular content // types without a forced download, so a