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 (
|
return (
|
||||||
<View
|
<View
|
||||||
key={item.id}
|
key={item.id}
|
||||||
@ -142,17 +146,43 @@ const GroceryItem = ({
|
|||||||
<View height={0.7} backgroundColor="#e7e7e7" width={"98%"} />
|
<View height={0.7} backgroundColor="#e7e7e7" width={"98%"} />
|
||||||
</View>
|
</View>
|
||||||
<View paddingL-0 paddingT-12 flexS row centerV>
|
<View paddingL-0 paddingT-12 flexS row centerV>
|
||||||
<ImageBackground
|
{profileData?.pfp ? <ImageBackground
|
||||||
|
source={require("../../../assets/images/child-picture.png")}
|
||||||
style={{
|
style={{
|
||||||
width: 22.36,
|
height: 24.64,
|
||||||
aspectRatio: 1,
|
aspectRatio: 1,
|
||||||
borderRadius: 50,
|
borderRadius: 22,
|
||||||
backgroundColor: "red",
|
|
||||||
marginRight: 10,
|
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
}}
|
}}
|
||||||
source={require("../../../assets/images/child-picture.png")}
|
/> : <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}>
|
<Text color="#858585" style={styles.authorTxt}>
|
||||||
Requested by {itemCreator?.firstName}
|
Requested by {itemCreator?.firstName}
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
Reference in New Issue
Block a user