feat: add avatar email fallback

This commit is contained in:
David Nguyen
2023-09-11 16:58:41 +10:00
parent 975d52a07e
commit fbf32404a6
6 changed files with 20 additions and 17 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('');