mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 00:24:53 +00:00
- Removed the pending grocery items check and decline buttons for every other types of profiles besides the parent profile
This commit is contained in:
@ -1,13 +1,14 @@
|
||||
import { Checkbox, Text, TouchableOpacity, View } from "react-native-ui-lib";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { AntDesign } from "@expo/vector-icons";
|
||||
import { GroceryCategory, useGroceryContext } from "@/contexts/GroceryContext";
|
||||
import {Checkbox, Text, TouchableOpacity, View} from "react-native-ui-lib";
|
||||
import React, {useEffect, useState} from "react";
|
||||
import {AntDesign} from "@expo/vector-icons";
|
||||
import {GroceryCategory, useGroceryContext} from "@/contexts/GroceryContext";
|
||||
import EditGroceryFrequency from "./EditGroceryFrequency";
|
||||
import EditGroceryItem from "./EditGroceryItem";
|
||||
import { ImageBackground, StyleSheet } from "react-native";
|
||||
import { IGrocery } from "@/hooks/firebase/types/groceryData";
|
||||
import {ImageBackground, StyleSheet} from "react-native";
|
||||
import {IGrocery} from "@/hooks/firebase/types/groceryData";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import { UserProfile } from "@/hooks/firebase/types/profileTypes";
|
||||
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||
import {ProfileType, useAuthContext} from "@/contexts/AuthContext";
|
||||
|
||||
const GroceryItem = ({
|
||||
item,
|
||||
@ -17,6 +18,8 @@ const GroceryItem = ({
|
||||
handleItemApproved: (id: string, changes: Partial<IGrocery>) => void;
|
||||
}) => {
|
||||
const { updateGroceryItem } = useGroceryContext();
|
||||
const { profileData } = useAuthContext();
|
||||
const isParent = profileData?.userType === ProfileType.PARENT;
|
||||
|
||||
const [openFreqEdit, setOpenFreqEdit] = useState<boolean>(false);
|
||||
const [isEditingTitle, setIsEditingTitle] = useState<boolean>(false);
|
||||
@ -97,25 +100,25 @@ const GroceryItem = ({
|
||||
)}
|
||||
{!item.approved ? (
|
||||
<View row centerV marginB-10>
|
||||
<AntDesign
|
||||
name="check"
|
||||
size={24}
|
||||
style={{
|
||||
color: item.approved ? "green" : "#aaaaaa",
|
||||
marginRight: 15,
|
||||
}}
|
||||
onPress={() => {
|
||||
handleItemApproved(item.id, { approved: true });
|
||||
}}
|
||||
{isParent && <><AntDesign
|
||||
name="check"
|
||||
size={24}
|
||||
style={{
|
||||
color: "green",
|
||||
marginRight: 15,
|
||||
}}
|
||||
onPress={() => {
|
||||
isParent ? handleItemApproved(item.id, { approved: true }) : null
|
||||
}}
|
||||
/>
|
||||
<AntDesign
|
||||
<AntDesign
|
||||
name="close"
|
||||
size={24}
|
||||
style={{ color: item.approved ? "#aaaaaa" : "red" }}
|
||||
style={{ color: "red" }}
|
||||
onPress={() => {
|
||||
handleItemApproved(item.id, { approved: false });
|
||||
}}
|
||||
/>
|
||||
isParent ? handleItemApproved(item.id, { approved: false }) : null
|
||||
}}
|
||||
/> </>}
|
||||
</View>
|
||||
) : (
|
||||
!isEditingTitle && (
|
||||
|
||||
Reference in New Issue
Block a user