+ const shouldShowReviewCarefully =
+ !acceptedMessageRequest &&
+ (conversationType === 'group' || sharedGroupNames.length <= 1);
+
+ const reviewCarefullyLabel = shouldShowReviewCarefully ? (
+
+
+ {i18n('icu:ConversationHero--review-carefully')}
+
+ ) : null;
+
+ const sharedGroupsLabel =
+ conversationType === 'direct' ? (
+
- {safetyTipsButton}
- );
+ ) : null;
+
+ const nameNotVerifiedLabel =
+ !fromOrAddedByTrustedContact && !isDirectConvoAndHasNickname ? (
+
+
+ (
+
+ ),
+ }}
+ i18n={i18n}
+ id={
+ conversationType === 'group'
+ ? 'icu:ConversationHero--group-names'
+ : 'icu:ConversationHero--profile-names'
+ }
+ />
+
+ ) : null;
+
+ const membersCountLabel =
+ conversationType === 'group' && membersCount != null ? (
+
+
+
+
+ ) : null;
+
+ if (
+ conversationType === 'direct' &&
+ sharedGroupNames.length === 0 &&
+ acceptedMessageRequest &&
+ phoneNumber
+ ) {
+ return null;
}
- if (acceptedMessageRequest) {
- if (phoneNumber) {
- return null;
- }
- return (
-
- {i18n('icu:no-groups-in-common')}
- {safetyTipsButton}
-
- );
+
+ // Check if we should show anything at all
+ const shouldShowAnything =
+ Boolean(reviewCarefullyLabel) ||
+ Boolean(nameNotVerifiedLabel) ||
+ Boolean(sharedGroupsLabel) ||
+ Boolean(safetyTipsButton) ||
+ Boolean(membersCountLabel);
+
+ if (!shouldShowAnything) {
+ return null;
}
return (
-
-
- {i18n('icu:no-groups-in-common-warning')}
-
-
-
+ {reviewCarefullyLabel}
+ {nameNotVerifiedLabel}
+ {sharedGroupsLabel}
+ {membersCountLabel}
{safetyTipsButton}
);
};
+function ReleaseNotesExtraInformation({
+ i18n,
+}: {
+ i18n: LocalizerType;
+}): JSX.Element {
+ return (
+
+
+
+ {i18n('icu:ConversationHero--signal-official-chat')}
+
+
+
+ {i18n('icu:ConversationHero--release-notes')}
+
+
+ );
+}
+
export function ConversationHero({
i18n,
about,
@@ -140,10 +234,13 @@ export function ConversationHero({
badge,
color,
conversationType,
+ fromOrAddedByTrustedContact,
groupDescription,
hasStories,
id,
+ isDirectConvoAndHasNickname,
isMe,
+ openConversationDetails,
isSignalConversation,
membersCount,
sharedGroupNames = [],
@@ -156,13 +253,9 @@ export function ConversationHero({
updateSharedGroups,
viewUserStories,
toggleAboutContactModal,
+ toggleProfileNameWarningModal,
}: Props): JSX.Element {
const [isShowingSafetyTips, setIsShowingSafetyTips] = useState(false);
- const [isShowingMessageRequestWarning, setIsShowingMessageRequestWarning] =
- useState(false);
- const closeMessageRequestWarning = () => {
- setIsShowingMessageRequestWarning(false);
- };
useEffect(() => {
// Kick off the expensive hydration of the current sharedGroupNames
@@ -215,7 +308,6 @@ export function ConversationHero({
);
}
- /* eslint-disable no-nested-ternary */
return (
<>
@@ -248,55 +340,36 @@ export function ConversationHero({
)}
- {!isMe ? (
+ {!isMe && groupDescription ? (
- {groupDescription ? (
-
- ) : membersCount != null ? (
- i18n('icu:ConversationHero--members', { count: membersCount })
- ) : null}
+
) : null}
{!isSignalConversation &&
- renderMembershipRow({
+ renderExtraInformation({
acceptedMessageRequest,
conversationType,
+ fromOrAddedByTrustedContact,
i18n,
+ isDirectConvoAndHasNickname,
isMe,
- onClickMessageRequestWarning() {
- setIsShowingMessageRequestWarning(true);
+ membersCount,
+ onClickProfileNameWarning() {
+ toggleProfileNameWarningModal(conversationType);
},
onToggleSafetyTips(showSafetyTips: boolean) {
setIsShowingSafetyTips(showSafetyTips);
},
+ openConversationDetails,
phoneNumber,
sharedGroupNames,
})}
+ {isSignalConversation &&
}
- {isShowingMessageRequestWarning && (
-