Open room options with right click
authorAjay Bura <ajbura@gmail.com>
Thu, 13 Jan 2022 13:01:56 +0000 (18:31 +0530)
committerAjay Bura <ajbura@gmail.com>
Thu, 13 Jan 2022 13:01:56 +0000 (18:31 +0530)
Signed-off-by: Ajay Bura <ajbura@gmail.com>
src/app/molecules/room-selector/RoomSelector.jsx
src/app/organisms/navigation/Selector.jsx

index 22f233f0883f0a53311f88c572707bafd799d5d8..8bd6c207d25499f8252e7d0ec9578717d79e0803 100644 (file)
@@ -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}
       </button>
@@ -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 (
     <RoomSelectorWrapper
@@ -78,6 +82,7 @@ function RoomSelector({
       )}
       options={options}
       onClick={onClick}
+      onContextMenu={onContextMenu}
     />
   );
 }
@@ -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;
index 507dc4258b9502a4b767fa9253274479e82f6387..e321db82470d295cbaf1aabe8cbc684f999d2af1 100644 (file)
@@ -106,6 +106,7 @@ function Selector({
       notificationCount={abbreviateNumber(noti.getTotalNoti(roomId))}
       isAlert={noti.getHighlightNoti(roomId) !== 0}
       onClick={onClick}
+      onContextMenu={openRoomOptions}
       options={(
         <IconButton
           size="extra-small"