From 5c833b9099eed2ffe7b5feeeef44a85de795883a Mon Sep 17 00:00:00 2001 From: Dimitar Nizamov Date: Tue, 24 Jan 2023 13:11:31 +0100 Subject: [PATCH] avatar-letters-hotfix - add a fallback to `given_name` and `family_name` avatar letters (#1300) --- src/components/layout/nav/PrivateMenu.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/layout/nav/PrivateMenu.tsx b/src/components/layout/nav/PrivateMenu.tsx index 86fa6dbbd..9bbd4cbf2 100644 --- a/src/components/layout/nav/PrivateMenu.tsx +++ b/src/components/layout/nav/PrivateMenu.tsx @@ -61,9 +61,9 @@ export default function PrivateMenu() { } const title = `${session?.user?.name}\n(${session?.user?.email})` - const lettersAvatar = `${session.user?.given_name.charAt(0)}${session.user?.family_name.charAt( - 0, - )}`.toUpperCase() + const lettersAvatar = `${session.user?.given_name?.charAt(0) || session.user?.email?.charAt(0)}${ + session.user?.family_name?.charAt(0) || session.user?.email?.charAt(1) + }`.toUpperCase() return (