|
|
|
@ -12,6 +12,7 @@ import { Image } from '../../../ts/components/conversation/Image';
|
|
|
|
|
import useKey from 'react-use/lib/useKey';
|
|
|
|
|
import { getAbsoluteAttachmentPath } from '../../types/MessageAttachment';
|
|
|
|
|
import { GoogleChrome } from '../../util';
|
|
|
|
|
import { findAndFormatContact } from '../../models/message';
|
|
|
|
|
|
|
|
|
|
const QuotedMessageComposition = styled(Flex)`
|
|
|
|
|
border-top: 1px solid var(--border-color);
|
|
|
|
@ -47,12 +48,24 @@ const StyledText = styled(Flex)`
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
export const SessionQuotedMessageComposition = () => {
|
|
|
|
|
const quotedMessageProps = useSelector(getQuotedMessage);
|
|
|
|
|
|
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
const quotedMessageProps = useSelector(getQuotedMessage);
|
|
|
|
|
|
|
|
|
|
const { author, attachments, text: quoteText } = quotedMessageProps || {};
|
|
|
|
|
|
|
|
|
|
const removeQuotedMessage = () => {
|
|
|
|
|
dispatch(quoteMessage(undefined));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
useKey('Escape', removeQuotedMessage, undefined, []);
|
|
|
|
|
|
|
|
|
|
if (!author || !quotedMessageProps?.id) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const contact = findAndFormatContact(author);
|
|
|
|
|
const authorName = contact?.profileName || contact?.name || author || window.i18n('unknown');
|
|
|
|
|
|
|
|
|
|
const hasAttachments = attachments && attachments.length > 0 && attachments[0];
|
|
|
|
|
const firstImageAttachment =
|
|
|
|
|
hasAttachments && attachments[0].contentType !== AUDIO_MP3 && attachments[0].thumbnail
|
|
|
|
@ -80,16 +93,6 @@ export const SessionQuotedMessageComposition = () => {
|
|
|
|
|
? window.i18n('image')
|
|
|
|
|
: null;
|
|
|
|
|
|
|
|
|
|
const removeQuotedMessage = () => {
|
|
|
|
|
dispatch(quoteMessage(undefined));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
useKey('Escape', removeQuotedMessage, undefined, []);
|
|
|
|
|
|
|
|
|
|
if (!author || !quotedMessageProps?.id) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<QuotedMessageComposition
|
|
|
|
|
container={true}
|
|
|
|
@ -129,7 +132,7 @@ export const SessionQuotedMessageComposition = () => {
|
|
|
|
|
justifyContent={'center'}
|
|
|
|
|
alignItems={'flex-start'}
|
|
|
|
|
>
|
|
|
|
|
<p>{author}</p>
|
|
|
|
|
<p>{authorName}</p>
|
|
|
|
|
{subtitleText && <Subtle>{subtitleText}</Subtle>}
|
|
|
|
|
</StyledText>
|
|
|
|
|
</QuotedMessageCompositionReply>
|
|
|
|
|