mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
feat: add avatar email fallback
This commit is contained in:
7
packages/lib/client-only/recipient-avatar-fallback.ts
Normal file
7
packages/lib/client-only/recipient-avatar-fallback.ts
Normal 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();
|
||||
};
|
||||
@ -3,4 +3,4 @@ export const initials = (text: string) =>
|
||||
?.split(' ')
|
||||
.map((name: string) => name.slice(0, 1).toUpperCase())
|
||||
.slice(0, 2)
|
||||
.join('') ?? 'UK';
|
||||
.join('');
|
||||
|
||||
Reference in New Issue
Block a user