From bdbdb477daa4ca89c5ebad1c6e15b4394070f7ad Mon Sep 17 00:00:00 2001 From: William Grant Date: Thu, 4 May 2023 16:55:20 +1000 Subject: [PATCH] feat: pass in all props to quote component converted quote primary text to styled components --- .../message/message-content/MessageQuote.tsx | 11 +++++------ .../message/message-content/quote/Quote.tsx | 12 +++++++++--- .../message/message-content/quote/QuoteAuthor.tsx | 2 +- .../message/message-content/quote/QuoteText.tsx | 3 ++- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ts/components/conversation/message/message-content/MessageQuote.tsx b/ts/components/conversation/message/message-content/MessageQuote.tsx index 7871d4ad7..3b4fc3798 100644 --- a/ts/components/conversation/message/message-content/MessageQuote.tsx +++ b/ts/components/conversation/message/message-content/MessageQuote.tsx @@ -39,8 +39,7 @@ export const MessageQuote = (props: Props) => { const { text, attachment, - // TODO - // isFromMe, + isFromMe, sender: quoteAuthor, authorProfileName, authorName, @@ -106,10 +105,10 @@ export const MessageQuote = (props: Props) => { attachment={attachment} isIncoming={direction === 'incoming'} sender={displayedPubkey} - authorProfileName={quote.authorProfileName} - authorName={quote.authorName} - referencedMessageNotFound={quote.referencedMessageNotFound || false} - isFromMe={quote.isFromMe || false} + authorProfileName={authorProfileName} + authorName={authorName} + referencedMessageNotFound={referencedMessageNotFound || false} + isFromMe={isFromMe || false} /> ); }; diff --git a/ts/components/conversation/message/message-content/quote/Quote.tsx b/ts/components/conversation/message/message-content/quote/Quote.tsx index 853aa2ad3..f7453b2bb 100644 --- a/ts/components/conversation/message/message-content/quote/Quote.tsx +++ b/ts/components/conversation/message/message-content/quote/Quote.tsx @@ -73,6 +73,13 @@ const StyledQuote = styled.div<{ cursor: ${props => (props.onClick ? 'pointer' : 'auto')}; `; +const StyledQuoteTextContent = styled.div` + flex-grow: 1; + padding-inline-start: 10px; + padding-inline-end: 10px; + max-width: 100%; +`; + export const Quote = (props: QuotePropsWithListener) => { const [imageBroken, setImageBroken] = useState(false); const handleImageErrorBound = () => { @@ -93,14 +100,13 @@ export const Quote = (props: QuotePropsWithListener) => { hasAttachment={Boolean(!isEmpty(attachment))} isIncoming={isIncoming} onClick={onClick} - role="button" > -
+ { /> -
+ ); diff --git a/ts/components/conversation/message/message-content/quote/QuoteAuthor.tsx b/ts/components/conversation/message/message-content/quote/QuoteAuthor.tsx index 5dd24f1ab..434b23559 100644 --- a/ts/components/conversation/message/message-content/quote/QuoteAuthor.tsx +++ b/ts/components/conversation/message/message-content/quote/QuoteAuthor.tsx @@ -11,7 +11,7 @@ const StyledQuoteAuthor = styled.div<{ isIncoming: boolean }>` font-size: 15px; font-weight: bold; line-height: 18px; - margin-bottom: 5px; + margin-bottom: 2px; overflow-x: hidden; white-space: nowrap; text-overflow: ellipsis; diff --git a/ts/components/conversation/message/message-content/quote/QuoteText.tsx b/ts/components/conversation/message/message-content/quote/QuoteText.tsx index 2329a6222..7dbf5ec63 100644 --- a/ts/components/conversation/message/message-content/quote/QuoteText.tsx +++ b/ts/components/conversation/message/message-content/quote/QuoteText.tsx @@ -7,6 +7,7 @@ import { MessageBody } from '../MessageBody'; import { MIME } from '../../../../../types'; import { GoogleChrome } from '../../../../../util'; import styled from 'styled-components'; +import { isEmpty } from 'lodash'; const StyledQuoteText = styled.div<{ isIncoming: boolean }>` display: -webkit-box; @@ -66,7 +67,7 @@ export const QuoteText = ( const convoId = useSelector(getSelectedConversationKey); const isGroup = !useIsPrivate(convoId); - if (attachment) { + if (attachment && !isEmpty(attachment)) { const { contentType, isVoiceMessage } = attachment; const typeLabel = getTypeLabel({ contentType, isVoiceMessage });