mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 16:34:54 +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 DropdownIcon from "@/assets/svgs/DropdownIcon";
|
||||
import {Dropdown} from "react-native-element-dropdown";
|
||||
import {useGetFamilyMembers} from "@/hooks/firebase/useGetFamilyMembers";
|
||||
import {ProfileType, useAuthContext} from "@/contexts/AuthContext";
|
||||
import {StyleSheet} from "react-native";
|
||||
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||
|
||||
const FILTER_OPTIONS = {
|
||||
ME: "Me",
|
||||
@ -108,13 +108,11 @@ const resolveFilterOptions = (members, user) => {
|
||||
return options;
|
||||
}
|
||||
|
||||
const ToDosList = ({ isSettings }: { isSettings?: boolean }) => {
|
||||
const ToDosList = ({ isSettings, members }: { isSettings?: boolean, members?: Array<UserProfile> }) => {
|
||||
const { toDos } = useToDosContext();
|
||||
|
||||
const [groupedToDos, setGroupedToDos] = useState([]);
|
||||
const { user } = useAuthContext()
|
||||
const { data: members } = useGetFamilyMembers();
|
||||
|
||||
|
||||
const [expandedGroups, setExpandedGroups] = useState<{
|
||||
[key: string]: boolean;
|
||||
@ -130,7 +128,7 @@ const ToDosList = ({ isSettings }: { isSettings?: boolean }) => {
|
||||
|
||||
let selectedOption = options?.find((option) => option.value === user?.uid);
|
||||
setSelectedFilter(selectedOption);
|
||||
}, []);
|
||||
}, [members]);
|
||||
|
||||
useEffect(() => {
|
||||
if (toDos && selectedFilter) {
|
||||
|
||||
@ -11,11 +11,14 @@ import FamilyChoresProgress from "./family-chores/FamilyChoresProgress";
|
||||
import UserChoresProgress from "./user-chores/UserChoresProgress";
|
||||
import { useAtom } from "jotai";
|
||||
import { toDosPageIndex } from "../calendar/atoms";
|
||||
import {useGetFamilyMembers} from "@/hooks/firebase/useGetFamilyMembers";
|
||||
|
||||
const ToDosPage = () => {
|
||||
const { profileData } = useAuthContext();
|
||||
const [pageIndex, setPageIndex] = useAtom(toDosPageIndex);
|
||||
|
||||
const { data: members } = useGetFamilyMembers();
|
||||
|
||||
const { width, height } = Dimensions.get("screen");
|
||||
const pageLink = (
|
||||
<TouchableOpacity onPress={() => setPageIndex(1)}>
|
||||
@ -65,7 +68,7 @@ const ToDosPage = () => {
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
<ToDosList />
|
||||
<ToDosList members={members} />
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user