* Add useDeviceList hook Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add isCrossVerified func to matrixUtil Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add className prop in sidebar avatar comp Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add unverified session indicator in sidebar Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add info card component Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add css variables Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add cross signin status hook Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add hasCrossSigninAccountData function Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add cross signin info card in device manage component Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add cross signing and key backup component Signed-off-by: Ajay Bura <ajbura@gmail.com> * Fix typo Signed-off-by: Ajay Bura <ajbura@gmail.com> * WIP Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add cross singing dialogs Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add cross signing set/reset Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add SecretStorageAccess component Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add key backup Signed-off-by: Ajay Bura <ajbura@gmail.com> * WIP * WIP * WIP * WIP * Show progress when restoring key backup * Add SSSS and key backup
56 lines
1.4 KiB
JavaScript
56 lines
1.4 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import './SidebarAvatar.scss';
|
|
|
|
import { twemojify } from '../../../util/twemojify';
|
|
|
|
import Text from '../../atoms/text/Text';
|
|
import Tooltip from '../../atoms/tooltip/Tooltip';
|
|
import { blurOnBubbling } from '../../atoms/button/script';
|
|
|
|
const SidebarAvatar = React.forwardRef(({
|
|
className, tooltip, active, onClick,
|
|
onContextMenu, avatar, notificationBadge,
|
|
}, ref) => {
|
|
const classes = ['sidebar-avatar'];
|
|
if (active) classes.push('sidebar-avatar--active');
|
|
if (className) classes.push(className);
|
|
return (
|
|
<Tooltip
|
|
content={<Text variant="b1">{twemojify(tooltip)}</Text>}
|
|
placement="right"
|
|
>
|
|
<button
|
|
ref={ref}
|
|
className={classes.join(' ')}
|
|
type="button"
|
|
onMouseUp={(e) => blurOnBubbling(e, '.sidebar-avatar')}
|
|
onClick={onClick}
|
|
onContextMenu={onContextMenu}
|
|
>
|
|
{avatar}
|
|
{notificationBadge}
|
|
</button>
|
|
</Tooltip>
|
|
);
|
|
});
|
|
SidebarAvatar.defaultProps = {
|
|
className: null,
|
|
active: false,
|
|
onClick: null,
|
|
onContextMenu: null,
|
|
notificationBadge: null,
|
|
};
|
|
|
|
SidebarAvatar.propTypes = {
|
|
className: PropTypes.string,
|
|
tooltip: PropTypes.string.isRequired,
|
|
active: PropTypes.bool,
|
|
onClick: PropTypes.func,
|
|
onContextMenu: PropTypes.func,
|
|
avatar: PropTypes.node.isRequired,
|
|
notificationBadge: PropTypes.node,
|
|
};
|
|
|
|
export default SidebarAvatar;
|