import type { MessageQuoteAttachment } from '@rocket.chat/core-typings'; import { css } from '@rocket.chat/css-in-js'; import { Palette } from '@rocket.chat/fuselage'; import { useUserPreference } from '@rocket.chat/ui-contexts'; import { useTimeAgo } from '../../../../hooks/useTimeAgo'; import MessageContentBody from '../../MessageContentBody'; import Attachments from '../Attachments'; import type { AudioAttachmentSource } from './file/AudioAttachment'; import AttachmentAuthor from './structure/AttachmentAuthor'; import AttachmentAuthorAvatar from './structure/AttachmentAuthorAvatar'; import AttachmentAuthorName from './structure/AttachmentAuthorName'; import AttachmentAuthorTimestamp from './structure/AttachmentAuthorTimestamp'; import AttachmentContent from './structure/AttachmentContent'; import AttachmentDetails from './structure/AttachmentDetails'; import AttachmentInner from './structure/AttachmentInner'; import AttachmentMessageLink from './structure/AttachmentMessageLink'; import { toPlainTextRoot } from '../../../../lib/toPlainTextRoot'; // TODO: remove this team collaboration const quoteStyles = css` .rcx-attachment__details { .rcx-message-body { color: ${Palette.text['font-default']}; } } &:hover, &:focus { .rcx-attachment__details { background: ${Palette.surface['surface-hover']}; border-color: ${Palette.stroke['stroke-light']}; border-inline-start-color: ${Palette.stroke['stroke-medium']}; } } `; export type QuoteAttachmentProps = { attachment: MessageQuoteAttachment; source?: AudioAttachmentSource; /** This quote's own path, used to prefix its nested attachments' collapse-state keys. */ path?: string; }; export const QuoteAttachment = ({ attachment, source, path }: QuoteAttachmentProps) => { const formatTime = useTimeAgo(); const displayAvatarPreference = useUserPreference('displayAvatars'); return ( <> {displayAvatarPreference && } {attachment.author_name} {attachment.ts && ( {formatTime(attachment.ts)} )} {attachment.message_link && } {attachment.attachments && ( )} ); };