From 731af8a3b8f2c7ec8a8bf409e4546581d214b896 Mon Sep 17 00:00:00 2001 From: Dejan Date: Sat, 26 Oct 2024 14:58:44 +0200 Subject: [PATCH] - Added the profile image or the initials if profile picture is missing to the grocery item --- components/pages/grocery/GroceryItem.tsx | 52 +++++++++++++++++++----- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/components/pages/grocery/GroceryItem.tsx b/components/pages/grocery/GroceryItem.tsx index dbc6047..32c79ad 100644 --- a/components/pages/grocery/GroceryItem.tsx +++ b/components/pages/grocery/GroceryItem.tsx @@ -56,6 +56,10 @@ const GroceryItem = ({ } }; + const getInitials = (firstName: string, lastName: string) => { + return `${firstName.charAt(0)}${lastName.charAt(0)}`; + }; + return ( - + {profileData?.pfp ? : + + + {getInitials(itemCreator.firstName, itemCreator.lastName ?? "")} + + + } Requested by {itemCreator?.firstName}