diff --git a/app/(auth)/_layout.tsx b/app/(auth)/_layout.tsx index 7faff1d..27fa348 100644 --- a/app/(auth)/_layout.tsx +++ b/app/(auth)/_layout.tsx @@ -1,9 +1,9 @@ import React, { useEffect } 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 { 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"; @@ -11,107 +11,114 @@ import NavBrainDumpIcon from "@/assets/svgs/NavBrainDumpIcon"; import NavCalendarIcon from "@/assets/svgs/NavCalendarIcon"; import NavSettingsIcon from "@/assets/svgs/NavSettingsIcon"; import ViewSwitch from "@/components/pages/(tablet_pages)/ViewSwitch"; -import {MaterialIcons} from "@expo/vector-icons"; -import {useSetAtom} from "jotai"; +import { MaterialIcons } from "@expo/vector-icons"; +import { useSetAtom } from "jotai"; import { - isFamilyViewAtom, - settingsPageIndex, - toDosPageIndex, - userSettingsView, + isFamilyViewAtom, + settingsPageIndex, + toDosPageIndex, + userSettingsView, } from "@/components/pages/calendar/atoms"; import Ionicons from "@expo/vector-icons/Ionicons"; -import Constants from "expo-constants"; import * as Device from "expo-device"; import { DeviceType } from "expo-device"; +import FeedbackNavIcon from "@/assets/svgs/FeedbackNavIcon"; export default function TabLayout() { - const {mutateAsync: signOut} = useSignOut(); - const setIsFamilyView = useSetAtom(isFamilyViewAtom); - const setPageIndex = useSetAtom(settingsPageIndex); - const setUserView = useSetAtom(userSettingsView); - const setToDosIndex = useSetAtom(toDosPageIndex); + const { mutateAsync: signOut } = useSignOut(); + const setIsFamilyView = useSetAtom(isFamilyViewAtom); + const setPageIndex = useSetAtom(settingsPageIndex); + const setUserView = useSetAtom(userSettingsView); + const setToDosIndex = useSetAtom(toDosPageIndex); - return ( - ({ - headerShown: true, - headerRight: () => - Device.deviceType === DeviceType.TABLET ? ( - - ) : ( - <> - ), + return ( + ({ + headerShown: true, + headerRight: () => { + // Only show ViewSwitch on calendar and todos pages + const showViewSwitch = ["calendar", "todos", "index"].includes( + route.name + ); + return Device.deviceType === DeviceType.TABLET && showViewSwitch ? ( + + + + ) : null; + }, + headerStyle: { height: Device.deviceType === DeviceType.TABLET ? 100 : undefined}, drawerStyle: { - width: "90%", - backgroundColor: "#f9f8f7", - height: "100%", - }, - })} - drawerContent={(props) => { - return ( - - - - Welcome to Cally - - - - { - props.navigation.navigate("calendar"); - setPageIndex(0); - setToDosIndex(0); - setUserView(true); - setIsFamilyView(false); - }} - icon={} - /> - { - props.navigation.navigate("grocery"); - setPageIndex(0); - setToDosIndex(0); - setUserView(true); - setIsFamilyView(false); - }} - icon={}/> - { - props.navigation.navigate("feedback"); - setPageIndex(0); - setToDosIndex(0); - setUserView(true); - setIsFamilyView(false); - }} - icon={} - /> - - - {/* { + return ( + + + + Welcome to Cally + + + + { + props.navigation.navigate("calendar"); + setPageIndex(0); + setToDosIndex(0); + setUserView(true); + setIsFamilyView(false); + }} + icon={} + /> + { + props.navigation.navigate("grocery"); + setPageIndex(0); + setToDosIndex(0); + setUserView(true); + setIsFamilyView(false); + }} + icon={} + /> + { + props.navigation.navigate("feedback"); + setPageIndex(0); + setToDosIndex(0); + setUserView(true); + setIsFamilyView(false); + }} + icon={} + /> + + + {/* } />*/} - { - props.navigation.navigate("todos"); - setPageIndex(0); - setToDosIndex(0); - setUserView(true); - setIsFamilyView(false); - }} - icon={} - /> - { - props.navigation.navigate("brain_dump"); - setPageIndex(0); - setToDosIndex(0); - setUserView(true); - setIsFamilyView(false); - }} - icon={} - /> - { - props.navigation.navigate("notifications"); - setPageIndex(0); - setToDosIndex(0); - setUserView(true); - setIsFamilyView(false); - }} - icon={} - /> - - -