From c50565dfda50b7ebd04e3b407cdfeb98f6af68fd Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Thu, 13 Jan 2022 18:31:56 +0530 Subject: [PATCH] Open room options with right click Signed-off-by: Ajay Bura --- src/app/molecules/room-selector/RoomSelector.jsx | 11 +++++++++-- src/app/organisms/navigation/Selector.jsx | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/molecules/room-selector/RoomSelector.jsx b/src/app/molecules/room-selector/RoomSelector.jsx index 22f233f..8bd6c20 100644 --- a/src/app/molecules/room-selector/RoomSelector.jsx +++ b/src/app/molecules/room-selector/RoomSelector.jsx @@ -11,7 +11,8 @@ import NotificationBadge from '../../atoms/badge/NotificationBadge'; import { blurOnBubbling } from '../../atoms/button/script'; function RoomSelectorWrapper({ - isSelected, isUnread, onClick, content, options, + isSelected, isUnread, onClick, + content, options, onContextMenu, }) { let myClass = isUnread ? ' room-selector--unread' : ''; myClass += isSelected ? ' room-selector--selected' : ''; @@ -22,6 +23,7 @@ function RoomSelectorWrapper({ type="button" onClick={onClick} onMouseUp={(e) => blurOnBubbling(e, '.room-selector__content')} + onContextMenu={onContextMenu} > {content} @@ -31,6 +33,7 @@ function RoomSelectorWrapper({ } RoomSelectorWrapper.defaultProps = { options: null, + onContextMenu: null, }; RoomSelectorWrapper.propTypes = { isSelected: PropTypes.bool.isRequired, @@ -38,12 +41,13 @@ RoomSelectorWrapper.propTypes = { onClick: PropTypes.func.isRequired, content: PropTypes.node.isRequired, options: PropTypes.node, + onContextMenu: PropTypes.func, }; function RoomSelector({ name, parentName, roomId, imageSrc, iconSrc, isSelected, isUnread, notificationCount, isAlert, - options, onClick, + options, onClick, onContextMenu, }) { return ( ); } @@ -87,6 +92,7 @@ RoomSelector.defaultProps = { imageSrc: null, iconSrc: null, options: null, + onContextMenu: null, }; RoomSelector.propTypes = { name: PropTypes.string.isRequired, @@ -103,6 +109,7 @@ RoomSelector.propTypes = { isAlert: PropTypes.bool.isRequired, options: PropTypes.node, onClick: PropTypes.func.isRequired, + onContextMenu: PropTypes.func, }; export default RoomSelector; diff --git a/src/app/organisms/navigation/Selector.jsx b/src/app/organisms/navigation/Selector.jsx index 507dc42..e321db8 100644 --- a/src/app/organisms/navigation/Selector.jsx +++ b/src/app/organisms/navigation/Selector.jsx @@ -106,6 +106,7 @@ function Selector({ notificationCount={abbreviateNumber(noti.getTotalNoti(roomId))} isAlert={noti.getHighlightNoti(roomId) !== 0} onClick={onClick} + onContextMenu={openRoomOptions} options={(