From 8446075bb1426c334c87ac001420028b1717ec59 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 18 Oct 2021 17:17:13 +1100 Subject: [PATCH] convo list click on avatar open user details Relates #1971 --- ts/components/ConversationListItem.tsx | 38 ++++++++++++++++++-------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/ts/components/ConversationListItem.tsx b/ts/components/ConversationListItem.tsx index cdb1921f3..ec667eb4f 100644 --- a/ts/components/ConversationListItem.tsx +++ b/ts/components/ConversationListItem.tsx @@ -23,10 +23,11 @@ import { import _ from 'underscore'; import { useMembersAvatars } from '../hooks/useMembersAvatar'; import { SessionIcon } from './session/icon'; -import { useSelector } from 'react-redux'; +import { useDispatch, useSelector } from 'react-redux'; import { SectionType } from '../state/ducks/section'; import { getFocusedSection } from '../state/selectors/section'; import { ConversationNotificationSettingType } from '../models/conversation'; +import { updateUserDetailsModal } from '../state/ducks/modalDialog'; // tslint:disable-next-line: no-empty-interface export interface ConversationListItemProps extends ReduxConversationType {} @@ -131,16 +132,15 @@ const HeaderItem = (props: { {unreadCountDiv} {atSymbol} - { -
0 ? 'module-conversation-list-item__header__date--has-unread' : null - )} - > - {} -
- } + +
0 ? 'module-conversation-list-item__header__date--has-unread' : null + )} + > + +
); }; @@ -220,10 +220,12 @@ const AvatarItem = (props: { memberAvatars?: Array; name?: string; profileName?: string; + isPrivate: boolean; }) => { - const { avatarPath, name, conversationId, profileName, memberAvatars } = props; + const { avatarPath, name, isPrivate, conversationId, profileName, memberAvatars } = props; const userName = name || profileName || conversationId; + const dispatch = useDispatch(); return (
@@ -233,6 +235,17 @@ const AvatarItem = (props: { size={AvatarSize.S} memberAvatars={memberAvatars} pubkey={conversationId} + onAvatarClick={() => { + if (isPrivate) { + dispatch( + updateUserDetailsModal({ + conversationId: conversationId, + userName, + authorAvatarPath: avatarPath, + }) + ); + } + }} />
); @@ -309,6 +322,7 @@ const ConversationListItem = (props: Props) => { memberAvatars={membersAvatar} profileName={profileName} name={name} + isPrivate={isPrivate || false} />