diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index 665123852b77..46d693a507dd 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -71,6 +71,9 @@ const propTypes = { ...withLocalizePropTypes, ...windowDimensionsPropTypes, + + /** Denotes whether it is a workspace avatar or not */ + isWorkspaceAvatar: PropTypes.bool, }; const defaultProps = { @@ -86,6 +89,7 @@ const defaultProps = { onModalShow: () => {}, onModalHide: () => {}, onCarouselAttachmentChange: () => {}, + isWorkspaceAvatar: false, }; function AttachmentModal(props) { @@ -345,6 +349,7 @@ function AttachmentModal(props) { isAuthTokenRequired={isAuthTokenRequired} file={file} onToggleKeyboard={updateConfirmButtonVisibility} + isWorkspaceAvatar={props.isWorkspaceAvatar} /> ) )} diff --git a/src/components/Attachments/AttachmentView/index.js b/src/components/Attachments/AttachmentView/index.js index 3ad643d34bcd..47353d915060 100755 --- a/src/components/Attachments/AttachmentView/index.js +++ b/src/components/Attachments/AttachmentView/index.js @@ -15,7 +15,7 @@ import variables from '../../../styles/variables'; import AttachmentViewImage from './AttachmentViewImage'; import AttachmentViewPdf from './AttachmentViewPdf'; import addEncryptedAuthTokenToURL from '../../../libs/addEncryptedAuthTokenToURL'; - +import * as StyleUtils from '../../../styles/StyleUtils'; import {attachmentViewPropTypes, attachmentViewDefaultProps} from './propTypes'; const propTypes = { @@ -34,6 +34,9 @@ const propTypes = { /** Extra styles to pass to View wrapper */ // eslint-disable-next-line react/forbid-prop-types containerStyles: PropTypes.arrayOf(PropTypes.object), + + /** Denotes whether it is a workspace avatar or not */ + isWorkspaceAvatar: PropTypes.bool, }; const defaultProps = { @@ -42,6 +45,7 @@ const defaultProps = { shouldShowLoadingSpinnerIcon: false, onToggleKeyboard: () => {}, containerStyles: [], + isWorkspaceAvatar: false, }; function AttachmentView({ @@ -57,16 +61,27 @@ function AttachmentView({ onToggleKeyboard, translate, isFocused, + isWorkspaceAvatar, }) { const [loadComplete, setLoadComplete] = useState(false); // Handles case where source is a component (ex: SVG) if (_.isFunction(source)) { + let iconFillColor = ''; + let additionalStyles = []; + if (isWorkspaceAvatar) { + const defaultWorkspaceAvatarColor = StyleUtils.getDefaultWorkspaceAvatarColor(file.name); + iconFillColor = defaultWorkspaceAvatarColor.fill; + additionalStyles = [defaultWorkspaceAvatarColor]; + } + return ( ); } diff --git a/src/components/RoomHeaderAvatars.js b/src/components/RoomHeaderAvatars.js index 6f78e6ace66d..af594dc2415a 100644 --- a/src/components/RoomHeaderAvatars.js +++ b/src/components/RoomHeaderAvatars.js @@ -9,6 +9,9 @@ import Avatar from './Avatar'; import themeColors from '../styles/themes/default'; import * as StyleUtils from '../styles/StyleUtils'; import avatarPropTypes from './avatarPropTypes'; +import PressableWithoutFocus from './Pressable/PressableWithoutFocus'; +import * as UserUtils from '../libs/UserUtils'; +import AttachmentModal from './AttachmentModal'; const propTypes = { icons: PropTypes.arrayOf(avatarPropTypes), @@ -25,14 +28,31 @@ function RoomHeaderAvatars(props) { if (props.icons.length === 1) { return ( - + + {({show}) => ( + + + + )} + ); } @@ -45,27 +65,45 @@ function RoomHeaderAvatars(props) { StyleUtils.getAvatarStyle(CONST.AVATAR_SIZE.LARGE_BORDERED), ]; return ( - + {_.map(iconsToDisplay, (icon, index) => ( - + + {({show}) => ( + + + + )} + {index === CONST.REPORT.MAX_PREVIEW_AVATARS - 1 && props.icons.length - CONST.REPORT.MAX_PREVIEW_AVATARS !== 0 && ( <>