mirror of
https://github.com/urosran/cally.git
synced 2025-07-10 15:17:17 +00:00
- Fixed events fetching in family view because there are events that don't have the private field
- Implemented marking events as private
This commit is contained in:
@ -2,7 +2,8 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
ButtonSize,
|
ButtonSize,
|
||||||
Colors,
|
Colors,
|
||||||
DateTimePicker, Dialog,
|
DateTimePicker,
|
||||||
|
Dialog,
|
||||||
LoaderScreen,
|
LoaderScreen,
|
||||||
Modal,
|
Modal,
|
||||||
Picker,
|
Picker,
|
||||||
@ -21,7 +22,6 @@ import {AntDesign, Feather, Ionicons} from "@expo/vector-icons";
|
|||||||
import {PickerMultiValue} from "react-native-ui-lib/src/components/picker/types";
|
import {PickerMultiValue} from "react-native-ui-lib/src/components/picker/types";
|
||||||
import {useCreateEvent} from "@/hooks/firebase/useCreateEvent";
|
import {useCreateEvent} from "@/hooks/firebase/useCreateEvent";
|
||||||
import {EventData} from "@/hooks/firebase/types/eventData";
|
import {EventData} from "@/hooks/firebase/types/eventData";
|
||||||
import DropModalIcon from "@/assets/svgs/DropModalIcon";
|
|
||||||
import {Alert, StyleSheet} from "react-native";
|
import {Alert, StyleSheet} from "react-native";
|
||||||
import ClockIcon from "@/assets/svgs/ClockIcon";
|
import ClockIcon from "@/assets/svgs/ClockIcon";
|
||||||
import LockIcon from "@/assets/svgs/LockIcon";
|
import LockIcon from "@/assets/svgs/LockIcon";
|
||||||
@ -29,17 +29,12 @@ import MenuIcon from "@/assets/svgs/MenuIcon";
|
|||||||
import CameraIcon from "@/assets/svgs/CameraIcon";
|
import CameraIcon from "@/assets/svgs/CameraIcon";
|
||||||
import AssigneesDisplay from "@/components/shared/AssigneesDisplay";
|
import AssigneesDisplay from "@/components/shared/AssigneesDisplay";
|
||||||
import {useAtom} from "jotai";
|
import {useAtom} from "jotai";
|
||||||
import {
|
import {eventForEditAtom, isAllDayAtom, selectedNewEventDateAtom,} from "@/components/pages/calendar/atoms";
|
||||||
eventForEditAtom,
|
|
||||||
selectedNewEventDateAtom,
|
|
||||||
isAllDayAtom,
|
|
||||||
} from "@/components/pages/calendar/atoms";
|
|
||||||
import {useGetFamilyMembers} from "@/hooks/firebase/useGetFamilyMembers";
|
import {useGetFamilyMembers} from "@/hooks/firebase/useGetFamilyMembers";
|
||||||
import BinIcon from "@/assets/svgs/BinIcon";
|
|
||||||
import DeleteEventDialog from "./DeleteEventDialog";
|
import DeleteEventDialog from "./DeleteEventDialog";
|
||||||
import {useDeleteEvent} from "@/hooks/firebase/useDeleteEvent";
|
import {useDeleteEvent} from "@/hooks/firebase/useDeleteEvent";
|
||||||
import AddPersonIcon from "@/assets/svgs/AddPersonIcon";
|
import AddPersonIcon from "@/assets/svgs/AddPersonIcon";
|
||||||
import {addHours, format, startOfHour, startOfMinute} from "date-fns";
|
import {addHours, format, startOfMinute} from "date-fns";
|
||||||
import {ProfileType, useAuthContext} from "@/contexts/AuthContext";
|
import {ProfileType, useAuthContext} from "@/contexts/AuthContext";
|
||||||
import {Calendar} from "react-native-calendars";
|
import {Calendar} from "react-native-calendars";
|
||||||
|
|
||||||
@ -233,6 +228,7 @@ export const ManuallyAddEventModal = () => {
|
|||||||
attendees: selectedAttendees,
|
attendees: selectedAttendees,
|
||||||
notes: details,
|
notes: details,
|
||||||
location: location,
|
location: location,
|
||||||
|
private: isPrivate
|
||||||
};
|
};
|
||||||
|
|
||||||
if (editEvent?.id) eventData.id = editEvent?.id;
|
if (editEvent?.id) eventData.id = editEvent?.id;
|
||||||
|
@ -12,5 +12,6 @@ export interface EventData {
|
|||||||
reminders?: string[]
|
reminders?: string[]
|
||||||
id?: string | number,
|
id?: string | number,
|
||||||
attendees?: string[],
|
attendees?: string[],
|
||||||
location?: string
|
location?: string,
|
||||||
|
private?: boolean
|
||||||
}
|
}
|
@ -29,7 +29,7 @@ const fetchEvents = async (userId: string, profileData: UserProfile | undefined,
|
|||||||
|
|
||||||
if (isFamilyView || profileData?.userType === ProfileType.FAMILY_DEVICE) {
|
if (isFamilyView || profileData?.userType === ProfileType.FAMILY_DEVICE) {
|
||||||
constraints = [
|
constraints = [
|
||||||
eventsQuery.where("familyId", "==", familyId).where("private", "==", false),
|
eventsQuery.where("familyId", "==", familyId).where("private", "not-in", [true]),
|
||||||
eventsQuery.where("creatorId", "==", userId),
|
eventsQuery.where("creatorId", "==", userId),
|
||||||
eventsQuery.where("attendees", "array-contains", userId)
|
eventsQuery.where("attendees", "array-contains", userId)
|
||||||
];
|
];
|
||||||
|
Reference in New Issue
Block a user