Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import React, { ComponentProps, FC } from 'react';

const Attachment: FC<ComponentProps<typeof Box>> = (props) => {
const { width } = useAttachmentDimensions();
return (
<Box rcx-message-attachment mb='x4' maxWidth={width} width='full' display='flex' overflow='hidden' flexDirection='column' {...props} />
);
return <Box rcx-message-attachment maxWidth={width} width='full' display='flex' overflow='hidden' flexDirection='column' {...props} />;
};

export default Attachment;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Box } from '@rocket.chat/fuselage';
import React, { FC, ComponentProps } from 'react';

const Row: FC<ComponentProps<typeof Box>> = (props) => (
<Box mi='neg-x2' mbe='x2' rcx-message-attachment display='flex' alignItems='center' {...props} />
<Box mi='neg-x2' mb='x2' rcx-message-attachment display='flex' alignItems='center' {...props} />
);

export default Row;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const AudioAttachment: FC<AudioAttachmentProps> = ({
const getURL = useMediaUrl();
return (
<Attachment>
<MarkdownText parseEmoji variant='inline' content={description} />
<MarkdownText mbs='x2' mbe='x4' parseEmoji variant='inline' content={description} />
<Attachment.Row>
<Attachment.Title>{title}</Attachment.Title>
{size && <Attachment.Size size={size} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,12 @@ export const GenericFileAttachment: FC<GenericFileAttachmentProps> = ({
const getURL = useMediaUrl();
return (
<Attachment>
{description && <MarkdownText parseEmoji content={description} />}
{description && <MarkdownText mb='x2' variant='inline' parseEmoji content={description} />}
<Attachment.Row>
{hasDownload && link ? <Attachment.TitleLink link={getURL(link)} title={title} /> : <Attachment.Title>{title}</Attachment.Title>}
{size && <Attachment.Size size={size} />}
{/* {collapse} */}
{hasDownload && link && <Attachment.Download title={title} href={getURL(link)} />}
</Attachment.Row>
{/* { !collapsed && <Attachment.Content>
<Attachment.Details>
{hasDownload && link && <Attachment.Download href={link}/>}
<Attachment.Row><Attachment.Title { ...hasDownload && link && { is: 'a', href: link } } >{name}</Attachment.Title></Attachment.Row>
<Attachment.Row>{size && <Attachment.Size size={size}/>}<Attachment.Title>{format && size && ' | '}{format}</Attachment.Title></Attachment.Row>
</Attachment.Details>
</Attachment.Content> } */}
</Attachment>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const ImageAttachment: FC<ImageAttachmentProps> = ({
const getURL = useMediaUrl();
return (
<Attachment>
{description && <MarkdownText parseEmoji variant='inline' content={description} />}
{description && <MarkdownText mbs='x2' mbe='x4' parseEmoji variant='inline' content={description} />}
<Attachment.Row>
<Attachment.Title>{title}</Attachment.Title>
{size && <Attachment.Size size={size} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ const MessageContent: FC<{ message: IMessage; sequential: boolean; subscription?

const mineUid = useUserId();

const hasMessage = message?.md || message?.msg;

return (
<>
<MessageBody data-qa-type='message-body'>
<MessageRender message={message} />
</MessageBody>
{hasMessage && (
<MessageBody data-qa-type='message-body'>
<MessageRender message={message} />
</MessageBody>
)}

{message.blocks && <MessageBlock mid={message._id} blocks={message.blocks} appId rid={message.rid} />}
{message.attachments && <Attachments attachments={message.attachments} file={message.file} />}

Expand Down Expand Up @@ -93,7 +98,7 @@ const MessageContent: FC<{ message: IMessage; sequential: boolean; subscription?
<BroadcastMetric replyBroadcast={(): void => replyBroadcast(message)} mid={message._id} username={user.username} />
)}

{oembedIsEnabled && message.urls && <PreviewList urls={message.urls} />}
{oembedIsEnabled && !!message.urls?.length && <PreviewList urls={message.urls} />}

{shouldShowReadReceipt && <ReadReceipt unread={message.unread} />}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const OEmbedCollapseable = ({ children, ...props }: OEmbedCollapseableProps): Re

return (
<>
<Box display='flex' flexDirection='row' color='hint' fontScale='c1'>
<Box mbs='x4' mbe='x6' display='flex' flexDirection='row' color='hint' fontScale='c1' alignItems='center'>
{t('Link_Preview')} {collapse}
</Box>
<MessageGenericPreview>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const PreviewList = ({ urls }: PreviewListProps): ReactElement | null => {
const metaAndHeaders = urls.map(processMetaAndHeaders).filter(isPreviewData);

return (
<Box width={oembedWidth}>
<Box width={oembedWidth} mb='x4'>
{metaAndHeaders.map(({ type, data }, index) => {
if (isMetaPreview(data, type)) {
return <OEmbedResolver meta={data} key={index} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ const UrlPreview = (props: UrlPreviewType): ReactElement => {

return (
<>
<Box display='flex' flexDirection='row' color='hint' fontScale='c1'>
<Box mbs='x4' mbe='x2' display='flex' flexDirection='row' color='hint' fontScale='c1' alignItems='center'>
{t('Link_Preview')} {collapse}
</Box>
{!collapsed && <UrlPreviewResolver {...props} />}
{!collapsed && (
<Box mb='x4'>
<UrlPreviewResolver {...props} />
</Box>
)}
</>
);
};
Expand Down