mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 08:24:55 +00:00
ui fixes and date press feature
This commit is contained in:
@ -71,12 +71,19 @@ export const EventCalendar: React.FC<EventCalendarProps> = React.memo(
|
|||||||
|
|
||||||
const handlePressDayHeader = useCallback(
|
const handlePressDayHeader = useCallback(
|
||||||
(date: Date) => {
|
(date: Date) => {
|
||||||
setIsAllDay(true);
|
if (mode === "day") {
|
||||||
console.log(isAllDay);
|
setIsAllDay(true);
|
||||||
setSelectedNewEndDate(date);
|
setSelectedNewEndDate(date);
|
||||||
setEditVisible(true);
|
setEditVisible(true);
|
||||||
|
}
|
||||||
|
if (mode === 'week')
|
||||||
|
{
|
||||||
|
setSelectedDate(date)
|
||||||
|
|
||||||
|
setMode("day")
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[setSelectedNewEndDate]
|
[mode, setSelectedNewEndDate]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleSwipeEnd = useCallback(
|
const handleSwipeEnd = useCallback(
|
||||||
|
|||||||
@ -81,11 +81,9 @@ export const ManuallyAddEventModal = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log(allDayAtom);
|
if(allDayAtom === true) setIsAllDay(true);
|
||||||
return () => {
|
}, [allDayAtom])
|
||||||
setAllDayAtom(false);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const [startTime, setStartTime] = useState(() => {
|
const [startTime, setStartTime] = useState(() => {
|
||||||
const date = initialDate ?? new Date();
|
const date = initialDate ?? new Date();
|
||||||
|
|||||||
@ -142,9 +142,15 @@ const SignUpPage = () => {
|
|||||||
<View gap-5 marginT-15>
|
<View gap-5 marginT-15>
|
||||||
<View row centerV>
|
<View row centerV>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
style={[styles.check]}
|
style={[
|
||||||
|
styles.check,
|
||||||
|
{ borderRadius: 3, width: 18, height: 18 },
|
||||||
|
]}
|
||||||
color="#919191"
|
color="#919191"
|
||||||
|
size={18}
|
||||||
|
borderRadius={3}
|
||||||
value={allowFaceID}
|
value={allowFaceID}
|
||||||
|
containerStyle={{borderRadius: 3, width: 18, height: 18}}
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
setAllowFaceID(value);
|
setAllowFaceID(value);
|
||||||
}}
|
}}
|
||||||
@ -155,8 +161,14 @@ const SignUpPage = () => {
|
|||||||
</View>
|
</View>
|
||||||
<View row centerV>
|
<View row centerV>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
style={styles.check}
|
style={[
|
||||||
|
styles.check,
|
||||||
|
{ borderRadius: 3, width: 18, height: 18 },
|
||||||
|
]}
|
||||||
color="#919191"
|
color="#919191"
|
||||||
|
size={18}
|
||||||
|
containerStyle={{borderRadius: 3, width: 18, height: 18}}
|
||||||
|
borderRadius={3}
|
||||||
value={acceptTerms}
|
value={acceptTerms}
|
||||||
onValueChange={(value) => setAcceptTerms(value)}
|
onValueChange={(value) => setAcceptTerms(value)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -115,7 +115,8 @@ const CalendarSettingsPage = () => {
|
|||||||
<View row marginV-5 marginT-20>
|
<View row marginV-5 marginT-20>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
value={firstDayOfWeek === "Sundays"}
|
value={firstDayOfWeek === "Sundays"}
|
||||||
style={styles.checkbox}
|
style={[styles.checkbox, {borderRadius: 100}]}
|
||||||
|
borderRadius={100}
|
||||||
color="#ea156d"
|
color="#ea156d"
|
||||||
onValueChange={() => handleChangeFirstDayOfWeek("Sundays")}
|
onValueChange={() => handleChangeFirstDayOfWeek("Sundays")}
|
||||||
/>
|
/>
|
||||||
@ -130,8 +131,9 @@ const CalendarSettingsPage = () => {
|
|||||||
<View row marginV-5>
|
<View row marginV-5>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
value={firstDayOfWeek === "Mondays"}
|
value={firstDayOfWeek === "Mondays"}
|
||||||
style={styles.checkbox}
|
style={[styles.checkbox, {borderRadius: 50}]}
|
||||||
color="#ea156d"
|
color="#ea156d"
|
||||||
|
borderRadius={50}
|
||||||
onValueChange={() => handleChangeFirstDayOfWeek("Mondays")}
|
onValueChange={() => handleChangeFirstDayOfWeek("Mondays")}
|
||||||
/>
|
/>
|
||||||
<Text text70 marginL-8>
|
<Text text70 marginL-8>
|
||||||
@ -447,7 +449,7 @@ const styles = StyleSheet.create({
|
|||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
},
|
},
|
||||||
checkbox: {
|
checkbox: {
|
||||||
borderRadius: 50,
|
borderRadius: 100,
|
||||||
},
|
},
|
||||||
addCalLbl: {
|
addCalLbl: {
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
|
|||||||
@ -1,15 +1,16 @@
|
|||||||
import { Image, Text, View } from "react-native-ui-lib";
|
import { Image, Text, TouchableOpacity, View } from "react-native-ui-lib";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { ProfileType, useAuthContext } from "@/contexts/AuthContext";
|
import { ProfileType, useAuthContext } from "@/contexts/AuthContext";
|
||||||
import { StyleSheet } from "react-native";
|
import { StyleSheet } from "react-native";
|
||||||
import { colorMap } from "@/constants/colorMap";
|
import { colorMap } from "@/constants/colorMap";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom, useSetAtom } from "jotai";
|
||||||
import { isFamilyViewAtom } from "../pages/calendar/atoms";
|
import { isFamilyViewAtom, settingsPageIndex } from "../pages/calendar/atoms";
|
||||||
import { useGetChildrenByParentId } from "@/hooks/firebase/useGetChildrenByParentId";
|
import { useGetChildrenByParentId } from "@/hooks/firebase/useGetChildrenByParentId";
|
||||||
import { useGetFamilyMembers } from "@/hooks/firebase/useGetFamilyMembers";
|
import { useGetFamilyMembers } from "@/hooks/firebase/useGetFamilyMembers";
|
||||||
import { UserProfile } from "@/hooks/firebase/types/profileTypes";
|
import { UserProfile } from "@/hooks/firebase/types/profileTypes";
|
||||||
import { child } from "@react-native-firebase/storage";
|
import { child } from "@react-native-firebase/storage";
|
||||||
import CachedImage from "expo-cached-image";
|
import CachedImage from "expo-cached-image";
|
||||||
|
import { router } from "expo-router";
|
||||||
|
|
||||||
const HeaderTemplate = (props: {
|
const HeaderTemplate = (props: {
|
||||||
message: string;
|
message: string;
|
||||||
@ -26,6 +27,7 @@ const HeaderTemplate = (props: {
|
|||||||
const { data: members } = useGetFamilyMembers();
|
const { data: members } = useGetFamilyMembers();
|
||||||
const [children, setChildren] = useState<UserProfile[]>([]);
|
const [children, setChildren] = useState<UserProfile[]>([]);
|
||||||
const [isFamilyView] = useAtom(isFamilyViewAtom);
|
const [isFamilyView] = useAtom(isFamilyViewAtom);
|
||||||
|
const setSettingsPageIndexAtom = useSetAtom(settingsPageIndex);
|
||||||
|
|
||||||
const headerHeight: number =
|
const headerHeight: number =
|
||||||
(props.isCalendar && 65.54) ||
|
(props.isCalendar && 65.54) ||
|
||||||
@ -33,6 +35,11 @@ const HeaderTemplate = (props: {
|
|||||||
(props.isGroceries && 72.09) ||
|
(props.isGroceries && 72.09) ||
|
||||||
65.54;
|
65.54;
|
||||||
|
|
||||||
|
const handlePfpPress = () => {
|
||||||
|
setSettingsPageIndexAtom(1);
|
||||||
|
router.push("/settings");
|
||||||
|
};
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
pfp: {
|
pfp: {
|
||||||
height: headerHeight,
|
height: headerHeight,
|
||||||
@ -84,11 +91,13 @@ const HeaderTemplate = (props: {
|
|||||||
<View row centerV marginV-15 style={styles.bottomMarg}>
|
<View row centerV marginV-15 style={styles.bottomMarg}>
|
||||||
{profileData?.pfp ? (
|
{profileData?.pfp ? (
|
||||||
<View>
|
<View>
|
||||||
<CachedImage
|
<TouchableOpacity onPress={handlePfpPress}>
|
||||||
source={{ uri: profileData.pfp }}
|
<CachedImage
|
||||||
style={styles.pfp}
|
source={{ uri: profileData.pfp }}
|
||||||
cacheKey={profileData.pfp}
|
style={styles.pfp}
|
||||||
/>
|
cacheKey={profileData.pfp}
|
||||||
|
/>
|
||||||
|
</TouchableOpacity>
|
||||||
{isFamilyView && props.isCalendar && (
|
{isFamilyView && props.isCalendar && (
|
||||||
<View style={styles.childrenPfpArr} row>
|
<View style={styles.childrenPfpArr} row>
|
||||||
{children?.slice(0, 3).map((child, index) => {
|
{children?.slice(0, 3).map((child, index) => {
|
||||||
@ -99,18 +108,22 @@ const HeaderTemplate = (props: {
|
|||||||
style={[styles.childrenPfp, { left: index * 19 }]}
|
style={[styles.childrenPfp, { left: index * 19 }]}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<View
|
<TouchableOpacity
|
||||||
style={[
|
onPress={handlePfpPress}
|
||||||
styles.childrenPfp,
|
|
||||||
{ left: index * 19, backgroundColor: bgColor },
|
|
||||||
]}
|
|
||||||
center
|
|
||||||
>
|
>
|
||||||
<Text style={{ color: "white" }}>
|
<View
|
||||||
{child?.firstName?.at(0)}
|
style={[
|
||||||
{child?.firstName?.at(1)}
|
styles.childrenPfp,
|
||||||
</Text>
|
{ left: index * 19, backgroundColor: bgColor },
|
||||||
</View>
|
]}
|
||||||
|
center
|
||||||
|
>
|
||||||
|
<Text style={{ color: "white" }}>
|
||||||
|
{child?.firstName?.at(0)}
|
||||||
|
{child?.firstName?.at(1)}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
{children?.length > 3 && (
|
{children?.length > 3 && (
|
||||||
|
|||||||
Reference in New Issue
Block a user