Merge pull request #2452 from Bilb/make-all-message-bubbles-rounded

fix: disable having some corner large and small for message bubbles
pull/2455/head
Audric Ackermann 3 years ago committed by GitHub
commit 2a94f54039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -88,6 +88,8 @@ export const Image = (props: Props) => {
style={{ style={{
maxHeight: `${height}px`, maxHeight: `${height}px`,
maxWidth: `${width}px`, maxWidth: `${width}px`,
minHeight: `${height}px`,
minWidth: `${width}px`,
}} }}
data-attachmentindex={attachmentIndex} data-attachmentindex={attachmentIndex}
> >
@ -116,6 +118,8 @@ export const Image = (props: Props) => {
style={{ style={{
maxHeight: `${height}px`, maxHeight: `${height}px`,
maxWidth: `${width}px`, maxWidth: `${width}px`,
minHeight: `${height}px`,
minWidth: `${width}px`,
width: forceSquare ? `${width}px` : '', width: forceSquare ? `${width}px` : '',
height: forceSquare ? `${height}px` : '', height: forceSquare ? `${height}px` : '',
}} }}

@ -1,4 +1,4 @@
import React, { useCallback } from 'react'; import React from 'react';
import { SessionIcon, SessionIconButton } from '../icon'; import { SessionIcon, SessionIconButton } from '../icon';
import styled from 'styled-components'; import styled from 'styled-components';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
@ -8,6 +8,8 @@ import { getAlt, isAudio } from '../../types/Attachment';
import { AUDIO_MP3 } from '../../types/MIME'; import { AUDIO_MP3 } from '../../types/MIME';
import { Flex } from '../basic/Flex'; import { Flex } from '../basic/Flex';
import { Image } from '../../../ts/components/conversation/Image'; import { Image } from '../../../ts/components/conversation/Image';
// tslint:disable-next-line: no-submodule-imports
import useKey from 'react-use/lib/useKey';
const QuotedMessageComposition = styled.div` const QuotedMessageComposition = styled.div`
width: 100%; width: 100%;
@ -58,9 +60,11 @@ export const SessionQuotedMessageComposition = () => {
const hasAudioAttachment = const hasAudioAttachment =
hasAttachments && attachments && attachments.length > 0 && isAudio(attachments); hasAttachments && attachments && attachments.length > 0 && isAudio(attachments);
const removeQuotedMessage = useCallback(() => { const removeQuotedMessage = () => {
dispatch(quoteMessage(undefined)); dispatch(quoteMessage(undefined));
}, []); };
useKey('Escape', removeQuotedMessage, undefined, []);
if (!quotedMessageProps?.id) { if (!quotedMessageProps?.id) {
return null; return null;

@ -32,15 +32,7 @@ import styled from 'styled-components';
export type MessageContentSelectorProps = Pick< export type MessageContentSelectorProps = Pick<
MessageRenderingProps, MessageRenderingProps,
| 'text' 'text' | 'direction' | 'timestamp' | 'serverTimestamp' | 'previews' | 'quote' | 'attachments'
| 'direction'
| 'timestamp'
| 'serverTimestamp'
| 'firstMessageOfSeries'
| 'lastMessageOfSeries'
| 'previews'
| 'quote'
| 'attachments'
>; >;
type Props = { type Props = {
@ -96,22 +88,8 @@ function onClickOnMessageInnerContainer(event: React.MouseEvent<HTMLDivElement>)
} }
} }
const radiusLg = '18px'; const StyledMessageContent = styled.div`
const radiusSm = '4px'; border-radius: 18px;
const StyledMessageContent = styled.div<{
isOutgoing: boolean;
firstOfSeries: boolean;
lastOfSeries: boolean;
}>`
border-top-right-radius: ${props =>
props.isOutgoing ? (props.firstOfSeries ? `${radiusLg}` : `${radiusSm}`) : `${radiusLg}`};
border-bottom-right-radius: ${props =>
props.isOutgoing ? (props.lastOfSeries ? `${radiusLg}` : `${radiusSm}`) : `${radiusLg}`};
border-top-left-radius: ${props =>
!props.isOutgoing ? (props.firstOfSeries ? `${radiusLg}` : `${radiusSm}`) : `${radiusLg}`};
border-bottom-left-radius: ${props =>
!props.isOutgoing ? (props.lastOfSeries ? `${radiusLg}` : `${radiusSm}`) : `${radiusLg}`};
`; `;
export const IsMessageVisibleContext = createContext(false); export const IsMessageVisibleContext = createContext(false);
@ -178,8 +156,6 @@ export const MessageContent = (props: Props) => {
text, text,
timestamp, timestamp,
serverTimestamp, serverTimestamp,
firstMessageOfSeries,
lastMessageOfSeries,
previews, previews,
quote, quote,
attachments, attachments,
@ -216,9 +192,6 @@ export const MessageContent = (props: Props) => {
style={{ style={{
width: isShowingImage ? width : undefined, width: isShowingImage ? width : undefined,
}} }}
firstOfSeries={Boolean(firstMessageOfSeries || props.isDetailView)}
lastOfSeries={Boolean(lastMessageOfSeries || props.isDetailView)}
isOutgoing={direction === 'outgoing'}
role="button" role="button"
onClick={onClickOnMessageInnerContainer} onClick={onClickOnMessageInnerContainer}
title={toolTipTitle} title={toolTipTitle}
@ -246,7 +219,7 @@ export const MessageContent = (props: Props) => {
{!isDeleted && ( {!isDeleted && (
<MessagePreview messageId={props.messageId} handleImageError={handleImageError} /> <MessagePreview messageId={props.messageId} handleImageError={handleImageError} />
)} )}
<Flex padding="7px" container={true} flexDirection="column"> <Flex padding="7px 13px" container={true} flexDirection="column">
<MessageText messageId={props.messageId} /> <MessageText messageId={props.messageId} />
</Flex> </Flex>
</> </>

@ -1089,8 +1089,6 @@ export const getMessageContentSelectorProps = createSelector(getMessagePropsByMe
} }
const msgProps: MessageContentSelectorProps = { const msgProps: MessageContentSelectorProps = {
firstMessageOfSeries: props.firstMessageOfSeries,
lastMessageOfSeries: props.lastMessageOfSeries,
...pick(props.propsForMessage, [ ...pick(props.propsForMessage, [
'direction', 'direction',
'serverTimestamp', 'serverTimestamp',

Loading…
Cancel
Save