Files
FEDEO/mobile/app/(tabs)/_layout.tsx
florianfederspiel 409db82368
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 2m50s
Build and Push Docker Images / build-frontend (push) Successful in 1m13s
Mobile Dev
2026-02-21 21:21:39 +01:00

70 lines
1.8 KiB
TypeScript

import { Redirect, Tabs } from 'expo-router';
import { HapticTab } from '@/components/haptic-tab';
import { IconSymbol } from '@/components/ui/icon-symbol';
import { Colors } from '@/constants/theme';
import { useColorScheme } from '@/hooks/use-color-scheme';
import { useAuth } from '@/src/providers/auth-provider';
export default function TabLayout() {
const colorScheme = useColorScheme();
const { isBootstrapping, token, requiresTenantSelection } = useAuth();
if (isBootstrapping) {
return null;
}
if (!token) {
return <Redirect href="/login" />;
}
if (requiresTenantSelection) {
return <Redirect href="/tenant-select" />;
}
return (
<Tabs
screenOptions={{
tabBarActiveTintColor: Colors[colorScheme ?? 'light'].tint,
headerShown: true,
tabBarButton: HapticTab,
}}>
<Tabs.Screen
name="index"
options={{
title: 'Dashboard',
tabBarIcon: ({ color }) => <IconSymbol size={24} name="house.fill" color={color} />,
}}
/>
<Tabs.Screen
name="tasks"
options={{
title: 'Aufgaben',
tabBarIcon: ({ color }) => <IconSymbol size={24} name="checklist" color={color} />,
}}
/>
<Tabs.Screen
name="projects"
options={{
title: 'Projekte',
tabBarIcon: ({ color }) => <IconSymbol size={24} name="folder.fill" color={color} />,
}}
/>
<Tabs.Screen
name="time"
options={{
title: 'Zeit',
tabBarIcon: ({ color }) => <IconSymbol size={24} name="clock.fill" color={color} />,
}}
/>
<Tabs.Screen
name="explore"
options={{
title: 'Mehr',
tabBarIcon: ({ color }) => <IconSymbol size={24} name="ellipsis.circle.fill" color={color} />,
}}
/>
</Tabs>
);
}