feat: add drop shadow to all selected message elements

pull/3020/head
William Grant 2 years ago
parent bec62bca3e
commit 3512e60726

@ -69,6 +69,10 @@
color: var(--message-bubbles-received-text-color); color: var(--message-bubbles-received-text-color);
background: var(--message-bubbles-received-background-color); background: var(--message-bubbles-received-background-color);
} }
&.message-selected {
box-shadow: var(--drop-shadow);
}
} }
.module-message__generic-attachment__icon-container { .module-message__generic-attachment__icon-container {

@ -5,6 +5,7 @@ import { useDispatch, useSelector } from 'react-redux';
import styled from 'styled-components'; import styled from 'styled-components';
import { useEncryptedFileFetch } from '../../hooks/useEncryptedFileFetch'; import { useEncryptedFileFetch } from '../../hooks/useEncryptedFileFetch';
import { setNextMessageToPlayId } from '../../state/ducks/conversations'; import { setNextMessageToPlayId } from '../../state/ducks/conversations';
import { useMessageSelected } from '../../state/selectors';
import { import {
getNextMessageToPlayId, getNextMessageToPlayId,
getSortedMessagesOfSelectedConversation, getSortedMessagesOfSelectedConversation,
@ -25,7 +26,7 @@ const StyledSpeedButton = styled.div`
} }
`; `;
export const StyledH5AudioPlayer = styled(H5AudioPlayer)` export const StyledH5AudioPlayer = styled(H5AudioPlayer)<{ dropShadow?: boolean }>`
&.rhap_container { &.rhap_container {
min-width: 220px; min-width: 220px;
padding: 0px; padding: 0px;
@ -145,6 +146,8 @@ export const StyledH5AudioPlayer = styled(H5AudioPlayer)`
height: 20px; height: 20px;
margin-right: 0px; margin-right: 0px;
} }
${props => props.dropShadow && 'box-shadow: var(--drop-shadow);'}
`; `;
export const AudioPlayerWithEncryptedFile = (props: { export const AudioPlayerWithEncryptedFile = (props: {
@ -162,6 +165,7 @@ export const AudioPlayerWithEncryptedFile = (props: {
const messageProps = useSelector(getSortedMessagesOfSelectedConversation); const messageProps = useSelector(getSortedMessagesOfSelectedConversation);
const nextMessageToPlayId = useSelector(getNextMessageToPlayId); const nextMessageToPlayId = useSelector(getNextMessageToPlayId);
const multiSelectMode = useSelector(isMessageSelectionMode); const multiSelectMode = useSelector(isMessageSelectionMode);
const selected = useMessageSelected(messageId);
const dataTestId = `audio-${messageId}`; const dataTestId = `audio-${messageId}`;
@ -263,6 +267,7 @@ export const AudioPlayerWithEncryptedFile = (props: {
play: <SessionIcon iconType="play" iconSize="small" />, play: <SessionIcon iconType="play" iconSize="small" />,
pause: <SessionIcon iconType="pause" iconSize="small" />, pause: <SessionIcon iconType="pause" iconSize="small" />,
}} }}
dropShadow={selected}
/> />
); );
}; };

@ -11,6 +11,7 @@ import {
toggleSelectedMessageId, toggleSelectedMessageId,
} from '../../../../state/ducks/conversations'; } from '../../../../state/ducks/conversations';
import { StateType } from '../../../../state/reducer'; import { StateType } from '../../../../state/reducer';
import { useMessageSelected } from '../../../../state/selectors';
import { import {
getMessageAttachmentProps, getMessageAttachmentProps,
isMessageSelectionMode, isMessageSelectionMode,
@ -72,6 +73,7 @@ export const MessageAttachment = (props: Props) => {
); );
const multiSelectMode = useSelector(isMessageSelectionMode); const multiSelectMode = useSelector(isMessageSelectionMode);
const selected = useMessageSelected(messageId);
const onClickOnImageGrid = useCallback( const onClickOnImageGrid = useCallback(
(attachment: AttachmentTypeWithPath | AttachmentType) => { (attachment: AttachmentTypeWithPath | AttachmentType) => {
if (multiSelectMode) { if (multiSelectMode) {
@ -176,7 +178,13 @@ export const MessageAttachment = (props: Props) => {
const extension = getExtensionForDisplay({ contentType, fileName }); const extension = getExtensionForDisplay({ contentType, fileName });
return ( return (
<MessageHighlighter highlight={highlight} className="module-message__generic-attachment"> <MessageHighlighter
highlight={highlight}
className={classNames(
'module-message__generic-attachment',
selected ? 'message-selected' : undefined
)}
>
{pending ? ( {pending ? (
<div className="module-message__generic-attachment__spinner-container"> <div className="module-message__generic-attachment__spinner-container">
<Spinner size="small" /> <Spinner size="small" />

Loading…
Cancel
Save