Add unverified session indicator in sidebar
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
0bdb14f5b7
commit
a30b4b9d98
3 changed files with 40 additions and 11 deletions
|
@ -14,6 +14,7 @@ import {
|
||||||
} from '../../../client/action/navigation';
|
} from '../../../client/action/navigation';
|
||||||
import { moveSpaceShortcut } from '../../../client/action/accountData';
|
import { moveSpaceShortcut } from '../../../client/action/accountData';
|
||||||
import { abbreviateNumber, getEventCords } from '../../../util/common';
|
import { abbreviateNumber, getEventCords } from '../../../util/common';
|
||||||
|
import { isCrossVerified } from '../../../util/matrixUtil';
|
||||||
|
|
||||||
import Avatar from '../../atoms/avatar/Avatar';
|
import Avatar from '../../atoms/avatar/Avatar';
|
||||||
import NotificationBadge from '../../atoms/badge/NotificationBadge';
|
import NotificationBadge from '../../atoms/badge/NotificationBadge';
|
||||||
|
@ -26,8 +27,12 @@ import UserIC from '../../../../public/res/ic/outlined/user.svg';
|
||||||
import AddPinIC from '../../../../public/res/ic/outlined/add-pin.svg';
|
import AddPinIC from '../../../../public/res/ic/outlined/add-pin.svg';
|
||||||
import SearchIC from '../../../../public/res/ic/outlined/search.svg';
|
import SearchIC from '../../../../public/res/ic/outlined/search.svg';
|
||||||
import InviteIC from '../../../../public/res/ic/outlined/invite.svg';
|
import InviteIC from '../../../../public/res/ic/outlined/invite.svg';
|
||||||
|
import ShieldUserIC from '../../../../public/res/ic/outlined/shield-user.svg';
|
||||||
|
|
||||||
import { useSelectedTab } from '../../hooks/useSelectedTab';
|
import { useSelectedTab } from '../../hooks/useSelectedTab';
|
||||||
|
import { useDeviceList } from '../../hooks/useDeviceList';
|
||||||
|
|
||||||
|
import { tabText as settingTabText } from '../settings/Settings';
|
||||||
|
|
||||||
function useNotificationUpdate() {
|
function useNotificationUpdate() {
|
||||||
const { notifications } = initMatrix;
|
const { notifications } = initMatrix;
|
||||||
|
@ -85,6 +90,22 @@ function ProfileAvatarMenu() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CrossSigninAlert() {
|
||||||
|
const deviceList = useDeviceList();
|
||||||
|
const unverified = deviceList?.filter((device) => !isCrossVerified(device.device_id));
|
||||||
|
|
||||||
|
if (!unverified?.length) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SidebarAvatar
|
||||||
|
className="sidebar__cross-signin-alert"
|
||||||
|
tooltip={`${unverified.length} unverified sessions`}
|
||||||
|
onClick={() => openSettings(settingTabText.SECURITY)}
|
||||||
|
avatar={<Avatar iconSrc={ShieldUserIC} iconColor="var(--ic-danger-normal)" size="normal" />}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function FeaturedTab() {
|
function FeaturedTab() {
|
||||||
const { roomList, accountData, notifications } = initMatrix;
|
const { roomList, accountData, notifications } = initMatrix;
|
||||||
const [selectedTab] = useSelectedTab();
|
const [selectedTab] = useSelectedTab();
|
||||||
|
@ -358,6 +379,7 @@ function SideBar() {
|
||||||
notificationBadge={<NotificationBadge alert content={totalInvites} />}
|
notificationBadge={<NotificationBadge alert content={totalInvites} />}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
<CrossSigninAlert />
|
||||||
<ProfileAvatarMenu />
|
<ProfileAvatarMenu />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -57,4 +57,21 @@
|
||||||
width: 24px;
|
width: 24px;
|
||||||
height: 1px;
|
height: 1px;
|
||||||
background-color: var(--bg-surface-border);
|
background-color: var(--bg-surface-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar__cross-signin-alert .avatar-container {
|
||||||
|
box-shadow: var(--bs-danger-border);
|
||||||
|
animation-name: pushRight;
|
||||||
|
animation-duration: 400ms;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
animation-direction: alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pushRight {
|
||||||
|
from {
|
||||||
|
transform: translateX(4px) scale(1);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: translateX(0) scale(1);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -167,16 +167,6 @@ function NotificationsSection() {
|
||||||
function SecuritySection() {
|
function SecuritySection() {
|
||||||
return (
|
return (
|
||||||
<div className="settings-security">
|
<div className="settings-security">
|
||||||
<div className="settings-security__card">
|
|
||||||
<MenuHeader>Session Info</MenuHeader>
|
|
||||||
<SettingTile
|
|
||||||
title={`Session ID: ${initMatrix.matrixClient.getDeviceId()}`}
|
|
||||||
/>
|
|
||||||
<SettingTile
|
|
||||||
title={`Session key: ${initMatrix.matrixClient.getDeviceEd25519Key().match(/.{1,4}/g).join(' ')}`}
|
|
||||||
content={<Text variant="b3">Use this session ID-key combo to verify or manage this session.</Text>}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<DeviceManage />
|
<DeviceManage />
|
||||||
<div className="settings-security__card">
|
<div className="settings-security__card">
|
||||||
<MenuHeader>Encryption</MenuHeader>
|
<MenuHeader>Encryption</MenuHeader>
|
||||||
|
@ -247,7 +237,7 @@ function AboutSection() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const tabText = {
|
export const tabText = {
|
||||||
APPEARANCE: 'Appearance',
|
APPEARANCE: 'Appearance',
|
||||||
NOTIFICATIONS: 'Notifications',
|
NOTIFICATIONS: 'Notifications',
|
||||||
SECURITY: 'Security',
|
SECURITY: 'Security',
|
||||||
|
|
Loading…
Reference in a new issue