- Improved error message handling in LoginScreen for invalid credentials. - Added new images: mariani-icon.png and mariani-splash.png. - Updated AddDocumentModal to handle file extensions and improve UI. - Enhanced CalendarWidget to support month change callbacks. - Introduced NfcScanModal for NFC tag scanning with animations. - Revamped QrScanModal to utilize camera for QR code scanning. - Removed mock data from data.ts and streamlined Office data. - Updated package dependencies for expo-camera and react-native-nfc-manager. - Added utility function to parse seconds to time format. - Refactored document upload logic to use FormData for server uploads.
87 lines
2.3 KiB
TypeScript
87 lines
2.3 KiB
TypeScript
import { Redirect, Tabs } from 'expo-router';
|
|
import { Home, Clock, Zap, CalendarIcon, Building } from 'lucide-react-native';
|
|
import { useContext } from 'react';
|
|
import { AuthContext } from '@/utils/authContext';
|
|
|
|
export default function ProtectedLayout() {
|
|
const authState = useContext(AuthContext);
|
|
|
|
if (!authState.isReady) {
|
|
return null;
|
|
}
|
|
|
|
if (!authState.isAuthenticated) {
|
|
return <Redirect href="/login" />;
|
|
}
|
|
|
|
// TODO: Aggiungere padding per i dispositivi con notch/bottom bar
|
|
return (
|
|
<Tabs
|
|
screenOptions={{
|
|
headerShown: false,
|
|
tabBarStyle: {
|
|
backgroundColor: '#ffffff',
|
|
borderTopWidth: 1,
|
|
borderTopColor: '#f3f4f6',
|
|
height: 90,
|
|
paddingBottom: 30,
|
|
paddingTop: 10,
|
|
paddingHorizontal: 10,
|
|
},
|
|
tabBarActiveTintColor: '#099499',
|
|
tabBarInactiveTintColor: '#9ca3af',
|
|
tabBarLabelStyle: {
|
|
fontSize: 12,
|
|
fontWeight: '600',
|
|
marginTop: 4
|
|
}
|
|
}}
|
|
backBehavior='history'
|
|
>
|
|
<Tabs.Screen
|
|
name="index"
|
|
options={{
|
|
title: 'Home',
|
|
tabBarIcon: ({ color, size }) => <Home color={color} size={24} />,
|
|
}}
|
|
/>
|
|
<Tabs.Screen
|
|
name="attendance/index"
|
|
options={{
|
|
title: 'Presenze',
|
|
tabBarIcon: ({ color, size }) => <Clock color={color} size={24} />,
|
|
}}
|
|
/>
|
|
<Tabs.Screen
|
|
name="permits/index"
|
|
options={{
|
|
title: 'Permessi',
|
|
tabBarIcon: ({ color, size }) => <CalendarIcon color={color} size={24} />,
|
|
}}
|
|
/>
|
|
<Tabs.Screen
|
|
name="sites"
|
|
options={{
|
|
title: 'Cantieri',
|
|
tabBarIcon: ({ color, size }) => <Building color={color} size={24} />,
|
|
}}
|
|
/>
|
|
{/* // TODO: Rimuovere all'utente e mostrare solo a admin */}
|
|
<Tabs.Screen
|
|
name="automation"
|
|
options={{
|
|
title: 'Domotica',
|
|
tabBarIcon: ({ color, size }) => <Zap color={color} size={24} />,
|
|
}}
|
|
/>
|
|
{/* TODO: Dovrebbe essere rimosso, va rivisto layout */}
|
|
<Tabs.Screen
|
|
name="profile"
|
|
options={{
|
|
href: null,
|
|
title: 'Profilo',
|
|
}}
|
|
/>
|
|
</Tabs>
|
|
);
|
|
} |