diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 472aeb0c2b..da77ee1da4 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -3064,8 +3064,8 @@ } } }, - "ConversationHero--membership-1": { - "message": "Member of $group$.", + "member-of-1-group": { + "message": "Member of $group$", "description": "Shown in the conversation hero to indicate this user is a member of a mutual group", "placeholders": { "group": { @@ -3074,8 +3074,8 @@ } } }, - "ConversationHero--membership-2": { - "message": "Member of $group1$ and $group2$.", + "member-of-2-groups": { + "message": "Member of $group1$ and $group2$", "description": "Shown in the conversation hero to indicate this user is a member of at least two mutual groups", "placeholders": { "group1": { @@ -3088,8 +3088,8 @@ } } }, - "ConversationHero--membership-3": { - "message": "Member of $group1$, $group2$, and $group3$.", + "member-of-3-groups": { + "message": "Member of $group1$, $group2$, and $group3$", "description": "Shown in the conversation hero to indicate this user is a member of at least three mutual groups", "placeholders": { "group1": { @@ -3106,8 +3106,8 @@ } } }, - "ConversationHero--membership-extra": { - "message": "Member of $group1$, $group2$, $group3$ and $remainingCount$ more.", + "member-of-more-than-3-groups": { + "message": "Member of $group1$, $group2$, $group3$ and $remainingCount$ more", "description": "Shown in the conversation hero to indicate this user is a member of at least three mutual groups", "placeholders": { "group1": { @@ -3139,7 +3139,7 @@ } }, "no-groups-in-common": { - "message": "No groups in common.", + "message": "No groups in common", "description": "Shown to indicate this user is not a member of any groups" }, "acceptCall": { diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index 1d4fc66811..916e85fe8a 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -2115,7 +2115,6 @@ $timer-icons: '55', '50', '45', '40', '35', '30', '25', '20', '15', '10', '05', .module-about { &__container { - margin-bottom: 8px; margin-left: auto; margin-right: auto; max-width: 248px; @@ -10484,9 +10483,14 @@ $contact-modal-padding: 18px; margin-top: 6px; } -.module-contact-modal__profile-and-number { - color: $color-gray-60; +.module-contact-modal__info { + text-align: center; + max-width: 248px; + margin-top: 8px; + @include light-theme { + color: $color-gray-60; + } @include dark-theme { color: $color-gray-25; } diff --git a/ts/components/SharedGroupNames.tsx b/ts/components/SharedGroupNames.tsx new file mode 100644 index 0000000000..f86a557085 --- /dev/null +++ b/ts/components/SharedGroupNames.tsx @@ -0,0 +1,83 @@ +// Copyright 2021 Signal Messenger, LLC +// SPDX-License-Identifier: AGPL-3.0-only + +import React, { FunctionComponent } from 'react'; +import { take } from 'lodash'; + +import { Emojify } from './conversation/Emojify'; +import { Intl } from './Intl'; +import { LocalizerType } from '../types/Util'; + +type PropsType = { + i18n: LocalizerType; + nameClassName?: string; + sharedGroupNames: Array; +}; + +export const SharedGroupNames: FunctionComponent = ({ + i18n, + nameClassName, + sharedGroupNames, +}) => { + const firstThreeGroups = take(sharedGroupNames, 3).map((group, i) => ( + // We cannot guarantee uniqueness of group names + // eslint-disable-next-line react/no-array-index-key + + + + )); + + if (sharedGroupNames.length > 3) { + const remainingCount = sharedGroupNames.length - 3; + return ( + + ); + } + if (firstThreeGroups.length === 3) { + return ( + + ); + } + if (firstThreeGroups.length >= 2) { + return ( + + ); + } + if (firstThreeGroups.length >= 1) { + return ( + + ); + } + + return <>{i18n('no-groups-in-common')}; +}; diff --git a/ts/components/conversation/ContactModal.tsx b/ts/components/conversation/ContactModal.tsx index 845b73c738..8de5b59c80 100644 --- a/ts/components/conversation/ContactModal.tsx +++ b/ts/components/conversation/ContactModal.tsx @@ -7,6 +7,7 @@ import { createPortal } from 'react-dom'; import { ConversationType } from '../../state/ducks/conversations'; import { About } from './About'; import { Avatar } from '../Avatar'; +import { SharedGroupNames } from '../SharedGroupNames'; import { LocalizerType } from '../../types/Util'; export type PropsType = { @@ -119,10 +120,16 @@ export const ContactModal = ({ {contact.phoneNumber && ( -
+
{contact.phoneNumber}
)} +
+ +