Contacts: Fix height for name, fix color for contact (#4371)
This commit is contained in:
parent
6935d8d008
commit
7a32075b37
@ -33,18 +33,17 @@
|
|||||||
|
|
||||||
.name {
|
.name {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
margin-bottom: 0.25rem;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
max-width: 12.5rem;
|
max-width: 12.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.phone {
|
.phone {
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
|
line-height: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.name,
|
.name,
|
||||||
.phone {
|
.phone {
|
||||||
line-height: 1rem;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import styles from './Contact.module.scss';
|
|||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
contact: ApiContact;
|
contact: ApiContact;
|
||||||
|
noUserColors?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type StateProps = {
|
type StateProps = {
|
||||||
@ -30,17 +31,14 @@ type StateProps = {
|
|||||||
const UNREGISTERED_CONTACT_ID = '0';
|
const UNREGISTERED_CONTACT_ID = '0';
|
||||||
|
|
||||||
const Contact: FC<OwnProps & StateProps> = ({
|
const Contact: FC<OwnProps & StateProps> = ({
|
||||||
contact, user, phoneCodeList,
|
contact, user, phoneCodeList, noUserColors,
|
||||||
}) => {
|
}) => {
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
const {
|
const {
|
||||||
openChat, openAddContactDialog, showNotification, openChatWithInfo,
|
openChat, openAddContactDialog, showNotification, openChatWithInfo,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
const {
|
const { phoneNumber, userId } = contact;
|
||||||
phoneNumber,
|
|
||||||
userId,
|
|
||||||
} = contact;
|
|
||||||
const isRegistered = userId !== UNREGISTERED_CONTACT_ID;
|
const isRegistered = userId !== UNREGISTERED_CONTACT_ID;
|
||||||
const canAddContact = isRegistered && user && getCanAddContact(user);
|
const canAddContact = isRegistered && user && getCanAddContact(user);
|
||||||
|
|
||||||
@ -62,25 +60,44 @@ const Contact: FC<OwnProps & StateProps> = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PeerColorWrapper peer={user} emojiIconClassName={styles.emojiIconBackground} className={styles.root}>
|
<PeerColorWrapper
|
||||||
|
noUserColors={noUserColors}
|
||||||
|
peer={user}
|
||||||
|
emojiIconClassName={styles.emojiIconBackground}
|
||||||
|
className={styles.root}
|
||||||
|
>
|
||||||
<div className={styles.infoContainer} onClick={handleClick}>
|
<div className={styles.infoContainer} onClick={handleClick}>
|
||||||
<Avatar size="large" peer={user} text={getContactName(contact)} />
|
<Avatar size="large" peer={user} text={getContactName(contact)} />
|
||||||
<div className={styles.info}>
|
<div className={styles.info}>
|
||||||
<div className={styles.name}>
|
<div className={styles.name}>
|
||||||
{user ? getUserFullName(user) : getContactName(contact)}
|
{user ? getUserFullName(user) : getContactName(contact)}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.phone}>{formatPhoneNumberWithCode(phoneCodeList, phoneNumber)}</div>
|
<div className={styles.phone}>
|
||||||
|
{formatPhoneNumberWithCode(phoneCodeList, phoneNumber)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{isRegistered && (
|
{isRegistered && (
|
||||||
<>
|
<>
|
||||||
<div className={styles.divider} />
|
<div className={styles.divider} />
|
||||||
<div className={styles.buttons}>
|
<div className={styles.buttons}>
|
||||||
<Button isText color="translucent" ripple onClick={handleOpenChat} className={styles.button}>
|
<Button
|
||||||
|
isText
|
||||||
|
color="translucent"
|
||||||
|
ripple
|
||||||
|
onClick={handleOpenChat}
|
||||||
|
className={styles.button}
|
||||||
|
>
|
||||||
{lang('SharedContactMessage')}
|
{lang('SharedContactMessage')}
|
||||||
</Button>
|
</Button>
|
||||||
{canAddContact && (
|
{canAddContact && (
|
||||||
<Button isText color="translucent" ripple onClick={handleAddContact} className={styles.button}>
|
<Button
|
||||||
|
isText
|
||||||
|
color="translucent"
|
||||||
|
ripple
|
||||||
|
onClick={handleAddContact}
|
||||||
|
className={styles.button}
|
||||||
|
>
|
||||||
{lang('SharedContactAdd')}
|
{lang('SharedContactAdd')}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
@ -107,14 +124,14 @@ function getContactName(contact: ApiContact) {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withGlobal<OwnProps>(
|
export default withGlobal<OwnProps>((global, { contact }): StateProps => {
|
||||||
(global, { contact }): StateProps => {
|
const {
|
||||||
const { countryList: { phoneCodes: phoneCodeList } } = global;
|
countryList: { phoneCodes: phoneCodeList },
|
||||||
const user = selectUser(global, contact.userId);
|
} = global;
|
||||||
|
const user = selectUser(global, contact.userId);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
user,
|
user,
|
||||||
phoneCodeList,
|
phoneCodeList,
|
||||||
};
|
};
|
||||||
},
|
})(Contact);
|
||||||
)(Contact);
|
|
||||||
|
|||||||
@ -1163,7 +1163,7 @@ const Message: FC<OwnProps & StateProps> = ({
|
|||||||
)}
|
)}
|
||||||
{isStoryMention && <StoryMention message={message} />}
|
{isStoryMention && <StoryMention message={message} />}
|
||||||
{contact && (
|
{contact && (
|
||||||
<Contact contact={contact} />
|
<Contact contact={contact} noUserColors={isOwn} />
|
||||||
)}
|
)}
|
||||||
{poll && (
|
{poll && (
|
||||||
<Poll message={message} poll={poll} onSendVote={handleVoteSend} />
|
<Poll message={message} poll={poll} onSendVote={handleVoteSend} />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user