import { Attachment, AttachmentType } from "@/app/providers/ProtocolProvider/protocol/packets/packet.message"; import { DeliveredMessageState } from "@/app/providers/DialogProvider/DialogProvider"; import { Flex } from "@mantine/core"; import { MessageImage } from "./MessageImage"; import { MessageReplyMessages } from "./MessageReplyMessages"; import { MessageFile } from "./MessageFile"; import { ErrorBoundaryProvider } from "@/app/providers/ErrorBoundaryProvider/ErrorBoundaryProvider"; import { AttachmentError } from "../AttachmentError/AttachmentError"; import { MessageAvatar } from "./MessageAvatar"; import { MessageProps } from "../Messages/Message"; export interface MessageAttachmentsProps { attachments: Attachment[]; delivered: DeliveredMessageState; timestamp: number; text: string; chacha_key_plain: string; parent: MessageProps; } export interface AttachmentProps { attachment: Attachment; attachments: Attachment[]; delivered: DeliveredMessageState; timestamp: number; text: string; chacha_key_plain: string; parent: MessageProps; } export function MessageAttachments(props: MessageAttachmentsProps) { return ( }> {props.attachments.map((att, index) => { const attachProps : AttachmentProps = { chacha_key_plain: props.chacha_key_plain, attachment: att, attachments: props.attachments, delivered: props.delivered, timestamp: props.timestamp, text: props.text, parent: props.parent, } switch (att.type) { case AttachmentType.MESSAGES: return case AttachmentType.IMAGE: return case AttachmentType.FILE: return case AttachmentType.AVATAR: return default: return ; } })} ); }