Open room options with right click
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
60c44da974
commit
c50565dfda
2 changed files with 10 additions and 2 deletions
|
@ -11,7 +11,8 @@ import NotificationBadge from '../../atoms/badge/NotificationBadge';
|
||||||
import { blurOnBubbling } from '../../atoms/button/script';
|
import { blurOnBubbling } from '../../atoms/button/script';
|
||||||
|
|
||||||
function RoomSelectorWrapper({
|
function RoomSelectorWrapper({
|
||||||
isSelected, isUnread, onClick, content, options,
|
isSelected, isUnread, onClick,
|
||||||
|
content, options, onContextMenu,
|
||||||
}) {
|
}) {
|
||||||
let myClass = isUnread ? ' room-selector--unread' : '';
|
let myClass = isUnread ? ' room-selector--unread' : '';
|
||||||
myClass += isSelected ? ' room-selector--selected' : '';
|
myClass += isSelected ? ' room-selector--selected' : '';
|
||||||
|
@ -22,6 +23,7 @@ function RoomSelectorWrapper({
|
||||||
type="button"
|
type="button"
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
onMouseUp={(e) => blurOnBubbling(e, '.room-selector__content')}
|
onMouseUp={(e) => blurOnBubbling(e, '.room-selector__content')}
|
||||||
|
onContextMenu={onContextMenu}
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
</button>
|
</button>
|
||||||
|
@ -31,6 +33,7 @@ function RoomSelectorWrapper({
|
||||||
}
|
}
|
||||||
RoomSelectorWrapper.defaultProps = {
|
RoomSelectorWrapper.defaultProps = {
|
||||||
options: null,
|
options: null,
|
||||||
|
onContextMenu: null,
|
||||||
};
|
};
|
||||||
RoomSelectorWrapper.propTypes = {
|
RoomSelectorWrapper.propTypes = {
|
||||||
isSelected: PropTypes.bool.isRequired,
|
isSelected: PropTypes.bool.isRequired,
|
||||||
|
@ -38,12 +41,13 @@ RoomSelectorWrapper.propTypes = {
|
||||||
onClick: PropTypes.func.isRequired,
|
onClick: PropTypes.func.isRequired,
|
||||||
content: PropTypes.node.isRequired,
|
content: PropTypes.node.isRequired,
|
||||||
options: PropTypes.node,
|
options: PropTypes.node,
|
||||||
|
onContextMenu: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
function RoomSelector({
|
function RoomSelector({
|
||||||
name, parentName, roomId, imageSrc, iconSrc,
|
name, parentName, roomId, imageSrc, iconSrc,
|
||||||
isSelected, isUnread, notificationCount, isAlert,
|
isSelected, isUnread, notificationCount, isAlert,
|
||||||
options, onClick,
|
options, onClick, onContextMenu,
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<RoomSelectorWrapper
|
<RoomSelectorWrapper
|
||||||
|
@ -78,6 +82,7 @@ function RoomSelector({
|
||||||
)}
|
)}
|
||||||
options={options}
|
options={options}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
|
onContextMenu={onContextMenu}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -87,6 +92,7 @@ RoomSelector.defaultProps = {
|
||||||
imageSrc: null,
|
imageSrc: null,
|
||||||
iconSrc: null,
|
iconSrc: null,
|
||||||
options: null,
|
options: null,
|
||||||
|
onContextMenu: null,
|
||||||
};
|
};
|
||||||
RoomSelector.propTypes = {
|
RoomSelector.propTypes = {
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
|
@ -103,6 +109,7 @@ RoomSelector.propTypes = {
|
||||||
isAlert: PropTypes.bool.isRequired,
|
isAlert: PropTypes.bool.isRequired,
|
||||||
options: PropTypes.node,
|
options: PropTypes.node,
|
||||||
onClick: PropTypes.func.isRequired,
|
onClick: PropTypes.func.isRequired,
|
||||||
|
onContextMenu: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default RoomSelector;
|
export default RoomSelector;
|
||||||
|
|
|
@ -106,6 +106,7 @@ function Selector({
|
||||||
notificationCount={abbreviateNumber(noti.getTotalNoti(roomId))}
|
notificationCount={abbreviateNumber(noti.getTotalNoti(roomId))}
|
||||||
isAlert={noti.getHighlightNoti(roomId) !== 0}
|
isAlert={noti.getHighlightNoti(roomId) !== 0}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
|
onContextMenu={openRoomOptions}
|
||||||
options={(
|
options={(
|
||||||
<IconButton
|
<IconButton
|
||||||
size="extra-small"
|
size="extra-small"
|
||||||
|
|
Loading…
Reference in a new issue