First-class profile name rendering
This commit is contained in:
parent
632cd0e87e
commit
d07b8e82b2
63 changed files with 1044 additions and 454 deletions
|
@ -3,15 +3,17 @@ import classNames from 'classnames';
|
|||
|
||||
import { Avatar } from './Avatar';
|
||||
import { Emojify } from './conversation/Emojify';
|
||||
import { InContactsIcon } from './InContactsIcon';
|
||||
|
||||
import { ColorType, LocalizerType } from '../types/Util';
|
||||
|
||||
interface Props {
|
||||
phoneNumber: string;
|
||||
title: string;
|
||||
phoneNumber?: string;
|
||||
isMe?: boolean;
|
||||
name?: string;
|
||||
color: ColorType;
|
||||
verified: boolean;
|
||||
color?: ColorType;
|
||||
isVerified?: boolean;
|
||||
profileName?: string;
|
||||
avatarPath?: string;
|
||||
i18n: LocalizerType;
|
||||
|
@ -27,6 +29,7 @@ export class ContactListItem extends React.Component<Props> {
|
|||
name,
|
||||
phoneNumber,
|
||||
profileName,
|
||||
title,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
|
@ -38,6 +41,7 @@ export class ContactListItem extends React.Component<Props> {
|
|||
name={name}
|
||||
phoneNumber={phoneNumber}
|
||||
profileName={profileName}
|
||||
title={title}
|
||||
size={52}
|
||||
/>
|
||||
);
|
||||
|
@ -51,21 +55,15 @@ export class ContactListItem extends React.Component<Props> {
|
|||
isMe,
|
||||
phoneNumber,
|
||||
profileName,
|
||||
verified,
|
||||
title,
|
||||
isVerified,
|
||||
} = this.props;
|
||||
|
||||
const title = name ? name : phoneNumber;
|
||||
const displayName = isMe ? i18n('you') : title;
|
||||
const shouldShowIcon = Boolean(name);
|
||||
|
||||
const profileElement =
|
||||
!isMe && profileName && !name ? (
|
||||
<span className="module-contact-list-item__text__profile-name">
|
||||
~<Emojify text={profileName} />
|
||||
</span>
|
||||
) : null;
|
||||
|
||||
const showNumber = isMe || name;
|
||||
const showVerified = !isMe && verified;
|
||||
const showNumber = Boolean(isMe || name || profileName);
|
||||
const showVerified = !isMe && isVerified;
|
||||
|
||||
return (
|
||||
<button
|
||||
|
@ -78,7 +76,13 @@ export class ContactListItem extends React.Component<Props> {
|
|||
{this.renderAvatar()}
|
||||
<div className="module-contact-list-item__text">
|
||||
<div className="module-contact-list-item__text__name">
|
||||
<Emojify text={displayName} /> {profileElement}
|
||||
<Emojify text={displayName} />
|
||||
{shouldShowIcon ? (
|
||||
<span>
|
||||
{' '}
|
||||
<InContactsIcon i18n={i18n} />
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="module-contact-list-item__text__additional-data">
|
||||
{showVerified ? (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue