mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 08:24:55 +00:00
- Added the profile image or the initials if profile picture is missing to the grocery item
This commit is contained in:
@ -56,6 +56,10 @@ const GroceryItem = ({
|
||||
}
|
||||
};
|
||||
|
||||
const getInitials = (firstName: string, lastName: string) => {
|
||||
return `${firstName.charAt(0)}${lastName.charAt(0)}`;
|
||||
};
|
||||
|
||||
return (
|
||||
<View
|
||||
key={item.id}
|
||||
@ -142,17 +146,43 @@ const GroceryItem = ({
|
||||
<View height={0.7} backgroundColor="#e7e7e7" width={"98%"} />
|
||||
</View>
|
||||
<View paddingL-0 paddingT-12 flexS row centerV>
|
||||
<ImageBackground
|
||||
style={{
|
||||
width: 22.36,
|
||||
aspectRatio: 1,
|
||||
borderRadius: 50,
|
||||
backgroundColor: "red",
|
||||
marginRight: 10,
|
||||
overflow: "hidden",
|
||||
}}
|
||||
source={require("../../../assets/images/child-picture.png")}
|
||||
/>
|
||||
{profileData?.pfp ? <ImageBackground
|
||||
source={require("../../../assets/images/child-picture.png")}
|
||||
style={{
|
||||
height: 24.64,
|
||||
aspectRatio: 1,
|
||||
borderRadius: 22,
|
||||
overflow: "hidden",
|
||||
}}
|
||||
/> : <View
|
||||
style={{
|
||||
position: "relative",
|
||||
width: 24.64,
|
||||
aspectRatio: 1,
|
||||
marginRight: 4
|
||||
}}
|
||||
>
|
||||
<View
|
||||
style={{
|
||||
backgroundColor: "#ccc",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
borderRadius: 100, // Circular shape
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
style={{
|
||||
color: "#fff",
|
||||
fontSize: 12,
|
||||
fontWeight: "bold",
|
||||
}}
|
||||
>
|
||||
{getInitials(itemCreator.firstName, itemCreator.lastName ?? "")}
|
||||
</Text>
|
||||
</View>
|
||||
</View>}
|
||||
<Text color="#858585" style={styles.authorTxt}>
|
||||
Requested by {itemCreator?.firstName}
|
||||
</Text>
|
||||
|
||||
Reference in New Issue
Block a user