2024-03-22 23:41:51 +01:00
|
|
|
import { Redirect, Tabs } from "expo-router"
|
|
|
|
import React from "react"
|
|
|
|
|
2024-05-02 01:08:27 +02:00
|
|
|
import { TabBarIcon } from "@/presentation/react-native/ui/TabBarIcon"
|
2024-03-22 23:41:51 +01:00
|
|
|
import { useAuthentication } from "@/presentation/react/contexts/Authentication"
|
|
|
|
|
|
|
|
const TabLayout: React.FC = () => {
|
|
|
|
const { user } = useAuthentication()
|
|
|
|
|
|
|
|
if (user == null) {
|
2024-05-20 15:05:34 +02:00
|
|
|
return <Redirect href="/authentication/about" />
|
2024-03-22 23:41:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Tabs
|
|
|
|
screenOptions={{
|
|
|
|
headerShown: false,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Tabs.Screen
|
|
|
|
name="habits/index"
|
|
|
|
options={{
|
|
|
|
headerShown: false,
|
|
|
|
title: "Habits",
|
|
|
|
tabBarIcon: ({ color }) => {
|
|
|
|
return <TabBarIcon name="sticky-note" color={color} />
|
|
|
|
},
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Tabs.Screen
|
|
|
|
name="habits/new"
|
|
|
|
options={{
|
|
|
|
title: "New Habit",
|
2024-04-13 17:57:58 +02:00
|
|
|
unmountOnBlur: true,
|
2024-03-22 23:41:51 +01:00
|
|
|
tabBarIcon: ({ color }) => {
|
|
|
|
return <TabBarIcon name="plus-square" color={color} />
|
|
|
|
},
|
|
|
|
}}
|
|
|
|
/>
|
2024-03-24 23:41:23 +01:00
|
|
|
<Tabs.Screen
|
|
|
|
name="habits/[habitId]"
|
|
|
|
options={{
|
2024-04-13 17:57:58 +02:00
|
|
|
unmountOnBlur: true,
|
2024-03-24 23:41:23 +01:00
|
|
|
href: null,
|
|
|
|
}}
|
|
|
|
/>
|
2024-03-22 23:41:51 +01:00
|
|
|
<Tabs.Screen
|
2024-05-22 13:44:54 +02:00
|
|
|
name="habits/statistics"
|
2024-03-22 23:41:51 +01:00
|
|
|
options={{
|
2024-04-12 13:43:49 +02:00
|
|
|
title: "Statistics",
|
2024-03-22 23:41:51 +01:00
|
|
|
tabBarIcon: ({ color }) => {
|
2024-04-12 13:43:49 +02:00
|
|
|
return <TabBarIcon name="line-chart" color={color} />
|
2024-03-22 23:41:51 +01:00
|
|
|
},
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Tabs.Screen
|
|
|
|
name="users/settings"
|
|
|
|
options={{
|
|
|
|
title: "Settings",
|
|
|
|
tabBarIcon: ({ color }) => {
|
|
|
|
return <TabBarIcon name="cog" color={color} />
|
|
|
|
},
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</Tabs>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TabLayout
|