mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 16:34:54 +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:
@ -8,6 +8,7 @@ import { ImageBackground, StyleSheet } from "react-native";
|
|||||||
import {IGrocery} from "@/hooks/firebase/types/groceryData";
|
import {IGrocery} from "@/hooks/firebase/types/groceryData";
|
||||||
import firestore from "@react-native-firebase/firestore";
|
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 = ({
|
const GroceryItem = ({
|
||||||
item,
|
item,
|
||||||
@ -17,6 +18,8 @@ const GroceryItem = ({
|
|||||||
handleItemApproved: (id: string, changes: Partial<IGrocery>) => void;
|
handleItemApproved: (id: string, changes: Partial<IGrocery>) => void;
|
||||||
}) => {
|
}) => {
|
||||||
const { updateGroceryItem } = useGroceryContext();
|
const { updateGroceryItem } = useGroceryContext();
|
||||||
|
const { profileData } = useAuthContext();
|
||||||
|
const isParent = profileData?.userType === ProfileType.PARENT;
|
||||||
|
|
||||||
const [openFreqEdit, setOpenFreqEdit] = useState<boolean>(false);
|
const [openFreqEdit, setOpenFreqEdit] = useState<boolean>(false);
|
||||||
const [isEditingTitle, setIsEditingTitle] = useState<boolean>(false);
|
const [isEditingTitle, setIsEditingTitle] = useState<boolean>(false);
|
||||||
@ -97,25 +100,25 @@ const GroceryItem = ({
|
|||||||
)}
|
)}
|
||||||
{!item.approved ? (
|
{!item.approved ? (
|
||||||
<View row centerV marginB-10>
|
<View row centerV marginB-10>
|
||||||
<AntDesign
|
{isParent && <><AntDesign
|
||||||
name="check"
|
name="check"
|
||||||
size={24}
|
size={24}
|
||||||
style={{
|
style={{
|
||||||
color: item.approved ? "green" : "#aaaaaa",
|
color: "green",
|
||||||
marginRight: 15,
|
marginRight: 15,
|
||||||
}}
|
}}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleItemApproved(item.id, { approved: true });
|
isParent ? handleItemApproved(item.id, { approved: true }) : null
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<AntDesign
|
<AntDesign
|
||||||
name="close"
|
name="close"
|
||||||
size={24}
|
size={24}
|
||||||
style={{ color: item.approved ? "#aaaaaa" : "red" }}
|
style={{ color: "red" }}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleItemApproved(item.id, { approved: false });
|
isParent ? handleItemApproved(item.id, { approved: false }) : null
|
||||||
}}
|
}}
|
||||||
/>
|
/> </>}
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
!isEditingTitle && (
|
!isEditingTitle && (
|
||||||
|
|||||||
Reference in New Issue
Block a user