Allow viewing contact details from group change messages

This commit is contained in:
trevor-signal 2024-02-08 09:36:08 -05:00 committed by GitHub
parent 614bb904b1
commit 59b135ad7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 39 additions and 11 deletions

View file

@ -9,29 +9,38 @@ import { ContactName } from '../../components/conversation/ContactName';
import { getIntl } from '../selectors/user';
import type { GetConversationByIdType } from '../selectors/conversations';
import { getConversationSelector } from '../selectors/conversations';
import {
getConversationSelector,
getSelectedConversationId,
} from '../selectors/conversations';
import type { LocalizerType } from '../../types/Util';
import { useGlobalModalActions } from '../ducks/globalModals';
type ExternalProps = {
conversationId: string;
contactId: string;
};
export function SmartContactName(props: ExternalProps): JSX.Element {
const { conversationId } = props;
const { contactId } = props;
const i18n = useSelector<StateType, LocalizerType>(getIntl);
const getConversation = useSelector<StateType, GetConversationByIdType>(
getConversationSelector
);
const conversation = getConversation(conversationId) || {
const contact = getConversation(contactId) || {
title: i18n('icu:unknownContact'),
};
const currentConversationId = useSelector(getSelectedConversationId);
const currentConversation = getConversation(currentConversationId);
const { showContactModal } = useGlobalModalActions();
return (
<ContactName
firstName={conversation.firstName}
title={conversation.title}
firstName={contact.firstName}
title={contact.title}
onClick={() => showContactModal(contact.id, currentConversation.id)}
/>
);
}