diff --git a/res/css/views/settings/_AvatarSetting.scss b/res/css/views/settings/_AvatarSetting.scss index 32ece173cc..5d3568e8b5 100644 --- a/res/css/views/settings/_AvatarSetting.scss +++ b/res/css/views/settings/_AvatarSetting.scss @@ -55,6 +55,10 @@ limitations under the License. color: $button-danger-bg-color; } + & > img { + cursor: pointer; + } + & > img, .mx_AvatarSetting_avatarPlaceholder { display: block; diff --git a/src/components/views/room_settings/RoomProfileSettings.js b/src/components/views/room_settings/RoomProfileSettings.js index ada2f093d1..2093a31a28 100644 --- a/src/components/views/room_settings/RoomProfileSettings.js +++ b/src/components/views/room_settings/RoomProfileSettings.js @@ -162,6 +162,7 @@ export default class RoomProfileSettings extends React.Component { diff --git a/src/components/views/settings/AvatarSetting.js b/src/components/views/settings/AvatarSetting.js index c6495db362..51ef3a4302 100644 --- a/src/components/views/settings/AvatarSetting.js +++ b/src/components/views/settings/AvatarSetting.js @@ -14,18 +14,34 @@ See the License for the specific language governing permissions and limitations under the License. */ -import React from "react"; +import React, {useCallback} from "react"; import PropTypes from "prop-types"; import sdk from "../../../index"; import {_t} from "../../../languageHandler"; +import Modal from "../../../Modal"; -const AvatarSetting = ({avatarUrl, avatarAltText, uploadAvatar, removeAvatar}) => { +const AvatarSetting = ({avatarUrl, avatarAltText, avatarName, uploadAvatar, removeAvatar}) => { const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); + const openImageView = useCallback(() => { + const ImageView = sdk.getComponent("elements.ImageView"); + Modal.createDialog(ImageView, { + src: avatarUrl, + name: avatarName, + }, "mx_Dialog_lightbox"); + }, [avatarUrl, avatarName]); + let avatarElement =
; if (avatarUrl) { - avatarElement = {avatarAltText}; + avatarElement = ( + + ); } let uploadAvatarBtn; @@ -53,6 +69,7 @@ const AvatarSetting = ({avatarUrl, avatarAltText, uploadAvatar, removeAvatar}) = AvatarSetting.propTypes = { avatarUrl: PropTypes.string, + avatarName: PropTypes.string.isRequired, // name of user/room the avatar belongs to uploadAvatar: PropTypes.func, removeAvatar: PropTypes.func, avatarAltText: PropTypes.string.isRequired, diff --git a/src/components/views/settings/ProfileSettings.js b/src/components/views/settings/ProfileSettings.js index f415508bba..480b414911 100644 --- a/src/components/views/settings/ProfileSettings.js +++ b/src/components/views/settings/ProfileSettings.js @@ -157,6 +157,7 @@ export default class ProfileSettings extends React.Component {