From a30b4b9d98da2be1d5f39bbe1b203afae7af7cde Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Wed, 30 Mar 2022 18:48:53 +0530 Subject: [PATCH] Add unverified session indicator in sidebar Signed-off-by: Ajay Bura --- src/app/organisms/navigation/SideBar.jsx | 22 ++++++++++++++++++++++ src/app/organisms/navigation/SideBar.scss | 17 +++++++++++++++++ src/app/organisms/settings/Settings.jsx | 12 +----------- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/src/app/organisms/navigation/SideBar.jsx b/src/app/organisms/navigation/SideBar.jsx index 54723bdd..eb20b72c 100644 --- a/src/app/organisms/navigation/SideBar.jsx +++ b/src/app/organisms/navigation/SideBar.jsx @@ -14,6 +14,7 @@ import { } from '../../../client/action/navigation'; import { moveSpaceShortcut } from '../../../client/action/accountData'; import { abbreviateNumber, getEventCords } from '../../../util/common'; +import { isCrossVerified } from '../../../util/matrixUtil'; import Avatar from '../../atoms/avatar/Avatar'; 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 SearchIC from '../../../../public/res/ic/outlined/search.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 { useDeviceList } from '../../hooks/useDeviceList'; + +import { tabText as settingTabText } from '../settings/Settings'; function useNotificationUpdate() { 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 ( + openSettings(settingTabText.SECURITY)} + avatar={} + /> + ); +} + function FeaturedTab() { const { roomList, accountData, notifications } = initMatrix; const [selectedTab] = useSelectedTab(); @@ -358,6 +379,7 @@ function SideBar() { notificationBadge={} /> )} + diff --git a/src/app/organisms/navigation/SideBar.scss b/src/app/organisms/navigation/SideBar.scss index 9f9ade72..6ff66288 100644 --- a/src/app/organisms/navigation/SideBar.scss +++ b/src/app/organisms/navigation/SideBar.scss @@ -57,4 +57,21 @@ width: 24px; height: 1px; 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); + } } \ No newline at end of file diff --git a/src/app/organisms/settings/Settings.jsx b/src/app/organisms/settings/Settings.jsx index acfef5c9..c533e204 100644 --- a/src/app/organisms/settings/Settings.jsx +++ b/src/app/organisms/settings/Settings.jsx @@ -167,16 +167,6 @@ function NotificationsSection() { function SecuritySection() { return (
-
- Session Info - - Use this session ID-key combo to verify or manage this session.} - /> -
Encryption @@ -247,7 +237,7 @@ function AboutSection() { ); } -const tabText = { +export const tabText = { APPEARANCE: 'Appearance', NOTIFICATIONS: 'Notifications', SECURITY: 'Security',