mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 00:24:53 +00:00
244 lines
9.8 KiB
TypeScript
244 lines
9.8 KiB
TypeScript
import React from "react";
|
|
import {Drawer} from "expo-router/drawer";
|
|
import {useSignOut} from "@/hooks/firebase/useSignOut";
|
|
import {DrawerContentScrollView,} from "@react-navigation/drawer";
|
|
import {Button, ButtonSize, Text, View} from "react-native-ui-lib";
|
|
import {ImageBackground, StyleSheet} from "react-native";
|
|
import DrawerButton from "@/components/shared/DrawerButton";
|
|
import NavGroceryIcon from "@/assets/svgs/NavGroceryIcon";
|
|
import NavToDosIcon from "@/assets/svgs/NavToDosIcon";
|
|
import NavBrainDumpIcon from "@/assets/svgs/NavBrainDumpIcon";
|
|
import NavCalendarIcon from "@/assets/svgs/NavCalendarIcon";
|
|
import NavSettingsIcon from "@/assets/svgs/NavSettingsIcon";
|
|
import {useSetAtom} from "jotai";
|
|
import {
|
|
isFamilyViewAtom,
|
|
settingsPageIndex,
|
|
toDosPageIndex,
|
|
userSettingsView,
|
|
} from "@/components/pages/calendar/atoms";
|
|
|
|
export default function TabLayout() {
|
|
const {mutateAsync: signOut} = useSignOut();
|
|
const setIsFamilyView = useSetAtom(isFamilyViewAtom);
|
|
const setPageIndex = useSetAtom(settingsPageIndex);
|
|
const setUserView = useSetAtom(userSettingsView);
|
|
const setToDosIndex = useSetAtom(toDosPageIndex);
|
|
|
|
return (
|
|
<Drawer
|
|
initialRouteName={"index"}
|
|
detachInactiveScreens
|
|
screenOptions={{
|
|
headerShown: true,
|
|
drawerStyle: {
|
|
width: "90%",
|
|
backgroundColor: "#f9f8f7",
|
|
height: "100%",
|
|
},
|
|
}}
|
|
drawerContent={(props) => {
|
|
return (
|
|
<DrawerContentScrollView {...props} style={{height: "100%"}}>
|
|
<View centerV margin-30 row>
|
|
<ImageBackground
|
|
source={require("../../assets/images/splash.png")}
|
|
style={{
|
|
backgroundColor: "transparent",
|
|
height: 51.43,
|
|
aspectRatio: 1,
|
|
marginRight: 8,
|
|
}}
|
|
/>
|
|
<Text style={styles.title}>Welcome to Cally</Text>
|
|
</View>
|
|
<View
|
|
style={{
|
|
flexDirection: "row",
|
|
paddingHorizontal: 30
|
|
}}
|
|
>
|
|
<View style={{flex: 1, paddingRight: 5}}>
|
|
<DrawerButton
|
|
title={"Calendar"}
|
|
color="rgb(7, 184, 199)"
|
|
bgColor={"rgb(231, 248, 250)"}
|
|
pressFunc={() => {
|
|
props.navigation.navigate("calendar");
|
|
setPageIndex(0);
|
|
setToDosIndex(0);
|
|
setUserView(true);
|
|
setIsFamilyView(false);
|
|
}}
|
|
icon={<NavCalendarIcon/>}
|
|
/>
|
|
<DrawerButton
|
|
color="#50be0c"
|
|
title={"Groceries"}
|
|
bgColor={"#eef9e7"}
|
|
pressFunc={() => {
|
|
props.navigation.navigate("grocery");
|
|
setPageIndex(0);
|
|
setToDosIndex(0);
|
|
setUserView(true);
|
|
setIsFamilyView(false);
|
|
}}
|
|
icon={<NavGroceryIcon/>}
|
|
/>
|
|
</View>
|
|
<View style={{flex: 1}}>
|
|
{/*<DrawerButton
|
|
color="#fd1775"
|
|
title={"My Reminders"}
|
|
bgColor={"#ffe8f2"}
|
|
pressFunc={() => props.navigation.navigate("reminders")}
|
|
icon={
|
|
<FontAwesome6
|
|
name="clock-rotate-left"
|
|
size={28}
|
|
color="#fd1775"
|
|
/>
|
|
}
|
|
/>*/}
|
|
<DrawerButton
|
|
color="#8005eb"
|
|
title={"To Do's"}
|
|
bgColor={"#f3e6fd"}
|
|
pressFunc={() => {
|
|
props.navigation.navigate("todos");
|
|
setPageIndex(0);
|
|
setToDosIndex(0);
|
|
setUserView(true);
|
|
setIsFamilyView(false);
|
|
}}
|
|
icon={<NavToDosIcon/>}
|
|
/>
|
|
<DrawerButton
|
|
color="#e0ca03"
|
|
title={"Brain Dump"}
|
|
bgColor={"#fffacb"}
|
|
pressFunc={() => {
|
|
props.navigation.navigate("brain_dump");
|
|
setPageIndex(0);
|
|
setToDosIndex(0);
|
|
setUserView(true);
|
|
setIsFamilyView(false);
|
|
}}
|
|
icon={<NavBrainDumpIcon/>}
|
|
/>
|
|
</View>
|
|
</View>
|
|
<Button
|
|
onPress={() => {
|
|
props.navigation.navigate("settings");
|
|
setPageIndex(0);
|
|
setToDosIndex(0);
|
|
setUserView(true);
|
|
setIsFamilyView(false);
|
|
}}
|
|
label={"Manage Settings"}
|
|
labelStyle={styles.label}
|
|
iconSource={() => (
|
|
<View
|
|
backgroundColor="#ededed"
|
|
width={60}
|
|
height={60}
|
|
style={{borderRadius: 50}}
|
|
marginR-10
|
|
centerV
|
|
centerH
|
|
>
|
|
<NavSettingsIcon/>
|
|
</View>
|
|
)}
|
|
backgroundColor="white"
|
|
color="#464039"
|
|
paddingV-30
|
|
marginH-30
|
|
borderRadius={18.55}
|
|
style={{elevation: 0}}
|
|
/>
|
|
|
|
<Button
|
|
size={ButtonSize.large}
|
|
marginH-10
|
|
paddingV-15
|
|
style={{
|
|
marginTop: 50,
|
|
backgroundColor: "transparent",
|
|
borderWidth: 1.3,
|
|
borderColor: "#fd1775",
|
|
}}
|
|
label="Sign out of Cally"
|
|
color="#fd1775"
|
|
labelStyle={styles.signOut}
|
|
onPress={() => signOut()}
|
|
/>
|
|
</DrawerContentScrollView>
|
|
);
|
|
}}
|
|
>
|
|
<Drawer.Screen
|
|
name="index"
|
|
options={{
|
|
drawerLabel: "Calendar",
|
|
title: "Calendar",
|
|
}}
|
|
/>
|
|
<Drawer.Screen
|
|
name="calendar"
|
|
options={{
|
|
drawerLabel: "Calendar",
|
|
title: "Calendar",
|
|
drawerItemStyle: {display: "none"},
|
|
}}
|
|
/>
|
|
<Drawer.Screen
|
|
name="brain_dump"
|
|
options={{
|
|
drawerLabel: "Brain Dump",
|
|
title: "Brain Dump",
|
|
}}
|
|
/>
|
|
<Drawer.Screen
|
|
name="settings"
|
|
options={{
|
|
drawerLabel: "Settings",
|
|
title: "Settings",
|
|
}}
|
|
/>
|
|
<Drawer.Screen
|
|
name="grocery"
|
|
options={{
|
|
drawerLabel: "Grocery",
|
|
title: "Grocery",
|
|
}}
|
|
/>
|
|
<Drawer.Screen
|
|
name="reminders"
|
|
options={{
|
|
drawerLabel: "Reminders",
|
|
title: "Reminders",
|
|
}}
|
|
/>
|
|
<Drawer.Screen
|
|
name="todos"
|
|
options={{
|
|
drawerLabel: "To-Do",
|
|
title: "To-Dos",
|
|
}}
|
|
/>
|
|
</Drawer>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
signOut: {fontFamily: "Poppins_500Medium", fontSize: 15},
|
|
label: {fontFamily: "Poppins_400Medium", fontSize: 15},
|
|
title: {
|
|
fontSize: 26.13,
|
|
fontFamily: "Manrope_600SemiBold",
|
|
color: "#262627",
|
|
},
|
|
});
|