// Copyright 2019 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; import classNames from 'classnames'; import type { ReadonlyDeep } from 'type-fest'; import { Avatar, AvatarBlur } from '../Avatar'; import { AvatarColors } from '../../types/Colors'; import { getName } from '../../types/EmbeddedContact'; import { AttachmentStatusIcon } from './AttachmentStatusIcon'; import type { LocalizerType } from '../../types/Util'; import type { EmbeddedContactForUIType } from '../../types/EmbeddedContact'; export function renderAvatar({ contact, direction, i18n, size, }: { contact: ReadonlyDeep; direction?: 'outgoing' | 'incoming'; i18n: LocalizerType; size: 52 | 80; }): JSX.Element { const { avatar } = contact; const avatarUrl = avatar && avatar.avatar && avatar.avatar.path; const title = getName(contact) || ''; const isAttachmentNotAvailable = Boolean( avatar?.avatar?.isPermanentlyUndownloadable ); const renderAttachmentDownloaded = () => ( ); return ( ); } export function renderName({ contact, isIncoming, module, }: { contact: ReadonlyDeep; isIncoming: boolean; module: string; }): JSX.Element { return (
{getName(contact)}
); } export function renderContactShorthand({ contact, isIncoming, module, }: { contact: ReadonlyDeep; isIncoming: boolean; module: string; }): JSX.Element { const { number: phoneNumber, email } = contact; const firstNumber = phoneNumber && phoneNumber[0] && phoneNumber[0].value; const firstEmail = email && email[0] && email[0].value; return (
{firstNumber || firstEmail}
); }