import { Skeleton } from '../../../../components/ui/skeleton';
import { InboxAvatar } from '../../MessagesPage/InboxRow';
import type { RowName } from '../../../../utils/messaging/counterpartyRowName';
// The row's name: a placeholder while the record loads, a muted sentence when it cannot be named.
// The placeholder is a span because the name sits inside a paragraph, where the div Skeleton cannot go.
export const CounterpartyName = ({ name }: { name: RowName }) => {
if (name.kind === 'pending') {
return (
Loading nameā¦
);
}
if (name.kind === 'unavailable') return {name.text};
return <>{name.text}>;
};
// Initials only from a real name; a placeholder or a sentence has none. The shared wrap keeps the avatar
// its size beside a long preview, which otherwise squeezed a photo to a sliver.
export const CounterpartyAvatar = ({ name, imageUrl }: { name: RowName; imageUrl?: string }) => (
: undefined}
/>
);