todo filtering, nanny shopping

This commit is contained in:
ivic00
2024-12-06 23:31:27 +01:00
parent 8526d79ba1
commit a17e0f1e22
7 changed files with 92 additions and 55 deletions

View File

@ -25,6 +25,7 @@ const GroceryItem = ({
const { profileData } = useAuthContext();
const { data: creator } = useGetUserById(item.creatorId);
const isParent = profileData?.userType === ProfileType.PARENT;
const isCaregiver = profileData?.userType === ProfileType.CAREGIVER;
const [openFreqEdit, setOpenFreqEdit] = useState<boolean>(false);
const [isEditingTitle, setIsEditingTitle] = useState<boolean>(false);
@ -36,7 +37,7 @@ const GroceryItem = ({
const closeEdit = () => setIsEditingTitle(false);
const getInitials = (firstName: string, lastName: string) => {
return `${firstName.charAt(0)}${lastName.charAt(0)}`;
return `${firstName.charAt(0).toUpperCase()}${lastName.charAt(0).toUpperCase()}`;
};
return (
@ -81,7 +82,7 @@ const GroceryItem = ({
/>
) : (
<View flex>
{isParent ? (
{(isParent || isCaregiver) && !item.bought ? (
<TouchableOpacity onPress={() => setIsEditingTitle(true)}>
<Text
text70T
@ -98,7 +99,7 @@ const GroceryItem = ({
) : (
<Text
text70T
style={[styles.title, { color: item.bought ? "red" : "black" }]}
style={[styles.title, { textDecorationLine: item.bought ? "line-through" : "none", }]}
>
{item.title}
</Text>
@ -108,7 +109,7 @@ const GroceryItem = ({
{!item.approved ? (
<View row centerV>
{isParent && (
{isParent || isCaregiver && (
<>
<AntDesign
name="check"
@ -132,7 +133,7 @@ const GroceryItem = ({
</View>
) : (
!isEditingTitle &&
isParent && (
(isParent || isCaregiver) && (
<Checkbox
value={item.bought}
containerStyle={[styles.checkbox, { borderRadius: 50 }]}
@ -180,7 +181,7 @@ const GroceryItem = ({
width: 24.64,
aspectRatio: 1,
marginRight: 8,
backgroundColor: "#ccc",
backgroundColor: creator?.eventColor || "gray",
borderRadius: 100,
justifyContent: "center",
alignItems: "center",