fix: quote author in message info will now wrap

otherwise it causes the message bubble to overflow
pull/3055/head
William Grant 1 year ago committed by Audric Ackermann
parent 8cb6b3099b
commit 500f994d5d

@ -192,7 +192,7 @@ export const MessageContent = (props: Props) => {
>
{!isDeleted && (
<>
<MessageQuote messageId={props.messageId} />
<MessageQuote messageId={props.messageId} isDetailView={props.isDetailView} />
<MessageLinkPreview
messageId={props.messageId}
handleImageError={handleImageError}

@ -12,6 +12,7 @@ import { Quote } from './quote/Quote';
type Props = {
messageId: string;
isDetailView?: boolean;
};
export type MessageQuoteSelectorProps = Pick<MessageRenderingProps, 'quote' | 'direction'>;
@ -97,6 +98,7 @@ export const MessageQuote = (props: Props) => {
author={quote.author}
referencedMessageNotFound={quoteNotFound}
isFromMe={Boolean(quote.isFromMe)}
isDetailView={props.isDetailView}
/>
);
};

@ -3,10 +3,10 @@ import React, { MouseEvent, useState } from 'react';
import { isEmpty } from 'lodash';
import styled from 'styled-components';
import { useIsMessageSelectionMode } from '../../../../../state/selectors/selectedConversation';
import * as MIME from '../../../../../types/MIME';
import { QuoteAuthor } from './QuoteAuthor';
import { QuoteIconContainer } from './QuoteIconContainer';
import { QuoteText } from './QuoteText';
import * as MIME from '../../../../../types/MIME';
const StyledQuoteContainer = styled.div`
min-width: 300px; // if the quoted content is small it doesn't look very good so we set a minimum
@ -50,6 +50,7 @@ export type QuoteProps = {
referencedMessageNotFound: boolean;
text?: string;
attachment?: QuotedAttachmentType;
isDetailView?: boolean;
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
};
@ -70,7 +71,7 @@ export interface QuotedAttachmentType {
export const Quote = (props: QuoteProps) => {
const isSelectionMode = useIsMessageSelectionMode();
const { isIncoming, attachment, text, referencedMessageNotFound, onClick } = props;
const { isIncoming, attachment, text, isDetailView, referencedMessageNotFound, onClick } = props;
const [imageBroken, setImageBroken] = useState(false);
const handleImageErrorBound = () => {
@ -95,7 +96,7 @@ export const Quote = (props: QuoteProps) => {
referencedMessageNotFound={referencedMessageNotFound}
/>
<StyledQuoteTextContent>
<QuoteAuthor author={props.author} isIncoming={isIncoming} />
<QuoteAuthor author={props.author} isIncoming={isIncoming} isDetailView={isDetailView} />
<QuoteText
isIncoming={isIncoming}
text={text}

@ -2,11 +2,11 @@ import React from 'react';
import styled from 'styled-components';
import { useQuoteAuthorName } from '../../../../../hooks/useParamSelector';
import { PubKey } from '../../../../../session/types';
import { useSelectedIsPublic } from '../../../../../state/selectors/selectedConversation';
import { ContactName } from '../../../ContactName';
import { QuoteProps } from './Quote';
import { useSelectedIsPublic } from '../../../../../state/selectors/selectedConversation';
const StyledQuoteAuthor = styled.div<{ isIncoming: boolean }>`
const StyledQuoteAuthor = styled.div<{ isIncoming: boolean; isDetailView?: boolean }>`
color: ${props =>
props.isIncoming
? 'var(--message-bubbles-received-text-color)'
@ -16,17 +16,17 @@ const StyledQuoteAuthor = styled.div<{ isIncoming: boolean }>`
line-height: 18px;
margin-bottom: 2px;
overflow-x: hidden;
white-space: nowrap;
white-space: ${props => (props.isDetailView ? undefined : 'nowrap')};
text-overflow: ellipsis;
.module-contact-name {
font-weight: bold;
}
`;
type QuoteAuthorProps = Pick<QuoteProps, 'author' | 'isIncoming'>;
type QuoteAuthorProps = Pick<QuoteProps, 'author' | 'isIncoming'> & { isDetailView?: boolean };
export const QuoteAuthor = (props: QuoteAuthorProps) => {
const { author, isIncoming } = props;
const { author, isIncoming, isDetailView } = props;
const isPublic = useSelectedIsPublic();
const { authorName, isMe } = useQuoteAuthorName(author);
@ -36,7 +36,7 @@ export const QuoteAuthor = (props: QuoteAuthorProps) => {
}
return (
<StyledQuoteAuthor isIncoming={isIncoming}>
<StyledQuoteAuthor isIncoming={isIncoming} isDetailView={isDetailView}>
<ContactName
pubkey={PubKey.shorten(author)}
name={authorName}

Loading…
Cancel
Save