mirror of
https://github.com/urosran/cally.git
synced 2025-07-10 07:07:16 +00:00
Merge branch 'dev'
This commit is contained in:
@ -2,7 +2,8 @@ import {
|
||||
Button,
|
||||
ButtonSize,
|
||||
Colors,
|
||||
DateTimePicker, Dialog,
|
||||
DateTimePicker,
|
||||
Dialog,
|
||||
LoaderScreen,
|
||||
Modal,
|
||||
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 {useCreateEvent} from "@/hooks/firebase/useCreateEvent";
|
||||
import {EventData} from "@/hooks/firebase/types/eventData";
|
||||
import DropModalIcon from "@/assets/svgs/DropModalIcon";
|
||||
import {Alert, StyleSheet} from "react-native";
|
||||
import ClockIcon from "@/assets/svgs/ClockIcon";
|
||||
import LockIcon from "@/assets/svgs/LockIcon";
|
||||
@ -29,17 +29,12 @@ import MenuIcon from "@/assets/svgs/MenuIcon";
|
||||
import CameraIcon from "@/assets/svgs/CameraIcon";
|
||||
import AssigneesDisplay from "@/components/shared/AssigneesDisplay";
|
||||
import {useAtom} from "jotai";
|
||||
import {
|
||||
eventForEditAtom,
|
||||
selectedNewEventDateAtom,
|
||||
isAllDayAtom,
|
||||
} from "@/components/pages/calendar/atoms";
|
||||
import {eventForEditAtom, isAllDayAtom, selectedNewEventDateAtom,} from "@/components/pages/calendar/atoms";
|
||||
import {useGetFamilyMembers} from "@/hooks/firebase/useGetFamilyMembers";
|
||||
import BinIcon from "@/assets/svgs/BinIcon";
|
||||
import DeleteEventDialog from "./DeleteEventDialog";
|
||||
import {useDeleteEvent} from "@/hooks/firebase/useDeleteEvent";
|
||||
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 {Calendar} from "react-native-calendars";
|
||||
|
||||
@ -233,6 +228,7 @@ export const ManuallyAddEventModal = () => {
|
||||
attendees: selectedAttendees,
|
||||
notes: details,
|
||||
location: location,
|
||||
private: isPrivate
|
||||
};
|
||||
|
||||
if (editEvent?.id) eventData.id = editEvent?.id;
|
||||
|
@ -12,5 +12,6 @@ export interface EventData {
|
||||
reminders?: string[]
|
||||
id?: string | number,
|
||||
attendees?: string[],
|
||||
location?: string
|
||||
location?: string,
|
||||
private?: boolean
|
||||
}
|
@ -27,9 +27,14 @@ const fetchEvents = async (userId: string, profileData: UserProfile | undefined,
|
||||
let constraints;
|
||||
let familyId = profileData?.familyId;
|
||||
|
||||
if (isFamilyView || profileData?.userType === ProfileType.FAMILY_DEVICE) {
|
||||
if (profileData?.userType === ProfileType.FAMILY_DEVICE) {
|
||||
constraints = [
|
||||
eventsQuery.where("familyId", "==", familyId).where("private", "==", false),
|
||||
eventsQuery.where("familyId", "==", familyId)
|
||||
];
|
||||
} else {
|
||||
if (isFamilyView) {
|
||||
constraints = [
|
||||
eventsQuery.where("familyId", "==", familyId),
|
||||
eventsQuery.where("creatorId", "==", userId),
|
||||
eventsQuery.where("attendees", "array-contains", userId)
|
||||
];
|
||||
@ -39,6 +44,7 @@ const fetchEvents = async (userId: string, profileData: UserProfile | undefined,
|
||||
eventsQuery.where("attendees", "array-contains", userId)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
const snapshots = await Promise.all(constraints.map(query => query.get()));
|
||||
|
||||
|
Reference in New Issue
Block a user