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:
@ -44,10 +44,6 @@ const UsersList = () => {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.log(selectedUser);
|
||||
}, [selectedUser]);
|
||||
|
||||
return (
|
||||
<View centerH paddingT-10 marginB-70>
|
||||
{sortedMembers?.map((member, index) => (
|
||||
|
@ -19,7 +19,7 @@ import {Text} from "react-native-ui-lib";
|
||||
import {addDays, compareAsc, format, isWithinInterval, subDays} from "date-fns";
|
||||
import {useCalSync} from "@/hooks/useCalSync";
|
||||
import {useSyncEvents} from "@/hooks/useSyncOnScroll";
|
||||
import {colorMap} from "@/constants/colorMap";
|
||||
import {colorMap, getEventTextColor} from "@/constants/colorMap";
|
||||
import {useGetFamilyMembers} from "@/hooks/firebase/useGetFamilyMembers";
|
||||
import CachedImage from "expo-cached-image";
|
||||
import { DeviceType } from "expo-device";
|
||||
@ -111,7 +111,7 @@ export const MonthCalendar: React.FC<EventCalendarProps> = React.memo(
|
||||
eventColor = profileData?.eventColor ?? colorMap.teal;
|
||||
}
|
||||
|
||||
return {backgroundColor: eventColor, fontSize: 14}
|
||||
return {backgroundColor: eventColor, fontSize: 14, color: getEventTextColor(event?.eventColor)}
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
@ -1,16 +1,22 @@
|
||||
import {Button, Text, TextField, View} from "react-native-ui-lib";
|
||||
import React, {useState} from "react";
|
||||
import {StyleSheet} from "react-native";
|
||||
import {useResetPassword} from "@/hooks/firebase/useResetPassword";
|
||||
import { Button, ButtonSize, Text, TextField, View } from "react-native-ui-lib";
|
||||
import React, { useState } from "react";
|
||||
import { StyleSheet } from "react-native";
|
||||
import { useResetPassword } from "@/hooks/firebase/useResetPassword";
|
||||
import { router } from "expo-router";
|
||||
|
||||
export const ResetPasswordPage = () => {
|
||||
const [email, setEmail] = useState<string>("");
|
||||
|
||||
const {mutateAsync: resetPassword, error, isError, isLoading} = useResetPassword();
|
||||
const {
|
||||
mutateAsync: resetPassword,
|
||||
error,
|
||||
isError,
|
||||
isLoading,
|
||||
} = useResetPassword();
|
||||
|
||||
const handleResetPassword = async () => {
|
||||
await resetPassword({email});
|
||||
alert("Password reset, please check your email")
|
||||
await resetPassword({ email });
|
||||
alert("Password reset, please check your email");
|
||||
};
|
||||
|
||||
return (
|
||||
@ -32,8 +38,25 @@ export const ResetPasswordPage = () => {
|
||||
backgroundColor="#fd1775"
|
||||
disabled={isLoading}
|
||||
/>
|
||||
<View>
|
||||
<Button
|
||||
onPress={() => router.push("/(unauth)/sign_in")}
|
||||
label="Back"
|
||||
labelStyle={[
|
||||
styles.jakartaMedium,
|
||||
{ textDecorationLine: "none", color: "#fd1575" },
|
||||
]}
|
||||
link
|
||||
size={ButtonSize.xSmall}
|
||||
padding-0
|
||||
margin-0
|
||||
text70
|
||||
left
|
||||
color="#fd1775"
|
||||
/>
|
||||
</View>
|
||||
|
||||
{isError && <Text center style={{marginBottom: 20}}>{`${error}`}</Text>}
|
||||
{isError && <Text center style={{ marginBottom: 20 }}>{`${error}`}</Text>}
|
||||
</View>
|
||||
);
|
||||
};
|
||||
@ -46,4 +69,10 @@ const styles = StyleSheet.create({
|
||||
height: 45,
|
||||
borderRadius: 50,
|
||||
},
|
||||
jakartaMedium: {
|
||||
fontFamily: "PlusJakartaSans_500Medium",
|
||||
fontSize: 16,
|
||||
color: "#919191",
|
||||
textDecorationLine: "underline",
|
||||
},
|
||||
});
|
||||
|
@ -106,7 +106,7 @@ const SignInPage = () => {
|
||||
style={{
|
||||
flex: 1,
|
||||
padding: 21,
|
||||
paddingBottom: 45,
|
||||
paddingBottom: 30,
|
||||
paddingTop: isLoading ? "20%" : getTopPadding(),
|
||||
width: isLoading ? "100%" : isTablet ? 629 : undefined,
|
||||
}}
|
||||
@ -205,6 +205,23 @@ const SignInPage = () => {
|
||||
color="#fd1775"
|
||||
/>
|
||||
</View>
|
||||
<View>
|
||||
<Button
|
||||
onPress={() => router.replace("/(unauth)/reset_password")}
|
||||
label="Reset Password"
|
||||
labelStyle={[
|
||||
styles.jakartaMedium,
|
||||
{ textDecorationLine: "none", color: "#fd1575" },
|
||||
]}
|
||||
link
|
||||
size={ButtonSize.xSmall}
|
||||
padding-0
|
||||
margin-0
|
||||
text70
|
||||
left
|
||||
color="#fd1775"
|
||||
/>
|
||||
</View>
|
||||
|
||||
{/*<View row centerH marginB-5 gap-5>*/}
|
||||
{/* <Text text70>Forgot your password?</Text>*/}
|
||||
|
@ -43,7 +43,7 @@ const SettingsPage = () => {
|
||||
{pageIndex == 0 && (
|
||||
<View flexG centerH marginH-30 marginT-30>
|
||||
<Button
|
||||
disabled={false}
|
||||
disabled={isntParent}
|
||||
backgroundColor="white"
|
||||
style={styles.mainBtn}
|
||||
children={
|
||||
|
@ -78,6 +78,8 @@ const UpdateUserDialog = ({ open, handleClose, profileData }: Props) => {
|
||||
allowsEditing: true,
|
||||
aspect: [1, 1],
|
||||
quality: 1,
|
||||
base64: false,
|
||||
exif: false,
|
||||
});
|
||||
|
||||
if (!result.canceled) {
|
||||
|
@ -1,10 +1,11 @@
|
||||
import {useQuery, useQueryClient} from "@tanstack/react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {ProfileType, useAuthContext} from "@/contexts/AuthContext";
|
||||
import {useAtomValue} from "jotai";
|
||||
import {isFamilyViewAtom} from "@/components/pages/calendar/atoms";
|
||||
import {colorMap} from "@/constants/colorMap";
|
||||
import {useEffect, useRef} from "react";
|
||||
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||
|
||||
const createEventHash = (event: any): string => {
|
||||
const str = `${event.startDate?.seconds || ''}-${event.endDate?.seconds || ''}-${
|
||||
@ -20,12 +21,13 @@ const createEventHash = (event: any): string => {
|
||||
return hash.toString(36);
|
||||
};
|
||||
|
||||
const fetchEvents = async (userId: string, familyId: string | undefined, isFamilyView: boolean) => {
|
||||
const fetchEvents = async (userId: string, profileData: UserProfile | undefined, isFamilyView: boolean) => {
|
||||
const db = firestore();
|
||||
const eventsQuery = db.collection("Events");
|
||||
let constraints = [];
|
||||
let constraints;
|
||||
let familyId = profileData?.familyId;
|
||||
|
||||
if (isFamilyView) {
|
||||
if (isFamilyView || profileData?.userType === ProfileType.FAMILY_DEVICE) {
|
||||
constraints = [
|
||||
eventsQuery.where("familyId", "==", familyId).where("private", "==", false),
|
||||
eventsQuery.where("creatorId", "==", userId),
|
||||
@ -99,13 +101,13 @@ export const useGetEvents = () => {
|
||||
const prefetchEvents = async () => {
|
||||
await queryClient.prefetchQuery({
|
||||
queryKey: ["events", user.uid, false], // Personal events
|
||||
queryFn: () => fetchEvents(user.uid, profileData.familyId, false),
|
||||
queryFn: () => fetchEvents(user.uid, profileData, false),
|
||||
staleTime: 5 * 60 * 1000,
|
||||
});
|
||||
|
||||
await queryClient.prefetchQuery({
|
||||
queryKey: ["events", user.uid, true], // Family events
|
||||
queryFn: () => fetchEvents(user.uid, profileData.familyId, true),
|
||||
queryFn: () => fetchEvents(user.uid, profileData, true),
|
||||
staleTime: 5 * 60 * 1000,
|
||||
});
|
||||
};
|
||||
@ -141,7 +143,7 @@ export const useGetEvents = () => {
|
||||
|
||||
return useQuery({
|
||||
queryKey: ["events", user?.uid, isFamilyView],
|
||||
queryFn: () => fetchEvents(user?.uid!, profileData?.familyId, isFamilyView),
|
||||
queryFn: () => fetchEvents(user?.uid!, profileData, isFamilyView),
|
||||
staleTime: Infinity,
|
||||
gcTime: Infinity,
|
||||
placeholderData: (previousData) => previousData,
|
||||
|
Reference in New Issue
Block a user