mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 08:24:55 +00:00
- Fixed issue with todo filter not being updated after adding deleting users
This commit is contained in:
@ -7,9 +7,9 @@ import {AntDesign} from "@expo/vector-icons";
|
|||||||
import {IToDo} from "@/hooks/firebase/types/todoData";
|
import {IToDo} from "@/hooks/firebase/types/todoData";
|
||||||
import DropdownIcon from "@/assets/svgs/DropdownIcon";
|
import DropdownIcon from "@/assets/svgs/DropdownIcon";
|
||||||
import {Dropdown} from "react-native-element-dropdown";
|
import {Dropdown} from "react-native-element-dropdown";
|
||||||
import {useGetFamilyMembers} from "@/hooks/firebase/useGetFamilyMembers";
|
|
||||||
import {ProfileType, useAuthContext} from "@/contexts/AuthContext";
|
import {ProfileType, useAuthContext} from "@/contexts/AuthContext";
|
||||||
import {StyleSheet} from "react-native";
|
import {StyleSheet} from "react-native";
|
||||||
|
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||||
|
|
||||||
const FILTER_OPTIONS = {
|
const FILTER_OPTIONS = {
|
||||||
ME: "Me",
|
ME: "Me",
|
||||||
@ -108,13 +108,11 @@ const resolveFilterOptions = (members, user) => {
|
|||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ToDosList = ({ isSettings }: { isSettings?: boolean }) => {
|
const ToDosList = ({ isSettings, members }: { isSettings?: boolean, members?: Array<UserProfile> }) => {
|
||||||
const { toDos } = useToDosContext();
|
const { toDos } = useToDosContext();
|
||||||
|
|
||||||
const [groupedToDos, setGroupedToDos] = useState([]);
|
const [groupedToDos, setGroupedToDos] = useState([]);
|
||||||
const { user } = useAuthContext()
|
const { user } = useAuthContext()
|
||||||
const { data: members } = useGetFamilyMembers();
|
|
||||||
|
|
||||||
|
|
||||||
const [expandedGroups, setExpandedGroups] = useState<{
|
const [expandedGroups, setExpandedGroups] = useState<{
|
||||||
[key: string]: boolean;
|
[key: string]: boolean;
|
||||||
@ -130,7 +128,7 @@ const ToDosList = ({ isSettings }: { isSettings?: boolean }) => {
|
|||||||
|
|
||||||
let selectedOption = options?.find((option) => option.value === user?.uid);
|
let selectedOption = options?.find((option) => option.value === user?.uid);
|
||||||
setSelectedFilter(selectedOption);
|
setSelectedFilter(selectedOption);
|
||||||
}, []);
|
}, [members]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (toDos && selectedFilter) {
|
if (toDos && selectedFilter) {
|
||||||
|
|||||||
@ -11,11 +11,14 @@ import FamilyChoresProgress from "./family-chores/FamilyChoresProgress";
|
|||||||
import UserChoresProgress from "./user-chores/UserChoresProgress";
|
import UserChoresProgress from "./user-chores/UserChoresProgress";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { toDosPageIndex } from "../calendar/atoms";
|
import { toDosPageIndex } from "../calendar/atoms";
|
||||||
|
import {useGetFamilyMembers} from "@/hooks/firebase/useGetFamilyMembers";
|
||||||
|
|
||||||
const ToDosPage = () => {
|
const ToDosPage = () => {
|
||||||
const { profileData } = useAuthContext();
|
const { profileData } = useAuthContext();
|
||||||
const [pageIndex, setPageIndex] = useAtom(toDosPageIndex);
|
const [pageIndex, setPageIndex] = useAtom(toDosPageIndex);
|
||||||
|
|
||||||
|
const { data: members } = useGetFamilyMembers();
|
||||||
|
|
||||||
const { width, height } = Dimensions.get("screen");
|
const { width, height } = Dimensions.get("screen");
|
||||||
const pageLink = (
|
const pageLink = (
|
||||||
<TouchableOpacity onPress={() => setPageIndex(1)}>
|
<TouchableOpacity onPress={() => setPageIndex(1)}>
|
||||||
@ -65,7 +68,7 @@ const ToDosPage = () => {
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
<ToDosList />
|
<ToDosList members={members} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user