Open room options with right click

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2022-01-13 18:31:56 +05:30
parent 60c44da974
commit c50565dfda
2 changed files with 10 additions and 2 deletions

View 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;

View 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"