mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 08:24:55 +00:00
Merge branch 'main' into dev
This commit is contained in:
@ -1,12 +1,7 @@
|
|||||||
import { View, Text } from "react-native";
|
import {Text, View} from "react-native";
|
||||||
import React, { RefObject, useEffect, useRef, useState } from "react";
|
import React, {useEffect, useRef} from "react";
|
||||||
import { TextField, TextFieldRef } from "react-native-ui-lib";
|
import {TextField, TextFieldRef} from "react-native-ui-lib";
|
||||||
import {
|
import {GroceryCategory, IGrocery, useGroceryContext,} from "@/contexts/GroceryContext";
|
||||||
GroceryCategory,
|
|
||||||
IGrocery,
|
|
||||||
useGroceryContext,
|
|
||||||
} from "@/contexts/GroceryContext";
|
|
||||||
import { TouchableWithoutFeedback } from "react-native-gesture-handler";
|
|
||||||
|
|
||||||
interface IEditGrocery {
|
interface IEditGrocery {
|
||||||
id?: number;
|
id?: number;
|
||||||
@ -19,8 +14,8 @@ interface IEditGrocery {
|
|||||||
closeEdit?: (value: boolean) => void;
|
closeEdit?: (value: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EditGroceryItem = ({ editGrocery }: { editGrocery: IEditGrocery }) => {
|
const EditGroceryItem = ({editGrocery}: { editGrocery: IEditGrocery }) => {
|
||||||
const { fuzzyMatchGroceryCategory } = useGroceryContext();
|
const {fuzzyMatchGroceryCategory} = useGroceryContext();
|
||||||
const inputRef = useRef<TextFieldRef>(null);
|
const inputRef = useRef<TextFieldRef>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -41,9 +36,12 @@ const EditGroceryItem = ({ editGrocery }: { editGrocery: IEditGrocery }) => {
|
|||||||
width: "100%",
|
width: "100%",
|
||||||
borderRadius: 25,
|
borderRadius: 25,
|
||||||
padding: 15,
|
padding: 15,
|
||||||
|
marginTop: 10
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TextField
|
<TextField
|
||||||
|
text70T
|
||||||
|
style={{fontWeight: "400"}}
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
placeholder="Grocery"
|
placeholder="Grocery"
|
||||||
value={editGrocery.title}
|
value={editGrocery.title}
|
||||||
|
|||||||
@ -75,7 +75,7 @@ const GroceryItem = ({
|
|||||||
{!isEditingTitle ? (
|
{!isEditingTitle ? (
|
||||||
<View>
|
<View>
|
||||||
<TouchableOpacity onPress={() => setIsEditingTitle(true)}>
|
<TouchableOpacity onPress={() => setIsEditingTitle(true)}>
|
||||||
<Text text70T>{item.title}</Text>
|
<Text text70T black style={{fontWeight: "400"}}>{item.title}</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@ -178,7 +178,6 @@ const GroceryList = () => {
|
|||||||
{/* Approved Section */}
|
{/* Approved Section */}
|
||||||
<View row spread marginT-40 marginB-0 centerV>
|
<View row spread marginT-40 marginB-0 centerV>
|
||||||
<View row centerV>
|
<View row centerV>
|
||||||
<Text text70BL>Shopping List</Text>
|
|
||||||
{approvedVisible && (
|
{approvedVisible && (
|
||||||
<AntDesign
|
<AntDesign
|
||||||
name="down"
|
name="down"
|
||||||
@ -201,6 +200,7 @@ const GroceryList = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
<Text text70BL>Shopping List</Text>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View
|
||||||
centerV
|
centerV
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
import {useAuthContext} from "@/contexts/AuthContext";
|
import {useAuthContext} from "@/contexts/AuthContext";
|
||||||
import {useMutation} from "react-query";
|
import {useMutation, useQueryClient} from "react-query";
|
||||||
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 {FirebaseAuthTypes} from "@react-native-firebase/auth";
|
import {FirebaseAuthTypes} from "@react-native-firebase/auth";
|
||||||
|
|
||||||
export const useUpdateUserData = () => {
|
export const useUpdateUserData = () => {
|
||||||
const {user: currentUser, refreshProfileData} = useAuthContext();
|
const {user: currentUser, refreshProfileData} = useAuthContext();
|
||||||
|
const queryClient = useQueryClient()
|
||||||
|
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationKey: ["updateUserData"],
|
mutationKey: ["updateUserData"],
|
||||||
@ -35,6 +36,9 @@ export const useUpdateUserData = () => {
|
|||||||
} else {
|
} else {
|
||||||
console.warn("No user found: currentUser and customUser are both undefined.");
|
console.warn("No user found: currentUser and customUser are both undefined.");
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries("events")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user