From 7b3e613f7da1688c342f6f67fa0acf47dadb70bc Mon Sep 17 00:00:00 2001 From: "dimitar.nizamov" Date: Tue, 24 Jan 2023 12:52:51 +0100 Subject: [PATCH] avatar-letters-hotfix - add a fallback to `given_name` and `family_name` avatar letters --- 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 (