From 161b9bb75e0360f315c9cd9d46214739d71e39a0 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Sat, 23 May 2026 12:53:33 -0400 Subject: [PATCH] feat: extend verification badge to user profile and settings members list Extract MemberVerificationBadge into a shared component and render it in: - UserRoomProfile: shield badge beside the display name on the profile card - common-settings Members: badge next to each member in the room/space settings members page (accessible from the lobby) Co-Authored-By: Claude Sonnet 4.6 --- .../components/MemberVerificationBadge.tsx | 35 +++++++++++++++++++ .../user-profile/UserRoomProfile.tsx | 7 +++- .../common-settings/members/Members.tsx | 19 +++++++--- src/app/features/room/MembersDrawer.tsx | 30 +--------------- 4 files changed, 56 insertions(+), 35 deletions(-) create mode 100644 src/app/components/MemberVerificationBadge.tsx diff --git a/src/app/components/MemberVerificationBadge.tsx b/src/app/components/MemberVerificationBadge.tsx new file mode 100644 index 000000000..2a206532d --- /dev/null +++ b/src/app/components/MemberVerificationBadge.tsx @@ -0,0 +1,35 @@ +import React from 'react'; +import { Icon, Icons, Text, Tooltip, TooltipProvider } from 'folds'; +import { useUserVerifiedStatus } from '../hooks/useUserVerifiedStatus'; + +type MemberVerificationBadgeProps = { + userId: string; +}; + +export function MemberVerificationBadge({ userId }: MemberVerificationBadgeProps) { + const vs = useUserVerifiedStatus(userId); + if (vs === 'unknown') return null; + const color = + vs === 'verified' ? 'var(--tc-positive-normal, #5effc4)' : 'var(--tc-warning-normal, #ffcc55)'; + const label = vs === 'verified' ? 'Identity verified' : 'Not verified'; + return ( + + {label} + + } + > + {(ref) => ( + + + + )} + + ); +} diff --git a/src/app/components/user-profile/UserRoomProfile.tsx b/src/app/components/user-profile/UserRoomProfile.tsx index 78d201ec6..c5652a746 100644 --- a/src/app/components/user-profile/UserRoomProfile.tsx +++ b/src/app/components/user-profile/UserRoomProfile.tsx @@ -10,6 +10,8 @@ import { usePowerLevels } from '../../hooks/usePowerLevels'; import { useRoom } from '../../hooks/useRoom'; import { useUserPresence } from '../../hooks/useUserPresence'; import { IgnoredUserAlert, MutualRoomsChip, OptionsChip, ServerChip, ShareChip } from './UserChips'; +import { useCrossSigningActive } from '../../hooks/useCrossSigning'; +import { MemberVerificationBadge } from '../MemberVerificationBadge'; import { useCloseUserRoomProfile } from '../../state/hooks/userRoomProfile'; import { PowerChip } from './PowerChip'; import { UserInviteAlert, UserBanAlert, UserModeration, UserKickAlert } from './UserModeration'; @@ -28,6 +30,7 @@ type UserRoomProfileProps = { }; export function UserRoomProfile({ userId }: UserRoomProfileProps) { const mx = useMatrixClient(); + const crossSigningActive = useCrossSigningActive(); const useAuthentication = useMediaAuthentication(); const navigate = useNavigate(); const closeUserRoomProfile = useCloseUserRoomProfile(); @@ -35,6 +38,7 @@ export function UserRoomProfile({ userId }: UserRoomProfileProps) { const ignored = ignoredUsers.includes(userId); const room = useRoom(); + const showEncryption = room.hasEncryptionStateEvent() && crossSigningActive; const powerLevels = usePowerLevels(room); const creators = useRoomCreators(room); @@ -76,8 +80,9 @@ export function UserRoomProfile({ userId }: UserRoomProfileProps) { /> - + + {showEncryption && } {userId !== myUserId && (