Allow viewing contact details from group change messages
This commit is contained in:
parent
614bb904b1
commit
59b135ad7e
4 changed files with 39 additions and 11 deletions
|
@ -1,6 +1,22 @@
|
||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
button.module-contact-name {
|
||||||
|
@include button-reset;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
@include keyboard-mode {
|
||||||
|
outline: auto;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.module-contact-name {
|
.module-contact-name {
|
||||||
&--000 {
|
&--000 {
|
||||||
color: #d00b0b;
|
color: #d00b0b;
|
||||||
|
|
|
@ -16,6 +16,7 @@ export type PropsType = {
|
||||||
module?: string;
|
module?: string;
|
||||||
preferFirstName?: boolean;
|
preferFirstName?: boolean;
|
||||||
title: string;
|
title: string;
|
||||||
|
onClick?: VoidFunction;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function ContactName({
|
export function ContactName({
|
||||||
|
@ -26,6 +27,7 @@ export function ContactName({
|
||||||
module,
|
module,
|
||||||
preferFirstName,
|
preferFirstName,
|
||||||
title,
|
title,
|
||||||
|
onClick,
|
||||||
}: PropsType): JSX.Element {
|
}: PropsType): JSX.Element {
|
||||||
const getClassName = getClassNamesFor('module-contact-name', module);
|
const getClassName = getClassNamesFor('module-contact-name', module);
|
||||||
|
|
||||||
|
@ -35,19 +37,20 @@ export function ContactName({
|
||||||
} else {
|
} else {
|
||||||
text = title || '';
|
text = title || '';
|
||||||
}
|
}
|
||||||
|
const WrappingElement = onClick ? 'button' : 'span';
|
||||||
return (
|
return (
|
||||||
<span
|
<WrappingElement
|
||||||
className={classNames(
|
className={classNames(
|
||||||
getClassName(''),
|
getClassName(''),
|
||||||
contactNameColor ? getClassName(`--${contactNameColor}`) : null
|
contactNameColor ? getClassName(`--${contactNameColor}`) : null
|
||||||
)}
|
)}
|
||||||
dir="auto"
|
dir="auto"
|
||||||
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
<Emojify text={text} />
|
<Emojify text={text} />
|
||||||
{(isSignalConversation || isMe) && (
|
{(isSignalConversation || isMe) && (
|
||||||
<span className="ContactModal__official-badge" />
|
<span className="ContactModal__official-badge" />
|
||||||
)}
|
)}
|
||||||
</span>
|
</WrappingElement>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,29 +9,38 @@ import { ContactName } from '../../components/conversation/ContactName';
|
||||||
|
|
||||||
import { getIntl } from '../selectors/user';
|
import { getIntl } from '../selectors/user';
|
||||||
import type { GetConversationByIdType } from '../selectors/conversations';
|
import type { GetConversationByIdType } from '../selectors/conversations';
|
||||||
import { getConversationSelector } from '../selectors/conversations';
|
import {
|
||||||
|
getConversationSelector,
|
||||||
|
getSelectedConversationId,
|
||||||
|
} from '../selectors/conversations';
|
||||||
|
|
||||||
import type { LocalizerType } from '../../types/Util';
|
import type { LocalizerType } from '../../types/Util';
|
||||||
|
import { useGlobalModalActions } from '../ducks/globalModals';
|
||||||
|
|
||||||
type ExternalProps = {
|
type ExternalProps = {
|
||||||
conversationId: string;
|
contactId: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function SmartContactName(props: ExternalProps): JSX.Element {
|
export function SmartContactName(props: ExternalProps): JSX.Element {
|
||||||
const { conversationId } = props;
|
const { contactId } = props;
|
||||||
const i18n = useSelector<StateType, LocalizerType>(getIntl);
|
const i18n = useSelector<StateType, LocalizerType>(getIntl);
|
||||||
const getConversation = useSelector<StateType, GetConversationByIdType>(
|
const getConversation = useSelector<StateType, GetConversationByIdType>(
|
||||||
getConversationSelector
|
getConversationSelector
|
||||||
);
|
);
|
||||||
|
|
||||||
const conversation = getConversation(conversationId) || {
|
const contact = getConversation(contactId) || {
|
||||||
title: i18n('icu:unknownContact'),
|
title: i18n('icu:unknownContact'),
|
||||||
};
|
};
|
||||||
|
const currentConversationId = useSelector(getSelectedConversationId);
|
||||||
|
const currentConversation = getConversation(currentConversationId);
|
||||||
|
|
||||||
|
const { showContactModal } = useGlobalModalActions();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ContactName
|
<ContactName
|
||||||
firstName={conversation.firstName}
|
firstName={contact.firstName}
|
||||||
title={conversation.title}
|
title={contact.title}
|
||||||
|
onClick={() => showContactModal(contact.id, currentConversation.id)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,8 @@ type ExternalProps = {
|
||||||
unreadIndicatorPlacement: undefined | UnreadIndicatorPlacement;
|
unreadIndicatorPlacement: undefined | UnreadIndicatorPlacement;
|
||||||
};
|
};
|
||||||
|
|
||||||
function renderContact(conversationId: string): JSX.Element {
|
function renderContact(contactId: string): JSX.Element {
|
||||||
return <SmartContactName conversationId={conversationId} />;
|
return <SmartContactName contactId={contactId} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderUniversalTimerNotification(): JSX.Element {
|
function renderUniversalTimerNotification(): JSX.Element {
|
||||||
|
|
Loading…
Reference in a new issue