const SidebarAvatar = React.forwardRef(({
tooltip, text, bgColor, imageSrc,
- iconSrc, active, onClick, isUnread, notificationCount, isAlert,
+ iconSrc, active, onClick, onContextMenu,
+ isUnread, notificationCount, isAlert,
}, ref) => {
let activeClass = '';
if (active) activeClass = ' sidebar-avatar--active';
type="button"
onMouseUp={(e) => blurOnBubbling(e, '.sidebar-avatar')}
onClick={onClick}
+ onContextMenu={onContextMenu}
>
<Avatar
text={text}
imageSrc: null,
active: false,
onClick: null,
+ onContextMenu: null,
isUnread: false,
notificationCount: 0,
isAlert: false,
iconSrc: PropTypes.string,
active: PropTypes.bool,
onClick: PropTypes.func,
+ onContextMenu: PropTypes.func,
isUnread: PropTypes.bool,
notificationCount: PropTypes.oneOfType([
PropTypes.string,
import cons from '../../../client/state/cons';
import colorMXID from '../../../util/colorMXID';
import {
- selectTab, openInviteList, openSearch, openSettings,
+ selectTab, openInviteList, openSearch,
+ openSettings, openReusableContextMenu,
} from '../../../client/action/navigation';
-import { abbreviateNumber } from '../../../util/common';
+import { abbreviateNumber, getEventCords } from '../../../util/common';
import ScrollView from '../../atoms/scroll/ScrollView';
import SidebarAvatar from '../../molecules/sidebar-avatar/SidebarAvatar';
+import SpaceOptions from '../../molecules/space-options/SpaceOptions';
import HomeIC from '../../../../public/res/ic/outlined/home.svg';
import UserIC from '../../../../public/res/ic/outlined/user.svg';
};
}, []);
+ const openSpaceOptions = (e, spaceId) => {
+ e.preventDefault();
+ openReusableContextMenu(
+ 'right',
+ getEventCords(e, '.sidebar-avatar'),
+ (closeMenu) => <SpaceOptions roomId={spaceId} afterOptionSelect={closeMenu} />,
+ );
+ };
+
function getHomeNoti() {
const orphans = roomList.getOrphans();
let noti = null;
notificationCount={abbreviateNumber(notifications.getTotalNoti(sRoomId))}
isAlert={notifications.getHighlightNoti(sRoomId) !== 0}
onClick={() => selectTab(shortcut)}
+ onContextMenu={(e) => openSpaceOptions(e, sRoomId)}
/>
);
})