diff --git a/components/pages/grocery/GroceryItem.tsx b/components/pages/grocery/GroceryItem.tsx index 32c79ad..72f19cd 100644 --- a/components/pages/grocery/GroceryItem.tsx +++ b/components/pages/grocery/GroceryItem.tsx @@ -83,11 +83,15 @@ const GroceryItem = ({ /> {!isEditingTitle ? ( - setIsEditingTitle(true)}> + { isParent ? setIsEditingTitle(true)}> {item.title} - + : + + {item.title} + + } ) : ( { const { updateToDo } = useToDosContext(); const { data: members } = useGetFamilyMembers(); + const { profileData } = useAuthContext(); + const isParent = profileData?.userType === ProfileType.PARENT; + const [visible, setVisible] = useState(false); const [points, setPoints] = useState(props.item.points); const [pointsModalVisible, setPointsModalVisible] = useState(false); @@ -41,6 +45,14 @@ const ToDoItem = (props: { item: IToDo; isSettings?: boolean }) => { const selectedMembers = members?.filter((x) => props?.item?.assignees?.includes(x?.uid!) ); + + let isTodoEditable; + if (isParent) { + isTodoEditable = true + } else { + isTodoEditable = props.item.creatorId === profileData?.uid; + } + return ( { fontSize: 15, }} onPress={() => { - setVisible(true); + isTodoEditable ? setVisible(true) : null }} > {props.item.title}