// Copyright 2024 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React, { useCallback, useEffect } from 'react'; import type { ConversationType } from '../../state/ducks/conversations'; import type { LocalizerType } from '../../types/Util'; import { isInSystemContacts } from '../../util/isInSystemContacts'; import { shouldBlurAvatar } from '../../util/shouldBlurAvatar'; import { Avatar, AvatarBlur, AvatarSize } from '../Avatar'; import { Modal } from '../Modal'; import { UserText } from '../UserText'; import { SharedGroupNames } from '../SharedGroupNames'; import { About } from './About'; export type PropsType = Readonly<{ i18n: LocalizerType; onClose: () => void; conversation: ConversationType; isSignalConnection: boolean; toggleSignalConnectionsModal: () => void; toggleSafetyNumberModal: (id: string) => void; updateSharedGroups: (id: string) => void; unblurAvatar: (conversationId: string) => void; }>; export function AboutContactModal({ i18n, conversation, isSignalConnection, toggleSignalConnectionsModal, toggleSafetyNumberModal, updateSharedGroups, unblurAvatar, onClose, }: PropsType): JSX.Element { const { isMe } = conversation; useEffect(() => { // Kick off the expensive hydration of the current sharedGroupNames updateSharedGroups(conversation.id); }, [conversation.id, updateSharedGroups]); const avatarBlur = shouldBlurAvatar(conversation) ? AvatarBlur.BlurPictureWithClickToView : AvatarBlur.NoBlur; const onAvatarClick = useCallback(() => { if (avatarBlur === AvatarBlur.BlurPictureWithClickToView) { unblurAvatar(conversation.id); } }, [avatarBlur, unblurAvatar, conversation.id]); const onSignalConnectionClick = useCallback( (ev: React.MouseEvent) => { ev.preventDefault(); toggleSignalConnectionsModal(); }, [toggleSignalConnectionsModal] ); const onVerifiedClick = useCallback( (ev: React.MouseEvent) => { ev.preventDefault(); toggleSafetyNumberModal(conversation.id); }, [toggleSafetyNumberModal, conversation.id] ); let statusRow: JSX.Element | undefined; if (isMe) { // No status for ourselves } else if (conversation.isBlocked) { statusRow = (