feat: add avatar email fallback

This commit is contained in:
David Nguyen
2023-09-11 16:58:41 +10:00
committed by Mythie
parent 41d46c82d1
commit 48e58d4675
6 changed files with 20 additions and 18 deletions

View File

@ -0,0 +1,7 @@
import { Recipient } from '@documenso/prisma/client';
import { initials } from './recipient-initials';
export const recipientAvatarFallback = (recipient: Recipient) => {
return initials(recipient.name) || recipient.email.slice(0, 1).toUpperCase();
};

View File

@ -3,4 +3,4 @@ export const initials = (text: string) =>
?.split(' ')
.map((name: string) => name.slice(0, 1).toUpperCase())
.slice(0, 2)
.join('') ?? 'UK';
.join('');