From f0aeb59d54be4b8fd54abf233d2990fdb191e80f Mon Sep 17 00:00:00 2001 From: William Grant Date: Thu, 4 May 2023 16:39:57 +1000 Subject: [PATCH] feat: converted quote image to styled components remove border on quote if there is an attachment --- .../message/message-content/MessageQuote.tsx | 2 +- .../message/message-content/quote/Quote.tsx | 19 ++++++++++++------ .../message-content/quote/QuoteImage.tsx | 20 +++++++++++++++++-- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/ts/components/conversation/message/message-content/MessageQuote.tsx b/ts/components/conversation/message/message-content/MessageQuote.tsx index c99991259..7871d4ad7 100644 --- a/ts/components/conversation/message/message-content/MessageQuote.tsx +++ b/ts/components/conversation/message/message-content/MessageQuote.tsx @@ -48,7 +48,7 @@ export const MessageQuote = (props: Props) => { referencedMessageNotFound, } = quote; - const quoteText = text || window.i18n('originalMessageNotFound'); + const quoteText = text || null; const quoteNotFound = referencedMessageNotFound || false; const shortenedPubkey = PubKey.shorten(quoteAuthor); diff --git a/ts/components/conversation/message/message-content/quote/Quote.tsx b/ts/components/conversation/message/message-content/quote/Quote.tsx index 8230441af..853aa2ad3 100644 --- a/ts/components/conversation/message/message-content/quote/Quote.tsx +++ b/ts/components/conversation/message/message-content/quote/Quote.tsx @@ -11,6 +11,7 @@ import { QuoteGenericFile } from './QuoteGenericFile'; import { QuoteText } from './QuoteText'; import { QuoteIconContainer } from './QuoteIconContainer'; import styled from 'styled-components'; +import { isEmpty } from 'lodash'; export type QuotePropsWithoutListener = { attachment?: QuotedAttachmentType; @@ -54,6 +55,7 @@ function validateQuote(quote: QuotePropsWithoutListener): boolean { } const StyledQuote = styled.div<{ + hasAttachment: boolean; isIncoming: boolean; onClick: ((e: MouseEvent) => void) | undefined; }>` @@ -63,11 +65,11 @@ const StyledQuote = styled.div<{ flex-direction: row; align-items: stretch; overflow: hidden; - border-left: 4px solid - ${props => - props.isIncoming - ? 'var(--message-bubbles-received-text-color)' - : 'var(--message-bubbles-sent-text-color)'}; + ${props => !props.hasAttachment && 'border-left: 4px solid;'} + border-color: ${props => + props.isIncoming + ? 'var(--message-bubbles-received-text-color)' + : 'var(--message-bubbles-sent-text-color)'}; cursor: ${props => (props.onClick ? 'pointer' : 'auto')}; `; @@ -87,7 +89,12 @@ export const Quote = (props: QuotePropsWithListener) => { return (
- + void; @@ -29,7 +45,7 @@ export const QuoteImage = (props: { ) : null; return ( -
+ {window.i18n('quoteThumbnailAlt')} {iconElement} -
+ ); };