Merge pull request #2807 from yougotwill/fix/no-ref/selected_message_shadow

Fix/no ref/selected message shadow
pull/2817/head
Audric Ackermann 2 years ago committed by GitHub
commit 5e6abcd9c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1048,6 +1048,9 @@
} }
// Module H5AudioPlayer // Module H5AudioPlayer
$rhap_background-color: var(--transparent-color) !default;
$rhap_font-family: inherit !default;
.module-message__container--outgoing { .module-message__container--outgoing {
.rhap_container { .rhap_container {
background-color: var(--message-bubbles-sent-background-color); background-color: var(--message-bubbles-sent-background-color);

@ -254,135 +254,3 @@
} }
} }
} }
/* ************ */
/* AUDIO PLAYER */
/* ************ */
$rhap_background-color: var(--transparent-color) !default;
$rhap_font-family: inherit !default;
.rhap_container,
.rhap_container button,
.rhap_progress-container {
outline: none;
}
.rhap_progress-container {
margin: 0 0 0 calc(10px + 1%);
}
.rhap_container {
min-width: 220px;
padding: 0px;
background-color: transparent;
box-shadow: none;
padding: var(--padding-message-content);
border-radius: var(--border-radius-message-box);
svg {
transition: fill var(--default-duration);
}
}
.rhap_total-time {
display: none;
}
.rhap_current-time {
margin: 0 5px 0 4px;
flex-shrink: 0;
}
.rhap_play-pause-button {
display: flex;
justify-content: center;
align-items: center;
}
.rhap_volume-bar {
display: none;
}
.rhap_volume-button {
.module-message__container--incoming & {
color: var(--message-bubbles-received-text-color);
}
.module-message__container--outgoing & {
color: var(--message-bubbles-sent-text-color);
}
}
.rhap_volume-container div[role='progressbar'] {
display: none;
}
.rhap_time {
.module-message__container--incoming & {
color: var(--message-bubbles-received-text-color);
}
.module-message__container--outgoing & {
color: var(--message-bubbles-sent-text-color);
}
font-size: 12px;
}
.rhap_progress-bar {
box-sizing: border-box;
position: relative;
z-index: 0;
width: 100%;
height: 5px;
border-radius: 2px;
}
.rhap_progress-filled {
padding-left: 5px;
}
.rhap_download-progress {
height: 100%;
position: absolute;
z-index: 1;
border-radius: 2px;
}
.rhap_progress-indicator {
z-index: 3;
width: 15px;
height: 15px;
top: -5px;
margin-left: -10px;
box-shadow: rgba(0, 0, 0, 0.5) 0 0 5px !important;
}
.rhap_controls-section {
display: flex;
justify-content: space-between;
align-items: center;
}
.rhap_additional-controls {
display: none;
}
.rhap_play-pause-button {
width: unset;
height: unset;
}
.rhap_controls-section {
flex: unset;
justify-content: flex-start;
}
.rhap_volume-button {
font-size: 20px;
width: 20px;
height: 20px;
margin-right: 0px;
}
/* **************** */
/* END AUDIO PLAYER */
/* **************** */

@ -25,6 +25,128 @@ const StyledSpeedButton = styled.div`
} }
`; `;
export const StyledH5AudioPlayer = styled(H5AudioPlayer)`
&.rhap_container {
min-width: 220px;
padding: 0px;
outline: none;
padding: var(--padding-message-content);
border-radius: var(--border-radius-message-box);
svg {
transition: fill var(--default-duration);
}
button {
outline: none;
}
}
.rhap_progress-container {
margin: 0 0 0 calc(10px + 1%);
outline: none;
}
.rhap_total-time {
display: none;
}
.rhap_current-time {
margin: 0 5px 0 4px;
flex-shrink: 0;
}
.rhap_play-pause-button {
display: flex;
justify-content: center;
align-items: center;
}
.rhap_volume-bar {
display: none;
}
.rhap_volume-button {
.module-message__container--incoming & {
color: var(--message-bubbles-received-text-color);
}
.module-message__container--outgoing & {
color: var(--message-bubbles-sent-text-color);
}
}
.rhap_volume-container div[role='progressbar'] {
display: none;
}
.rhap_time {
.module-message__container--incoming & {
color: var(--message-bubbles-received-text-color);
}
.module-message__container--outgoing & {
color: var(--message-bubbles-sent-text-color);
}
font-size: 12px;
}
.rhap_progress-bar {
box-sizing: border-box;
position: relative;
z-index: 0;
width: 100%;
height: 5px;
border-radius: 2px;
}
.rhap_progress-filled {
padding-left: 5px;
}
.rhap_download-progress {
height: 100%;
position: absolute;
z-index: 1;
border-radius: 2px;
}
.rhap_progress-indicator {
z-index: 3;
width: 15px;
height: 15px;
top: -5px;
margin-left: -10px;
box-shadow: rgba(0, 0, 0, 0.5) 0 0 5px !important;
}
.rhap_controls-section {
display: flex;
justify-content: space-between;
align-items: center;
}
.rhap_additional-controls {
display: none;
}
.rhap_play-pause-button {
width: unset;
height: unset;
}
.rhap_controls-section {
flex: unset;
justify-content: flex-start;
}
.rhap_volume-button {
font-size: 20px;
width: 20px;
height: 20px;
margin-right: 0px;
}
`;
export const AudioPlayerWithEncryptedFile = (props: { export const AudioPlayerWithEncryptedFile = (props: {
src: string; src: string;
contentType: string; contentType: string;
@ -98,7 +220,7 @@ export const AudioPlayerWithEncryptedFile = (props: {
}; };
return ( return (
<H5AudioPlayer <StyledH5AudioPlayer
src={urlToLoad} src={urlToLoad}
preload="metadata" preload="metadata"
style={{ pointerEvents: multiSelectMode ? 'none' : 'inherit' }} style={{ pointerEvents: multiSelectMode ? 'none' : 'inherit' }}

@ -31,6 +31,7 @@ import { LightBoxOptions } from '../../SessionConversation';
import { ClickToTrustSender } from './ClickToTrustSender'; import { ClickToTrustSender } from './ClickToTrustSender';
import styled from 'styled-components'; import styled from 'styled-components';
import classNames from 'classnames'; import classNames from 'classnames';
import { StyledMessageHighlighter } from './MessageContent';
export type MessageAttachmentSelectorProps = Pick< export type MessageAttachmentSelectorProps = Pick<
MessageRenderingProps, MessageRenderingProps,
@ -48,10 +49,13 @@ type Props = {
messageId: string; messageId: string;
imageBroken: boolean; imageBroken: boolean;
handleImageError: () => void; handleImageError: () => void;
highlight?: boolean;
}; };
// tslint:disable: use-simple-attributes // tslint:disable: use-simple-attributes
const StyledAttachmentContainer = styled.div<{ messageDirection: MessageModelType }>` const StyledAttachmentContainer = styled.div<{
messageDirection: MessageModelType;
}>`
text-align: center; text-align: center;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
@ -61,10 +65,11 @@ const StyledAttachmentContainer = styled.div<{ messageDirection: MessageModelTyp
// tslint:disable-next-line max-func-body-length cyclomatic-complexity // tslint:disable-next-line max-func-body-length cyclomatic-complexity
export const MessageAttachment = (props: Props) => { export const MessageAttachment = (props: Props) => {
const { messageId, imageBroken, handleImageError } = props; const { messageId, imageBroken, handleImageError, highlight = false } = props;
const dispatch = useDispatch(); const dispatch = useDispatch();
const attachmentProps = useSelector(state => getMessageAttachmentProps(state as any, messageId)); const attachmentProps = useSelector(state => getMessageAttachmentProps(state as any, messageId));
const multiSelectMode = useSelector(isMessageSelectionMode); const multiSelectMode = useSelector(isMessageSelectionMode);
const onClickOnImageGrid = useCallback( const onClickOnImageGrid = useCallback(
(attachment: AttachmentTypeWithPath | AttachmentType) => { (attachment: AttachmentTypeWithPath | AttachmentType) => {
@ -116,6 +121,7 @@ export const MessageAttachment = (props: Props) => {
if (!attachments || !attachments[0]) { if (!attachments || !attachments[0]) {
return null; return null;
} }
const firstAttachment = attachments[0]; const firstAttachment = attachments[0];
const displayImage = canDisplayImage(attachments); const displayImage = canDisplayImage(attachments);
@ -130,18 +136,22 @@ export const MessageAttachment = (props: Props) => {
(isVideo(attachments) && hasVideoScreenshot(attachments))) (isVideo(attachments) && hasVideoScreenshot(attachments)))
) { ) {
return ( return (
<StyledAttachmentContainer messageDirection={direction}> <StyledMessageHighlighter highlight={highlight}>
<ImageGrid <StyledAttachmentContainer messageDirection={direction}>
attachments={attachments} <ImageGrid
onError={handleImageError} attachments={attachments}
onClickAttachment={onClickOnImageGrid} onError={handleImageError}
/> onClickAttachment={onClickOnImageGrid}
</StyledAttachmentContainer> />
</StyledAttachmentContainer>
</StyledMessageHighlighter>
); );
} }
if (!firstAttachment.pending && !firstAttachment.error && isAudio(attachments)) { if (!firstAttachment.pending && !firstAttachment.error && isAudio(attachments)) {
return ( return (
<div <StyledMessageHighlighter
highlight={highlight}
role="main" role="main"
onClick={(e: any) => { onClick={(e: any) => {
if (multiSelectMode) { if (multiSelectMode) {
@ -150,21 +160,20 @@ export const MessageAttachment = (props: Props) => {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
}} }}
style={{ padding: 'var(--margins-xs) 0px' }}
> >
<AudioPlayerWithEncryptedFile <AudioPlayerWithEncryptedFile
src={firstAttachment.url} src={firstAttachment.url}
contentType={firstAttachment.contentType} contentType={firstAttachment.contentType}
messageId={messageId} messageId={messageId}
/> />
</div> </StyledMessageHighlighter>
); );
} }
const { pending, fileName, fileSize, contentType } = firstAttachment; const { pending, fileName, fileSize, contentType } = firstAttachment;
const extension = getExtensionForDisplay({ contentType, fileName }); const extension = getExtensionForDisplay({ contentType, fileName });
return ( return (
<div className="module-message__generic-attachment"> <StyledMessageHighlighter highlight={highlight} className="module-message__generic-attachment">
{pending ? ( {pending ? (
<div className="module-message__generic-attachment__spinner-container"> <div className="module-message__generic-attachment__spinner-container">
<Spinner size="small" /> <Spinner size="small" />
@ -200,7 +209,7 @@ export const MessageAttachment = (props: Props) => {
{fileSize} {fileSize}
</div> </div>
</div> </div>
</div> </StyledMessageHighlighter>
); );
}; };

@ -62,7 +62,7 @@ const opacityAnimation = keyframes`
} }
`; `;
const StyledMessageHighlighter = styled.div<{ export const StyledMessageHighlighter = styled.div<{
highlight: boolean; highlight: boolean;
}>` }>`
${props => ${props =>
@ -187,13 +187,12 @@ export const MessageContent = (props: Props) => {
</StyledMessageOpaqueContent> </StyledMessageOpaqueContent>
)} )}
{!isDeleted && ( {!isDeleted && (
<StyledMessageHighlighter highlight={highlight}> <MessageAttachment
<MessageAttachment messageId={props.messageId}
messageId={props.messageId} imageBroken={imageBroken}
imageBroken={imageBroken} handleImageError={handleImageError}
handleImageError={handleImageError} highlight={highlight}
/> />
</StyledMessageHighlighter>
)} )}
</IsMessageVisibleContext.Provider> </IsMessageVisibleContext.Provider>
</InView> </InView>

@ -14,7 +14,11 @@ import { StyledPopupContainer } from '../reactions/ReactionPopup';
export const popupXDefault = -81; export const popupXDefault = -81;
export const popupYDefault = -90; export const popupYDefault = -90;
const StyledMessageReactionsContainer = styled(Flex)<{ x: number; y: number; noAvatar: boolean }>` export const StyledMessageReactionsContainer = styled(Flex)<{
x: number;
y: number;
noAvatar: boolean;
}>`
${StyledPopupContainer} { ${StyledPopupContainer} {
position: absolute; position: absolute;
top: ${props => `${props.y}px;`}; top: ${props => `${props.y}px;`};

@ -21,6 +21,7 @@ import { MessageContentWithStatuses } from '../message-content/MessageContentWit
import { ReadableMessage } from './ReadableMessage'; import { ReadableMessage } from './ReadableMessage';
import styled, { keyframes } from 'styled-components'; import styled, { keyframes } from 'styled-components';
import { isOpenOrClosedGroup } from '../../../../models/conversationAttributes'; import { isOpenOrClosedGroup } from '../../../../models/conversationAttributes';
import { StyledMessageReactionsContainer } from '../message-content/MessageReactions';
export type GenericReadableMessageSelectorProps = Pick< export type GenericReadableMessageSelectorProps = Pick<
MessageRenderingProps, MessageRenderingProps,
@ -118,11 +119,16 @@ const StyledReadableMessage = styled(ReadableMessage)<{
width: 100%; width: 100%;
letter-spacing: 0.03rem; letter-spacing: 0.03rem;
padding: var(--margins-xs) var(--margins-lg) 0; padding: var(--margins-xs) var(--margins-lg) 0;
margin: var(--margins-xxs) 0;
&.message-highlighted { &.message-highlighted {
animation: ${highlightedMessageAnimation} 1s ease-in-out; animation: ${highlightedMessageAnimation} 1s ease-in-out;
} }
${StyledMessageReactionsContainer} {
margin-top: var(--margins-xs);
}
${props => ${props =>
props.isRightClicked && props.isRightClicked &&
` `

@ -17,6 +17,7 @@ export type ThemeGlobals = {
'--font-size-h4': string; '--font-size-h4': string;
/* Margins */ /* Margins */
'--margins-xxs': string;
'--margins-xs': string; '--margins-xs': string;
'--margins-sm': string; '--margins-sm': string;
'--margins-md': string; '--margins-md': string;
@ -97,6 +98,7 @@ export const THEME_GLOBALS: ThemeGlobals = {
'--font-size-h3': '20px', '--font-size-h3': '20px',
'--font-size-h4': '16px', '--font-size-h4': '16px',
'--margins-xxs': '2.5px',
'--margins-xs': '5px', '--margins-xs': '5px',
'--margins-sm': '10px', '--margins-sm': '10px',
'--margins-md': '15px', '--margins-md': '15px',

Loading…
Cancel
Save