From 1592cb6fa5929035f65110e1ea07aae21183cdb1 Mon Sep 17 00:00:00 2001 From: gabriellsh Date: Wed, 1 Jun 2022 18:26:10 -0300 Subject: [PATCH 1/4] Remove namespace and fix margins --- .../Attachments/Attachment/Description.tsx | 6 ++ .../Message/Attachments/Attachment/index.tsx | 72 ++++++++++--------- .../Message/Attachments/DefaultAttachment.tsx | 47 +++++++----- .../Attachments/Files/AudioAttachment.tsx | 27 ++++--- .../Files/GenericFileAttachment.tsx | 34 +++++---- .../Attachments/Files/ImageAttachment.tsx | 29 +++++--- .../Attachments/Files/PDFAttachment.tsx | 38 ---------- .../Attachments/Files/VideoAttachment.tsx | 27 ++++--- .../Message/Attachments/QuoteAttachment.tsx | 31 ++++---- .../Message/Attachments/hooks/useCollapse.tsx | 4 +- .../MessageList/components/MessageContent.tsx | 2 +- .../components/UrlPreview/PreviewList.tsx | 18 +++-- 12 files changed, 182 insertions(+), 153 deletions(-) create mode 100644 apps/meteor/client/components/Message/Attachments/Attachment/Description.tsx delete mode 100644 apps/meteor/client/components/Message/Attachments/Files/PDFAttachment.tsx diff --git a/apps/meteor/client/components/Message/Attachments/Attachment/Description.tsx b/apps/meteor/client/components/Message/Attachments/Attachment/Description.tsx new file mode 100644 index 000000000000..2f4839d82a23 --- /dev/null +++ b/apps/meteor/client/components/Message/Attachments/Attachment/Description.tsx @@ -0,0 +1,6 @@ +import { Box } from '@rocket.chat/fuselage'; +import React, { ComponentProps, ReactElement } from 'react'; + +const Description = ({ ...props }: ComponentProps): ReactElement => ; + +export default Description; diff --git a/apps/meteor/client/components/Message/Attachments/Attachment/index.tsx b/apps/meteor/client/components/Message/Attachments/Attachment/index.tsx index 6ce4be6967ed..185b855214d6 100644 --- a/apps/meteor/client/components/Message/Attachments/Attachment/index.tsx +++ b/apps/meteor/client/components/Message/Attachments/Attachment/index.tsx @@ -1,36 +1,40 @@ -import Image from '../components/Image'; +import AttachmentImage from '../components/Image'; import Attachment from './Attachment'; -import Author from './Author'; -import AuthorAvatar from './AuthorAvatar'; -import AuthorName from './AuthorName'; -import Block from './Block'; -import Collapse from './Collapse'; -import Content from './Content'; -import Details from './Details'; -import Download from './Download'; -import Inner from './Inner'; -import Row from './Row'; -import Size from './Size'; -import Text from './Text'; -import Thumb from './Thumb'; -import Title from './Title'; -import TitleLink from './TitleLink'; +import AttachmentAuthor from './Author'; +import AttachmentAuthorAvatar from './AuthorAvatar'; +import AttachmentAuthorName from './AuthorName'; +import AttachmentBlock from './Block'; +import AttachmentCollapse from './Collapse'; +import AttachmentContent from './Content'; +import AttachmentDescription from './Description'; +import AttachmentDetails from './Details'; +import AttachmentDownload from './Download'; +import AttachmentInner from './Inner'; +import AttachmentRow from './Row'; +import AttachmentSize from './Size'; +import AttachmentText from './Text'; +import AttachmentThumb from './Thumb'; +import AttachmentTitle from './Title'; +import AttachmentTitleLink from './TitleLink'; -export default Object.assign(Attachment, { - Image, - Row, - Title, - Text, - TitleLink, - Size, - Thumb, - Collapse, - Download, - Content, - Details, - Inner, - Block, - Author, - AuthorAvatar, - AuthorName, -}); +export { + AttachmentImage, + AttachmentAuthor, + AttachmentAuthorAvatar, + AttachmentAuthorName, + AttachmentBlock, + AttachmentCollapse, + AttachmentContent, + AttachmentDetails, + AttachmentDownload, + AttachmentInner, + AttachmentRow, + AttachmentSize, + AttachmentText, + AttachmentThumb, + AttachmentTitle, + AttachmentTitleLink, + AttachmentDescription, +}; + +export default Attachment; diff --git a/apps/meteor/client/components/Message/Attachments/DefaultAttachment.tsx b/apps/meteor/client/components/Message/Attachments/DefaultAttachment.tsx index f526356fceed..728395d58d61 100644 --- a/apps/meteor/client/components/Message/Attachments/DefaultAttachment.tsx +++ b/apps/meteor/client/components/Message/Attachments/DefaultAttachment.tsx @@ -3,7 +3,18 @@ import React, { FC, ReactNode, ComponentProps } from 'react'; import MarkdownText from '../../MarkdownText'; import { ActionAttachment } from './ActionAttachtment'; -import Attachment from './Attachment'; +import { + AttachmentBlock, + AttachmentText, + AttachmentContent, + AttachmentAuthor, + AttachmentAuthorAvatar, + AttachmentAuthorName, + AttachmentRow, + AttachmentTitle, + AttachmentImage, + AttachmentThumb, +} from './Attachment'; import FieldsAttachment from './FieldsAttachment'; import { useCollapse } from './hooks/useCollapse'; @@ -18,19 +29,19 @@ const DefaultAttachment: FC = (attachment) => { const [collapsed, collapse] = useCollapse(!!attachment.collapsed); return ( - {applyMarkdownIfRequires(attachment.mrkdwn_in, 'pretext', attachment.pretext)} + {applyMarkdownIfRequires(attachment.mrkdwn_in, 'pretext', attachment.pretext)} ) } > - + {attachment.author_name && ( - - {attachment.author_icon && } - + {attachment.author_icon && } + = (attachment) => { })} > {attachment.author_name} - - + + )} {attachment.title && ( - - + = (attachment) => { })} > {attachment.title} - {' '} + {' '} {collapse} - + )} {!collapsed && ( <> {attachment.text && ( - {applyMarkdownIfRequires(attachment.mrkdwn_in, 'text', attachment.text, 'document')} + {applyMarkdownIfRequires(attachment.mrkdwn_in, 'text', attachment.text, 'document')} )} {/* {attachment.fields && ({ ...rest, value: })) : attachment.fields} />} */} {attachment.fields && ( @@ -80,14 +91,14 @@ const DefaultAttachment: FC = (attachment) => { })} /> )} - {attachment.image_url && } + {attachment.image_url && } {/* DEPRECATED */} {isActionAttachment(attachment) && } )} - - {attachment.thumb_url && } - + + {attachment.thumb_url && } + ); }; diff --git a/apps/meteor/client/components/Message/Attachments/Files/AudioAttachment.tsx b/apps/meteor/client/components/Message/Attachments/Files/AudioAttachment.tsx index 771042e517aa..dbe9cd3439ae 100644 --- a/apps/meteor/client/components/Message/Attachments/Files/AudioAttachment.tsx +++ b/apps/meteor/client/components/Message/Attachments/Files/AudioAttachment.tsx @@ -3,7 +3,14 @@ import { useMediaUrl } from '@rocket.chat/ui-contexts'; import React, { FC } from 'react'; import MarkdownText from '../../../MarkdownText'; -import Attachment from '../Attachment'; +import Attachment, { + AttachmentRow, + AttachmentContent, + AttachmentSize, + AttachmentDownload, + AttachmentTitle, + AttachmentDescription, +} from '../Attachment'; import { useCollapse } from '../hooks/useCollapse'; export const AudioAttachment: FC = ({ @@ -20,19 +27,21 @@ export const AudioAttachment: FC = ({ const getURL = useMediaUrl(); return ( - - - {title} - {size && } + + + + + {title} + {size && } {collapse} - {hasDownload && link && } - + {hasDownload && link && } + {!collapsed && ( - + - + )} ); diff --git a/apps/meteor/client/components/Message/Attachments/Files/GenericFileAttachment.tsx b/apps/meteor/client/components/Message/Attachments/Files/GenericFileAttachment.tsx index bb571a379a29..4bcef951586e 100644 --- a/apps/meteor/client/components/Message/Attachments/Files/GenericFileAttachment.tsx +++ b/apps/meteor/client/components/Message/Attachments/Files/GenericFileAttachment.tsx @@ -3,7 +3,14 @@ import { useMediaUrl } from '@rocket.chat/ui-contexts'; import React, { FC } from 'react'; import MarkdownText from '../../../MarkdownText'; -import Attachment from '../Attachment'; +import Attachment, { + AttachmentRow, + AttachmentTitleLink, + AttachmentTitle, + AttachmentSize, + AttachmentDownload, + AttachmentDescription, +} from '../Attachment'; export type GenericFileAttachmentProps = { file?: FileProp; @@ -25,20 +32,17 @@ export const GenericFileAttachment: FC = ({ const getURL = useMediaUrl(); return ( - {description && } - - {hasDownload && link ? : {title}} - {size && } - {/* {collapse} */} - {hasDownload && link && } - - {/* { !collapsed && - - {hasDownload && link && } - {name} - {size && }{format && size && ' | '}{format} - - } */} + {description && ( + + + + )} + + {hasDownload && link ? : {title}} + {size && } + + {hasDownload && link && } + ); }; diff --git a/apps/meteor/client/components/Message/Attachments/Files/ImageAttachment.tsx b/apps/meteor/client/components/Message/Attachments/Files/ImageAttachment.tsx index a45a96c4b22c..0e3573a5e234 100644 --- a/apps/meteor/client/components/Message/Attachments/Files/ImageAttachment.tsx +++ b/apps/meteor/client/components/Message/Attachments/Files/ImageAttachment.tsx @@ -3,7 +3,14 @@ import { useMediaUrl } from '@rocket.chat/ui-contexts'; import React, { FC } from 'react'; import MarkdownText from '../../../MarkdownText'; -import Attachment from '../Attachment'; +import Attachment, { + AttachmentRow, + AttachmentTitle, + AttachmentSize, + AttachmentDownload, + AttachmentContent, + AttachmentDescription, +} from '../Attachment'; import Image from '../components/Image'; import { useCollapse } from '../hooks/useCollapse'; import { useLoadImage } from '../hooks/useLoadImage'; @@ -27,15 +34,19 @@ export const ImageAttachment: FC = ({ const getURL = useMediaUrl(); return ( - {description && } - - {title} - {size && } + {description && ( + + + + )} + + {title} + {size && } {collapse} - {hasDownload && link && } - + {hasDownload && link && } + {!collapsed && ( - + = ({ src={getURL(url)} previewUrl={`data:image/png;base64,${imagePreview}`} /> - + )} ); diff --git a/apps/meteor/client/components/Message/Attachments/Files/PDFAttachment.tsx b/apps/meteor/client/components/Message/Attachments/Files/PDFAttachment.tsx deleted file mode 100644 index 5efedf8df273..000000000000 --- a/apps/meteor/client/components/Message/Attachments/Files/PDFAttachment.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { PDFAttachmentProps } from '@rocket.chat/core-typings'; -import { useTranslation } from '@rocket.chat/ui-contexts'; -import React, { FC } from 'react'; - -import MarkdownText from '../../../MarkdownText'; -import Attachment from '../Attachment'; -import { useCollapse } from '../hooks/useCollapse'; - -export const PDFAttachment: FC = ({ - collapsed: collapsedDefault = false, - description, - title_link: link, - title_link_download: hasDownload, - file, -}) => { - const t = useTranslation(); - const [collapsed, collapse] = useCollapse(collapsedDefault); - return ( - - {description && } - - {t('PDF')} - {collapse} - {hasDownload && link && } - - {!collapsed && ( - - - {/*
- {title} - {file.size && } - {{> icon block="rc-input__icon-svg" icon="loading"}} -
*/} -
- )} -
- ); -}; diff --git a/apps/meteor/client/components/Message/Attachments/Files/VideoAttachment.tsx b/apps/meteor/client/components/Message/Attachments/Files/VideoAttachment.tsx index 2205d54f5b1c..b0a00d8c11ff 100644 --- a/apps/meteor/client/components/Message/Attachments/Files/VideoAttachment.tsx +++ b/apps/meteor/client/components/Message/Attachments/Files/VideoAttachment.tsx @@ -4,7 +4,14 @@ import { useMediaUrl } from '@rocket.chat/ui-contexts'; import React, { FC } from 'react'; import MarkdownText from '../../../MarkdownText'; -import Attachment from '../Attachment'; +import Attachment, { + AttachmentRow, + AttachmentTitle, + AttachmentSize, + AttachmentDownload, + AttachmentContent, + AttachmentDetails, +} from '../Attachment'; import { useCollapse } from '../hooks/useCollapse'; export const VideoAttachment: FC = ({ @@ -22,23 +29,23 @@ export const VideoAttachment: FC = ({ return ( - - {title} - {size && } + + {title} + {size && } {collapse} - {hasDownload && link && } - + {hasDownload && link && } + {!collapsed && ( - + {description && ( - + - + )} - + )} ); diff --git a/apps/meteor/client/components/Message/Attachments/QuoteAttachment.tsx b/apps/meteor/client/components/Message/Attachments/QuoteAttachment.tsx index d0296152c3cc..591df3d1712d 100644 --- a/apps/meteor/client/components/Message/Attachments/QuoteAttachment.tsx +++ b/apps/meteor/client/components/Message/Attachments/QuoteAttachment.tsx @@ -7,7 +7,14 @@ import React, { FC } from 'react'; import Attachments from '.'; import { useTimeAgo } from '../../../hooks/useTimeAgo'; import MarkdownText from '../../MarkdownText'; -import Attachment from './Attachment'; +import { + AttachmentContent, + AttachmentDetails, + AttachmentAuthor, + AttachmentAuthorAvatar, + AttachmentAuthorName, + AttachmentInner, +} from './Attachment'; const hover = css` &:hover, @@ -32,8 +39,8 @@ export const QuoteAttachment: FC = ({ const format = useTimeAgo(); return ( <> - - + = ({ borderColor='neutral-200' borderInlineStartColor='neutral-600' > - - - + + + {name} - + {ts && ( {format(ts)} )} - + {attachments && ( - + - + )} - - + + ); }; diff --git a/apps/meteor/client/components/Message/Attachments/hooks/useCollapse.tsx b/apps/meteor/client/components/Message/Attachments/hooks/useCollapse.tsx index 5f320a87480d..b0ef930f17b9 100644 --- a/apps/meteor/client/components/Message/Attachments/hooks/useCollapse.tsx +++ b/apps/meteor/client/components/Message/Attachments/hooks/useCollapse.tsx @@ -2,10 +2,10 @@ import { useToggle } from '@rocket.chat/fuselage-hooks'; import { useAttachmentIsCollapsedByDefault } from '@rocket.chat/ui-contexts'; import React from 'react'; -import Attachment from '../Attachment'; +import { AttachmentCollapse } from '../Attachment'; export const useCollapse = (attachmentCollapsed: boolean): [boolean, JSX.Element] => { const collpaseByDefault = useAttachmentIsCollapsedByDefault(); const [collapsed, toogleCollapsed] = useToggle(collpaseByDefault || attachmentCollapsed); - return [collapsed, ]; + return [collapsed, ]; }; diff --git a/apps/meteor/client/views/room/MessageList/components/MessageContent.tsx b/apps/meteor/client/views/room/MessageList/components/MessageContent.tsx index d19900d7b51b..4bcb365d6536 100644 --- a/apps/meteor/client/views/room/MessageList/components/MessageContent.tsx +++ b/apps/meteor/client/views/room/MessageList/components/MessageContent.tsx @@ -47,7 +47,7 @@ const MessageContent: FC<{ message: IMessage; sequential: boolean; subscription? return ( <> - {!message.blocks && ( + {!message.blocks && (message.md || message.msg) && ( {!isEncryptedMessage && } {isEncryptedMessage && message.e2e === 'done' && } diff --git a/apps/meteor/client/views/room/MessageList/components/UrlPreview/PreviewList.tsx b/apps/meteor/client/views/room/MessageList/components/UrlPreview/PreviewList.tsx index d412957ecdc7..5e866878c5c4 100644 --- a/apps/meteor/client/views/room/MessageList/components/UrlPreview/PreviewList.tsx +++ b/apps/meteor/client/views/room/MessageList/components/UrlPreview/PreviewList.tsx @@ -1,4 +1,4 @@ -import { Box } from '@rocket.chat/fuselage'; +import { MessageBlock } from '@rocket.chat/fuselage'; import React, { ReactElement } from 'react'; import { useMessageOembedMaxWidth } from '../../../contexts/MessageContext'; @@ -117,14 +117,22 @@ const PreviewList = ({ urls }: PreviewListProps): ReactElement | null => { const metaAndHeaders = urls.map(processMetaAndHeaders).filter(isPreviewData); return ( - + <> {metaAndHeaders.map(({ type, data }, index) => { if (isMetaPreview(data, type)) { - return ; + return ( + + + + ); } - return ; + return ( + + + + ); })} - + ); }; From d5493d257044e5187d84fe296bee4912e8eeae09 Mon Sep 17 00:00:00 2001 From: gabriellsh Date: Thu, 2 Jun 2022 13:35:43 -0300 Subject: [PATCH 2/4] import from File instead of index --- .../Message/Attachments/Attachment/index.tsx | 37 ------------------- .../Message/Attachments/DefaultAttachment.tsx | 22 +++++------ .../Attachments/Files/AudioAttachment.tsx | 15 ++++---- .../Files/GenericFileAttachment.tsx | 15 ++++---- .../Attachments/Files/ImageAttachment.tsx | 15 ++++---- .../Attachments/Files/VideoAttachment.tsx | 15 ++++---- .../Message/Attachments/QuoteAttachment.tsx | 14 +++---- .../Message/Attachments/hooks/useCollapse.tsx | 2 +- 8 files changed, 45 insertions(+), 90 deletions(-) diff --git a/apps/meteor/client/components/Message/Attachments/Attachment/index.tsx b/apps/meteor/client/components/Message/Attachments/Attachment/index.tsx index 185b855214d6..883a34b494aa 100644 --- a/apps/meteor/client/components/Message/Attachments/Attachment/index.tsx +++ b/apps/meteor/client/components/Message/Attachments/Attachment/index.tsx @@ -1,40 +1,3 @@ -import AttachmentImage from '../components/Image'; import Attachment from './Attachment'; -import AttachmentAuthor from './Author'; -import AttachmentAuthorAvatar from './AuthorAvatar'; -import AttachmentAuthorName from './AuthorName'; -import AttachmentBlock from './Block'; -import AttachmentCollapse from './Collapse'; -import AttachmentContent from './Content'; -import AttachmentDescription from './Description'; -import AttachmentDetails from './Details'; -import AttachmentDownload from './Download'; -import AttachmentInner from './Inner'; -import AttachmentRow from './Row'; -import AttachmentSize from './Size'; -import AttachmentText from './Text'; -import AttachmentThumb from './Thumb'; -import AttachmentTitle from './Title'; -import AttachmentTitleLink from './TitleLink'; - -export { - AttachmentImage, - AttachmentAuthor, - AttachmentAuthorAvatar, - AttachmentAuthorName, - AttachmentBlock, - AttachmentCollapse, - AttachmentContent, - AttachmentDetails, - AttachmentDownload, - AttachmentInner, - AttachmentRow, - AttachmentSize, - AttachmentText, - AttachmentThumb, - AttachmentTitle, - AttachmentTitleLink, - AttachmentDescription, -}; export default Attachment; diff --git a/apps/meteor/client/components/Message/Attachments/DefaultAttachment.tsx b/apps/meteor/client/components/Message/Attachments/DefaultAttachment.tsx index 728395d58d61..7252248528d4 100644 --- a/apps/meteor/client/components/Message/Attachments/DefaultAttachment.tsx +++ b/apps/meteor/client/components/Message/Attachments/DefaultAttachment.tsx @@ -3,19 +3,17 @@ import React, { FC, ReactNode, ComponentProps } from 'react'; import MarkdownText from '../../MarkdownText'; import { ActionAttachment } from './ActionAttachtment'; -import { - AttachmentBlock, - AttachmentText, - AttachmentContent, - AttachmentAuthor, - AttachmentAuthorAvatar, - AttachmentAuthorName, - AttachmentRow, - AttachmentTitle, - AttachmentImage, - AttachmentThumb, -} from './Attachment'; +import AttachmentAuthor from './Attachment/Author'; +import AttachmentAuthorAvatar from './Attachment/AuthorAvatar'; +import AttachmentAuthorName from './Attachment/AuthorName'; +import AttachmentBlock from './Attachment/Block'; +import AttachmentContent from './Attachment/Content'; +import AttachmentRow from './Attachment/Row'; +import AttachmentText from './Attachment/Text'; +import AttachmentThumb from './Attachment/Thumb'; +import AttachmentTitle from './Attachment/Title'; import FieldsAttachment from './FieldsAttachment'; +import AttachmentImage from './components/Image'; import { useCollapse } from './hooks/useCollapse'; const applyMarkdownIfRequires = ( diff --git a/apps/meteor/client/components/Message/Attachments/Files/AudioAttachment.tsx b/apps/meteor/client/components/Message/Attachments/Files/AudioAttachment.tsx index dbe9cd3439ae..768e965beaa3 100644 --- a/apps/meteor/client/components/Message/Attachments/Files/AudioAttachment.tsx +++ b/apps/meteor/client/components/Message/Attachments/Files/AudioAttachment.tsx @@ -3,14 +3,13 @@ import { useMediaUrl } from '@rocket.chat/ui-contexts'; import React, { FC } from 'react'; import MarkdownText from '../../../MarkdownText'; -import Attachment, { - AttachmentRow, - AttachmentContent, - AttachmentSize, - AttachmentDownload, - AttachmentTitle, - AttachmentDescription, -} from '../Attachment'; +import Attachment from '../Attachment'; +import AttachmentContent from '../Attachment/Content'; +import AttachmentDescription from '../Attachment/Description'; +import AttachmentDownload from '../Attachment/Download'; +import AttachmentRow from '../Attachment/Row'; +import AttachmentSize from '../Attachment/Size'; +import AttachmentTitle from '../Attachment/Title'; import { useCollapse } from '../hooks/useCollapse'; export const AudioAttachment: FC = ({ diff --git a/apps/meteor/client/components/Message/Attachments/Files/GenericFileAttachment.tsx b/apps/meteor/client/components/Message/Attachments/Files/GenericFileAttachment.tsx index 4bcef951586e..56a8ea2f5dd6 100644 --- a/apps/meteor/client/components/Message/Attachments/Files/GenericFileAttachment.tsx +++ b/apps/meteor/client/components/Message/Attachments/Files/GenericFileAttachment.tsx @@ -3,14 +3,13 @@ import { useMediaUrl } from '@rocket.chat/ui-contexts'; import React, { FC } from 'react'; import MarkdownText from '../../../MarkdownText'; -import Attachment, { - AttachmentRow, - AttachmentTitleLink, - AttachmentTitle, - AttachmentSize, - AttachmentDownload, - AttachmentDescription, -} from '../Attachment'; +import Attachment from '../Attachment'; +import AttachmentDescription from '../Attachment/Description'; +import AttachmentDownload from '../Attachment/Download'; +import AttachmentRow from '../Attachment/Row'; +import AttachmentSize from '../Attachment/Size'; +import AttachmentTitle from '../Attachment/Title'; +import AttachmentTitleLink from '../Attachment/TitleLink'; export type GenericFileAttachmentProps = { file?: FileProp; diff --git a/apps/meteor/client/components/Message/Attachments/Files/ImageAttachment.tsx b/apps/meteor/client/components/Message/Attachments/Files/ImageAttachment.tsx index 0e3573a5e234..6aaad2c982f8 100644 --- a/apps/meteor/client/components/Message/Attachments/Files/ImageAttachment.tsx +++ b/apps/meteor/client/components/Message/Attachments/Files/ImageAttachment.tsx @@ -3,14 +3,13 @@ import { useMediaUrl } from '@rocket.chat/ui-contexts'; import React, { FC } from 'react'; import MarkdownText from '../../../MarkdownText'; -import Attachment, { - AttachmentRow, - AttachmentTitle, - AttachmentSize, - AttachmentDownload, - AttachmentContent, - AttachmentDescription, -} from '../Attachment'; +import Attachment from '../Attachment'; +import AttachmentContent from '../Attachment/Content'; +import AttachmentDescription from '../Attachment/Description'; +import AttachmentDownload from '../Attachment/Download'; +import AttachmentRow from '../Attachment/Row'; +import AttachmentSize from '../Attachment/Size'; +import AttachmentTitle from '../Attachment/Title'; import Image from '../components/Image'; import { useCollapse } from '../hooks/useCollapse'; import { useLoadImage } from '../hooks/useLoadImage'; diff --git a/apps/meteor/client/components/Message/Attachments/Files/VideoAttachment.tsx b/apps/meteor/client/components/Message/Attachments/Files/VideoAttachment.tsx index b0a00d8c11ff..16ccf39253cd 100644 --- a/apps/meteor/client/components/Message/Attachments/Files/VideoAttachment.tsx +++ b/apps/meteor/client/components/Message/Attachments/Files/VideoAttachment.tsx @@ -4,14 +4,13 @@ import { useMediaUrl } from '@rocket.chat/ui-contexts'; import React, { FC } from 'react'; import MarkdownText from '../../../MarkdownText'; -import Attachment, { - AttachmentRow, - AttachmentTitle, - AttachmentSize, - AttachmentDownload, - AttachmentContent, - AttachmentDetails, -} from '../Attachment'; +import Attachment from '../Attachment'; +import AttachmentContent from '../Attachment/Content'; +import AttachmentDetails from '../Attachment/Details'; +import AttachmentDownload from '../Attachment/Download'; +import AttachmentRow from '../Attachment/Row'; +import AttachmentSize from '../Attachment/Size'; +import AttachmentTitle from '../Attachment/Title'; import { useCollapse } from '../hooks/useCollapse'; export const VideoAttachment: FC = ({ diff --git a/apps/meteor/client/components/Message/Attachments/QuoteAttachment.tsx b/apps/meteor/client/components/Message/Attachments/QuoteAttachment.tsx index 591df3d1712d..e22e83346d1e 100644 --- a/apps/meteor/client/components/Message/Attachments/QuoteAttachment.tsx +++ b/apps/meteor/client/components/Message/Attachments/QuoteAttachment.tsx @@ -7,14 +7,12 @@ import React, { FC } from 'react'; import Attachments from '.'; import { useTimeAgo } from '../../../hooks/useTimeAgo'; import MarkdownText from '../../MarkdownText'; -import { - AttachmentContent, - AttachmentDetails, - AttachmentAuthor, - AttachmentAuthorAvatar, - AttachmentAuthorName, - AttachmentInner, -} from './Attachment'; +import AttachmentAuthor from './Attachment/Author'; +import AttachmentAuthorAvatar from './Attachment/AuthorAvatar'; +import AttachmentAuthorName from './Attachment/AuthorName'; +import AttachmentContent from './Attachment/Content'; +import AttachmentDetails from './Attachment/Details'; +import AttachmentInner from './Attachment/Inner'; const hover = css` &:hover, diff --git a/apps/meteor/client/components/Message/Attachments/hooks/useCollapse.tsx b/apps/meteor/client/components/Message/Attachments/hooks/useCollapse.tsx index b0ef930f17b9..d2899be1bcbf 100644 --- a/apps/meteor/client/components/Message/Attachments/hooks/useCollapse.tsx +++ b/apps/meteor/client/components/Message/Attachments/hooks/useCollapse.tsx @@ -2,7 +2,7 @@ import { useToggle } from '@rocket.chat/fuselage-hooks'; import { useAttachmentIsCollapsedByDefault } from '@rocket.chat/ui-contexts'; import React from 'react'; -import { AttachmentCollapse } from '../Attachment'; +import AttachmentCollapse from '../Attachment/Collapse'; export const useCollapse = (attachmentCollapsed: boolean): [boolean, JSX.Element] => { const collpaseByDefault = useAttachmentIsCollapsedByDefault(); From be99cc6eff4313327d0df28c6f3e6bfaa2e53659 Mon Sep 17 00:00:00 2001 From: gabriellsh Date: Mon, 6 Jun 2022 19:53:22 -0300 Subject: [PATCH 3/4] Rename --- .../message/Attachments/Attachment/Action.tsx | 6 ------ .../Attachment/AttachmentAction.tsx | 8 ++++++++ .../{Author.tsx => AttachmentAuthor.tsx} | 4 ++-- .../Attachment/AttachmentAuthorAvatar.tsx | 7 +++++++ .../Attachment/AttachmentAuthorName.tsx | 6 ++++++ .../{Block.tsx => AttachmentBlock.tsx} | 8 ++++++-- .../{Collapse.tsx => AttachmentCollapse.tsx} | 6 +++--- .../Attachment/AttachmentContent.tsx | 6 ++++++ .../Attachment/AttachmentDescription.tsx | 8 ++++++++ .../{Details.tsx => AttachmentDetails.tsx} | 4 ++-- .../{Download.tsx => AttachmentDownload.tsx} | 6 +++--- .../Attachments/Attachment/AttachmentInner.tsx | 6 ++++++ .../Attachment/{Row.tsx => AttachmentRow.tsx} | 4 ++-- .../{Size.tsx => AttachmentSize.tsx} | 6 +++--- .../Attachments/Attachment/AttachmentText.tsx | 6 ++++++ .../{Thumb.tsx => AttachmentThumb.tsx} | 4 ++-- .../Attachments/Attachment/AttachmentTitle.tsx | 8 ++++++++ .../{TitleLink.tsx => AttachmentTitleLink.tsx} | 6 +++--- .../Attachments/Attachment/AuthorAvatar.tsx | 7 ------- .../Attachments/Attachment/AuthorName.tsx | 6 ------ .../message/Attachments/Attachment/Content.tsx | 6 ------ .../Attachments/Attachment/Description.tsx | 6 ------ .../message/Attachments/Attachment/Inner.tsx | 6 ------ .../message/Attachments/Attachment/Text.tsx | 6 ------ .../message/Attachments/Attachment/Title.tsx | 6 ------ .../message/Attachments/DefaultAttachment.tsx | 18 +++++++++--------- .../Attachments/Files/AudioAttachment.tsx | 12 ++++++------ .../Files/GenericFileAttachment.tsx | 12 ++++++------ .../Attachments/Files/ImageAttachment.tsx | 12 ++++++------ .../Attachments/Files/VideoAttachment.tsx | 12 ++++++------ .../message/Attachments/QuoteAttachment.tsx | 12 ++++++------ .../message/Attachments/hooks/useCollapse.tsx | 2 +- 32 files changed, 121 insertions(+), 111 deletions(-) delete mode 100644 apps/meteor/client/components/message/Attachments/Attachment/Action.tsx create mode 100644 apps/meteor/client/components/message/Attachments/Attachment/AttachmentAction.tsx rename apps/meteor/client/components/message/Attachments/Attachment/{Author.tsx => AttachmentAuthor.tsx} (64%) create mode 100644 apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorAvatar.tsx create mode 100644 apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorName.tsx rename apps/meteor/client/components/message/Attachments/Attachment/{Block.tsx => AttachmentBlock.tsx} (66%) rename apps/meteor/client/components/message/Attachments/Attachment/{Collapse.tsx => AttachmentCollapse.tsx} (56%) create mode 100644 apps/meteor/client/components/message/Attachments/Attachment/AttachmentContent.tsx create mode 100644 apps/meteor/client/components/message/Attachments/Attachment/AttachmentDescription.tsx rename apps/meteor/client/components/message/Attachments/Attachment/{Details.tsx => AttachmentDetails.tsx} (65%) rename apps/meteor/client/components/message/Attachments/Attachment/{Download.tsx => AttachmentDownload.tsx} (64%) create mode 100644 apps/meteor/client/components/message/Attachments/Attachment/AttachmentInner.tsx rename apps/meteor/client/components/message/Attachments/Attachment/{Row.tsx => AttachmentRow.tsx} (67%) rename apps/meteor/client/components/message/Attachments/Attachment/{Size.tsx => AttachmentSize.tsx} (63%) create mode 100644 apps/meteor/client/components/message/Attachments/Attachment/AttachmentText.tsx rename apps/meteor/client/components/message/Attachments/Attachment/{Thumb.tsx => AttachmentThumb.tsx} (63%) create mode 100644 apps/meteor/client/components/message/Attachments/Attachment/AttachmentTitle.tsx rename apps/meteor/client/components/message/Attachments/Attachment/{TitleLink.tsx => AttachmentTitleLink.tsx} (50%) delete mode 100644 apps/meteor/client/components/message/Attachments/Attachment/AuthorAvatar.tsx delete mode 100644 apps/meteor/client/components/message/Attachments/Attachment/AuthorName.tsx delete mode 100644 apps/meteor/client/components/message/Attachments/Attachment/Content.tsx delete mode 100644 apps/meteor/client/components/message/Attachments/Attachment/Description.tsx delete mode 100644 apps/meteor/client/components/message/Attachments/Attachment/Inner.tsx delete mode 100644 apps/meteor/client/components/message/Attachments/Attachment/Text.tsx delete mode 100644 apps/meteor/client/components/message/Attachments/Attachment/Title.tsx diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Action.tsx b/apps/meteor/client/components/message/Attachments/Attachment/Action.tsx deleted file mode 100644 index f98f4397e719..000000000000 --- a/apps/meteor/client/components/message/Attachments/Attachment/Action.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { ActionButton } from '@rocket.chat/fuselage'; -import React, { ComponentProps, FC } from 'react'; - -const Action: FC & { icon: string }> = (props) => ; - -export default Action; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAction.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAction.tsx new file mode 100644 index 000000000000..e006cc947896 --- /dev/null +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAction.tsx @@ -0,0 +1,8 @@ +import { ActionButton } from '@rocket.chat/fuselage'; +import React, { ComponentProps, FC } from 'react'; + +const AttachmentAction: FC & { icon: string }> = (props) => ( + +); + +export default AttachmentAction; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Author.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthor.tsx similarity index 64% rename from apps/meteor/client/components/message/Attachments/Attachment/Author.tsx rename to apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthor.tsx index 914bd381e8da..cf510147a55a 100644 --- a/apps/meteor/client/components/message/Attachments/Attachment/Author.tsx +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthor.tsx @@ -1,8 +1,8 @@ import { Box } from '@rocket.chat/fuselage'; import React, { ComponentProps, FC } from 'react'; -const Author: FC> = (props) => ( +const AttachmentAuthor: FC> = (props) => ( ); -export default Author; +export default AttachmentAuthor; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorAvatar.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorAvatar.tsx new file mode 100644 index 000000000000..fe7f11e22520 --- /dev/null +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorAvatar.tsx @@ -0,0 +1,7 @@ +import React, { FC } from 'react'; + +import BaseAvatar from '../../../avatar/BaseAvatar'; + +const AttachmentAuthorAvatar: FC<{ url: string }> = ({ url }) => ; + +export default AttachmentAuthorAvatar; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorName.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorName.tsx new file mode 100644 index 000000000000..7b4e19707530 --- /dev/null +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorName.tsx @@ -0,0 +1,6 @@ +import { Box } from '@rocket.chat/fuselage'; +import React, { ComponentProps, FC } from 'react'; + +const AttachmentAuthorName: FC> = (props) => ; + +export default AttachmentAuthorName; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Block.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentBlock.tsx similarity index 66% rename from apps/meteor/client/components/message/Attachments/Attachment/Block.tsx rename to apps/meteor/client/components/message/Attachments/Attachment/AttachmentBlock.tsx index 560911b1eef0..61b91196843a 100644 --- a/apps/meteor/client/components/message/Attachments/Attachment/Block.tsx +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentBlock.tsx @@ -3,7 +3,11 @@ import React, { FC } from 'react'; import Attachment from './Attachment'; -const Block: FC<{ pre?: JSX.Element | string | undefined; color?: string | undefined }> = ({ pre, color = 'neutral-600', children }) => ( +const AttachmentBlock: FC<{ pre?: JSX.Element | string | undefined; color?: string | undefined }> = ({ + pre, + color = 'neutral-600', + children, +}) => ( {pre} ); -export default Block; +export default AttachmentBlock; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Collapse.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentCollapse.tsx similarity index 56% rename from apps/meteor/client/components/message/Attachments/Attachment/Collapse.tsx rename to apps/meteor/client/components/message/Attachments/Attachment/AttachmentCollapse.tsx index dd1477d157cb..6ea3e1c44b09 100644 --- a/apps/meteor/client/components/message/Attachments/Attachment/Collapse.tsx +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentCollapse.tsx @@ -1,11 +1,11 @@ import { useTranslation } from '@rocket.chat/ui-contexts'; import React, { ComponentProps, FC } from 'react'; -import Action from './Action'; +import Action from './AttachmentAction'; -const Collapse: FC, 'icon'> & { collapsed?: boolean }> = ({ collapsed = false, ...props }) => { +const AttachmentCollapse: FC, 'icon'> & { collapsed?: boolean }> = ({ collapsed = false, ...props }) => { const t = useTranslation(); return ; }; -export default Collapse; +export default AttachmentCollapse; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/AttachmentContent.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentContent.tsx new file mode 100644 index 000000000000..26625e53cf26 --- /dev/null +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentContent.tsx @@ -0,0 +1,6 @@ +import { Box } from '@rocket.chat/fuselage'; +import React, { ComponentProps, FC } from 'react'; + +const AttachmentContent: FC> = ({ ...props }) => ; + +export default AttachmentContent; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/AttachmentDescription.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentDescription.tsx new file mode 100644 index 000000000000..252ff98bf367 --- /dev/null +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentDescription.tsx @@ -0,0 +1,8 @@ +import { Box } from '@rocket.chat/fuselage'; +import React, { ComponentProps, ReactElement } from 'react'; + +const AttachmentDescription = ({ ...props }: ComponentProps): ReactElement => ( + +); + +export default AttachmentDescription; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Details.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentDetails.tsx similarity index 65% rename from apps/meteor/client/components/message/Attachments/Attachment/Details.tsx rename to apps/meteor/client/components/message/Attachments/Attachment/AttachmentDetails.tsx index 2d3ced46ff37..8f15f3b08311 100644 --- a/apps/meteor/client/components/message/Attachments/Attachment/Details.tsx +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentDetails.tsx @@ -1,8 +1,8 @@ import { Box } from '@rocket.chat/fuselage'; import React, { FC, ComponentProps } from 'react'; -const Details: FC> = ({ ...props }) => ( +const AttachmentDetails: FC> = ({ ...props }) => ( ); -export default Details; +export default AttachmentDetails; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Download.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentDownload.tsx similarity index 64% rename from apps/meteor/client/components/message/Attachments/Attachment/Download.tsx rename to apps/meteor/client/components/message/Attachments/Attachment/AttachmentDownload.tsx index 1d2b46fb2f23..68249f574725 100644 --- a/apps/meteor/client/components/message/Attachments/Attachment/Download.tsx +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentDownload.tsx @@ -1,9 +1,9 @@ import { useTranslation } from '@rocket.chat/ui-contexts'; import React, { ComponentProps, FC } from 'react'; -import Action from './Action'; +import Action from './AttachmentAction'; -const Download: FC, 'icon'> & { title?: string | undefined; href: string }> = ({ +const AttachmentDownload: FC, 'icon'> & { title?: string | undefined; href: string }> = ({ title, href, ...props @@ -23,4 +23,4 @@ const Download: FC, 'icon'> & { title?: strin ); }; -export default Download; +export default AttachmentDownload; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/AttachmentInner.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentInner.tsx new file mode 100644 index 000000000000..0b9e7aaaabe9 --- /dev/null +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentInner.tsx @@ -0,0 +1,6 @@ +import { Box } from '@rocket.chat/fuselage'; +import React, { ComponentProps, FC } from 'react'; + +const AttachmentInner: FC> = ({ ...props }) => ; + +export default AttachmentInner; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Row.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentRow.tsx similarity index 67% rename from apps/meteor/client/components/message/Attachments/Attachment/Row.tsx rename to apps/meteor/client/components/message/Attachments/Attachment/AttachmentRow.tsx index 91d383210708..ac5ac4bc7623 100644 --- a/apps/meteor/client/components/message/Attachments/Attachment/Row.tsx +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentRow.tsx @@ -1,8 +1,8 @@ import { Box } from '@rocket.chat/fuselage'; import React, { FC, ComponentProps } from 'react'; -const Row: FC> = (props) => ( +const AttachmentRow: FC> = (props) => ( ); -export default Row; +export default AttachmentRow; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Size.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentSize.tsx similarity index 63% rename from apps/meteor/client/components/message/Attachments/Attachment/Size.tsx rename to apps/meteor/client/components/message/Attachments/Attachment/AttachmentSize.tsx index 6d21f40ac875..5dbe8b107f54 100644 --- a/apps/meteor/client/components/message/Attachments/Attachment/Size.tsx +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentSize.tsx @@ -2,9 +2,9 @@ import { Box } from '@rocket.chat/fuselage'; import React, { ComponentProps, FC } from 'react'; import { useFormatMemorySize } from '../../../../hooks/useFormatMemorySize'; -import Title from './Title'; +import Title from './AttachmentTitle'; -const Size: FC & { size: number }> = ({ size, ...props }) => { +const AttachmentSize: FC & { size: number }> = ({ size, ...props }) => { const format = useFormatMemorySize(); return ( @@ -13,4 +13,4 @@ const Size: FC<ComponentProps<typeof Box> & { size: number }> = ({ size, ...prop ); }; -export default Size; +export default AttachmentSize; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/AttachmentText.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentText.tsx new file mode 100644 index 000000000000..b144df13b2cb --- /dev/null +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentText.tsx @@ -0,0 +1,6 @@ +import { Box } from '@rocket.chat/fuselage'; +import React, { ComponentProps, FC } from 'react'; + +const AttachmentText: FC<ComponentProps<typeof Box>> = (props) => <Box mbe='x4' mi='x2' fontScale='p2' color='default' {...props}></Box>; + +export default AttachmentText; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Thumb.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentThumb.tsx similarity index 63% rename from apps/meteor/client/components/message/Attachments/Attachment/Thumb.tsx rename to apps/meteor/client/components/message/Attachments/Attachment/AttachmentThumb.tsx index 0c8a7e8c6e19..712cd575dd95 100644 --- a/apps/meteor/client/components/message/Attachments/Attachment/Thumb.tsx +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentThumb.tsx @@ -1,10 +1,10 @@ import { Box, Avatar } from '@rocket.chat/fuselage'; import React, { FC, memo } from 'react'; -const Thumb: FC<{ url: string }> = ({ url }) => ( +const AttachmentThumb: FC<{ url: string }> = ({ url }) => ( <Box mis='x8'> <Avatar {...({ url, size: 'x48' } as any)} /> </Box> ); -export default memo(Thumb); +export default memo(AttachmentThumb); diff --git a/apps/meteor/client/components/message/Attachments/Attachment/AttachmentTitle.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentTitle.tsx new file mode 100644 index 000000000000..85db6c0d1819 --- /dev/null +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentTitle.tsx @@ -0,0 +1,8 @@ +import { Box } from '@rocket.chat/fuselage'; +import React, { ComponentProps, FC } from 'react'; + +const AttachmentTitle: FC<ComponentProps<typeof Box>> = (props) => ( + <Box withTruncatedText mi='x2' fontScale='c1' color='hint' {...props}></Box> +); + +export default AttachmentTitle; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/TitleLink.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentTitleLink.tsx similarity index 50% rename from apps/meteor/client/components/message/Attachments/Attachment/TitleLink.tsx rename to apps/meteor/client/components/message/Attachments/Attachment/AttachmentTitleLink.tsx index 946145df27a3..0e4b9bee7558 100644 --- a/apps/meteor/client/components/message/Attachments/Attachment/TitleLink.tsx +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentTitleLink.tsx @@ -1,11 +1,11 @@ import React, { FC } from 'react'; -import Title from './Title'; +import Title from './AttachmentTitle'; -const TitleLink: FC<{ link: string; title?: string | undefined }> = ({ link, title }) => ( +const AttachmentTitleLink: FC<{ link: string; title?: string | undefined }> = ({ link, title }) => ( <Title is='a' href={`${link}?download`} color={undefined} target='_blank' download={title} rel='noopener noreferrer'> {title} ); -export default TitleLink; +export default AttachmentTitleLink; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/AuthorAvatar.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AuthorAvatar.tsx deleted file mode 100644 index 315e3831a0db..000000000000 --- a/apps/meteor/client/components/message/Attachments/Attachment/AuthorAvatar.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React, { FC } from 'react'; - -import BaseAvatar from '../../../avatar/BaseAvatar'; - -const AuthorAvatar: FC<{ url: string }> = ({ url }) => ; - -export default AuthorAvatar; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/AuthorName.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AuthorName.tsx deleted file mode 100644 index 53c08df56757..000000000000 --- a/apps/meteor/client/components/message/Attachments/Attachment/AuthorName.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { Box } from '@rocket.chat/fuselage'; -import React, { ComponentProps, FC } from 'react'; - -const AuthorName: FC> = (props) => ; - -export default AuthorName; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Content.tsx b/apps/meteor/client/components/message/Attachments/Attachment/Content.tsx deleted file mode 100644 index aa8c156582f7..000000000000 --- a/apps/meteor/client/components/message/Attachments/Attachment/Content.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { Box } from '@rocket.chat/fuselage'; -import React, { ComponentProps, FC } from 'react'; - -const Content: FC> = ({ ...props }) => ; - -export default Content; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Description.tsx b/apps/meteor/client/components/message/Attachments/Attachment/Description.tsx deleted file mode 100644 index 2f4839d82a23..000000000000 --- a/apps/meteor/client/components/message/Attachments/Attachment/Description.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { Box } from '@rocket.chat/fuselage'; -import React, { ComponentProps, ReactElement } from 'react'; - -const Description = ({ ...props }: ComponentProps): ReactElement => ; - -export default Description; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Inner.tsx b/apps/meteor/client/components/message/Attachments/Attachment/Inner.tsx deleted file mode 100644 index 4cc1f96fb4e8..000000000000 --- a/apps/meteor/client/components/message/Attachments/Attachment/Inner.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { Box } from '@rocket.chat/fuselage'; -import React, { ComponentProps, FC } from 'react'; - -const Inner: FC> = ({ ...props }) => ; - -export default Inner; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Text.tsx b/apps/meteor/client/components/message/Attachments/Attachment/Text.tsx deleted file mode 100644 index b73b9c301c34..000000000000 --- a/apps/meteor/client/components/message/Attachments/Attachment/Text.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { Box } from '@rocket.chat/fuselage'; -import React, { ComponentProps, FC } from 'react'; - -const Text: FC> = (props) => ; - -export default Text; diff --git a/apps/meteor/client/components/message/Attachments/Attachment/Title.tsx b/apps/meteor/client/components/message/Attachments/Attachment/Title.tsx deleted file mode 100644 index e34770dbdf60..000000000000 --- a/apps/meteor/client/components/message/Attachments/Attachment/Title.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { Box } from '@rocket.chat/fuselage'; -import React, { ComponentProps, FC } from 'react'; - -const Title: FC> = (props) => ; - -export default Title; diff --git a/apps/meteor/client/components/message/Attachments/DefaultAttachment.tsx b/apps/meteor/client/components/message/Attachments/DefaultAttachment.tsx index 7252248528d4..618a4d787ed3 100644 --- a/apps/meteor/client/components/message/Attachments/DefaultAttachment.tsx +++ b/apps/meteor/client/components/message/Attachments/DefaultAttachment.tsx @@ -3,15 +3,15 @@ import React, { FC, ReactNode, ComponentProps } from 'react'; import MarkdownText from '../../MarkdownText'; import { ActionAttachment } from './ActionAttachtment'; -import AttachmentAuthor from './Attachment/Author'; -import AttachmentAuthorAvatar from './Attachment/AuthorAvatar'; -import AttachmentAuthorName from './Attachment/AuthorName'; -import AttachmentBlock from './Attachment/Block'; -import AttachmentContent from './Attachment/Content'; -import AttachmentRow from './Attachment/Row'; -import AttachmentText from './Attachment/Text'; -import AttachmentThumb from './Attachment/Thumb'; -import AttachmentTitle from './Attachment/Title'; +import AttachmentAuthor from './Attachment/AttachmentAuthor'; +import AttachmentAuthorAvatar from './Attachment/AttachmentAuthorAvatar'; +import AttachmentAuthorName from './Attachment/AttachmentAuthorName'; +import AttachmentBlock from './Attachment/AttachmentBlock'; +import AttachmentContent from './Attachment/AttachmentContent'; +import AttachmentRow from './Attachment/AttachmentRow'; +import AttachmentText from './Attachment/AttachmentText'; +import AttachmentThumb from './Attachment/AttachmentThumb'; +import AttachmentTitle from './Attachment/AttachmentTitle'; import FieldsAttachment from './FieldsAttachment'; import AttachmentImage from './components/Image'; import { useCollapse } from './hooks/useCollapse'; diff --git a/apps/meteor/client/components/message/Attachments/Files/AudioAttachment.tsx b/apps/meteor/client/components/message/Attachments/Files/AudioAttachment.tsx index 768e965beaa3..d8d63747cd37 100644 --- a/apps/meteor/client/components/message/Attachments/Files/AudioAttachment.tsx +++ b/apps/meteor/client/components/message/Attachments/Files/AudioAttachment.tsx @@ -4,12 +4,12 @@ import React, { FC } from 'react'; import MarkdownText from '../../../MarkdownText'; import Attachment from '../Attachment'; -import AttachmentContent from '../Attachment/Content'; -import AttachmentDescription from '../Attachment/Description'; -import AttachmentDownload from '../Attachment/Download'; -import AttachmentRow from '../Attachment/Row'; -import AttachmentSize from '../Attachment/Size'; -import AttachmentTitle from '../Attachment/Title'; +import AttachmentContent from '../Attachment/AttachmentContent'; +import AttachmentDescription from '../Attachment/AttachmentDescription'; +import AttachmentDownload from '../Attachment/AttachmentDownload'; +import AttachmentRow from '../Attachment/AttachmentRow'; +import AttachmentSize from '../Attachment/AttachmentSize'; +import AttachmentTitle from '../Attachment/AttachmentTitle'; import { useCollapse } from '../hooks/useCollapse'; export const AudioAttachment: FC = ({ diff --git a/apps/meteor/client/components/message/Attachments/Files/GenericFileAttachment.tsx b/apps/meteor/client/components/message/Attachments/Files/GenericFileAttachment.tsx index 56a8ea2f5dd6..5cffc1016c8e 100644 --- a/apps/meteor/client/components/message/Attachments/Files/GenericFileAttachment.tsx +++ b/apps/meteor/client/components/message/Attachments/Files/GenericFileAttachment.tsx @@ -4,12 +4,12 @@ import React, { FC } from 'react'; import MarkdownText from '../../../MarkdownText'; import Attachment from '../Attachment'; -import AttachmentDescription from '../Attachment/Description'; -import AttachmentDownload from '../Attachment/Download'; -import AttachmentRow from '../Attachment/Row'; -import AttachmentSize from '../Attachment/Size'; -import AttachmentTitle from '../Attachment/Title'; -import AttachmentTitleLink from '../Attachment/TitleLink'; +import AttachmentDescription from '../Attachment/AttachmentDescription'; +import AttachmentDownload from '../Attachment/AttachmentDownload'; +import AttachmentRow from '../Attachment/AttachmentRow'; +import AttachmentSize from '../Attachment/AttachmentSize'; +import AttachmentTitle from '../Attachment/AttachmentTitle'; +import AttachmentTitleLink from '../Attachment/AttachmentTitleLink'; export type GenericFileAttachmentProps = { file?: FileProp; diff --git a/apps/meteor/client/components/message/Attachments/Files/ImageAttachment.tsx b/apps/meteor/client/components/message/Attachments/Files/ImageAttachment.tsx index 6aaad2c982f8..0665c1b232ca 100644 --- a/apps/meteor/client/components/message/Attachments/Files/ImageAttachment.tsx +++ b/apps/meteor/client/components/message/Attachments/Files/ImageAttachment.tsx @@ -4,12 +4,12 @@ import React, { FC } from 'react'; import MarkdownText from '../../../MarkdownText'; import Attachment from '../Attachment'; -import AttachmentContent from '../Attachment/Content'; -import AttachmentDescription from '../Attachment/Description'; -import AttachmentDownload from '../Attachment/Download'; -import AttachmentRow from '../Attachment/Row'; -import AttachmentSize from '../Attachment/Size'; -import AttachmentTitle from '../Attachment/Title'; +import AttachmentContent from '../Attachment/AttachmentContent'; +import AttachmentDescription from '../Attachment/AttachmentDescription'; +import AttachmentDownload from '../Attachment/AttachmentDownload'; +import AttachmentRow from '../Attachment/AttachmentRow'; +import AttachmentSize from '../Attachment/AttachmentSize'; +import AttachmentTitle from '../Attachment/AttachmentTitle'; import Image from '../components/Image'; import { useCollapse } from '../hooks/useCollapse'; import { useLoadImage } from '../hooks/useLoadImage'; diff --git a/apps/meteor/client/components/message/Attachments/Files/VideoAttachment.tsx b/apps/meteor/client/components/message/Attachments/Files/VideoAttachment.tsx index 16ccf39253cd..a2b6327f9b7b 100644 --- a/apps/meteor/client/components/message/Attachments/Files/VideoAttachment.tsx +++ b/apps/meteor/client/components/message/Attachments/Files/VideoAttachment.tsx @@ -5,12 +5,12 @@ import React, { FC } from 'react'; import MarkdownText from '../../../MarkdownText'; import Attachment from '../Attachment'; -import AttachmentContent from '../Attachment/Content'; -import AttachmentDetails from '../Attachment/Details'; -import AttachmentDownload from '../Attachment/Download'; -import AttachmentRow from '../Attachment/Row'; -import AttachmentSize from '../Attachment/Size'; -import AttachmentTitle from '../Attachment/Title'; +import AttachmentContent from '../Attachment/AttachmentContent'; +import AttachmentDetails from '../Attachment/AttachmentDetails'; +import AttachmentDownload from '../Attachment/AttachmentDownload'; +import AttachmentRow from '../Attachment/AttachmentRow'; +import AttachmentSize from '../Attachment/AttachmentSize'; +import AttachmentTitle from '../Attachment/AttachmentTitle'; import { useCollapse } from '../hooks/useCollapse'; export const VideoAttachment: FC = ({ diff --git a/apps/meteor/client/components/message/Attachments/QuoteAttachment.tsx b/apps/meteor/client/components/message/Attachments/QuoteAttachment.tsx index e22e83346d1e..2ef7f40ca839 100644 --- a/apps/meteor/client/components/message/Attachments/QuoteAttachment.tsx +++ b/apps/meteor/client/components/message/Attachments/QuoteAttachment.tsx @@ -7,12 +7,12 @@ import React, { FC } from 'react'; import Attachments from '.'; import { useTimeAgo } from '../../../hooks/useTimeAgo'; import MarkdownText from '../../MarkdownText'; -import AttachmentAuthor from './Attachment/Author'; -import AttachmentAuthorAvatar from './Attachment/AuthorAvatar'; -import AttachmentAuthorName from './Attachment/AuthorName'; -import AttachmentContent from './Attachment/Content'; -import AttachmentDetails from './Attachment/Details'; -import AttachmentInner from './Attachment/Inner'; +import AttachmentAuthor from './Attachment/AttachmentAuthor'; +import AttachmentAuthorAvatar from './Attachment/AttachmentAuthorAvatar'; +import AttachmentAuthorName from './Attachment/AttachmentAuthorName'; +import AttachmentContent from './Attachment/AttachmentContent'; +import AttachmentDetails from './Attachment/AttachmentDetails'; +import AttachmentInner from './Attachment/AttachmentInner'; const hover = css` &:hover, diff --git a/apps/meteor/client/components/message/Attachments/hooks/useCollapse.tsx b/apps/meteor/client/components/message/Attachments/hooks/useCollapse.tsx index d2899be1bcbf..56bb1b7ffa93 100644 --- a/apps/meteor/client/components/message/Attachments/hooks/useCollapse.tsx +++ b/apps/meteor/client/components/message/Attachments/hooks/useCollapse.tsx @@ -2,7 +2,7 @@ import { useToggle } from '@rocket.chat/fuselage-hooks'; import { useAttachmentIsCollapsedByDefault } from '@rocket.chat/ui-contexts'; import React from 'react'; -import AttachmentCollapse from '../Attachment/Collapse'; +import AttachmentCollapse from '../Attachment/AttachmentCollapse'; export const useCollapse = (attachmentCollapsed: boolean): [boolean, JSX.Element] => { const collpaseByDefault = useAttachmentIsCollapsedByDefault(); From 8c4575d49cefcec7996ae9048c90bc73f66fe489 Mon Sep 17 00:00:00 2001 From: gabriellsh Date: Tue, 7 Jun 2022 10:49:28 -0300 Subject: [PATCH 4/4] Fix type --- .../message/Attachments/Attachment/AttachmentAuthorAvatar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorAvatar.tsx b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorAvatar.tsx index fe7f11e22520..ff37bbaa6708 100644 --- a/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorAvatar.tsx +++ b/apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorAvatar.tsx @@ -1,7 +1,7 @@ -import React, { FC } from 'react'; +import React, { ReactElement } from 'react'; import BaseAvatar from '../../../avatar/BaseAvatar'; -const AttachmentAuthorAvatar: FC<{ url: string }> = ({ url }) => ; +const AttachmentAuthorAvatar = ({ url }: { url: string }): ReactElement => ; export default AttachmentAuthorAvatar;