- API /staff : profil, scan d'une carte, crédit (montant ou tampon), récompenses, historique (gérant : tout le magasin, employé : le sien), résumé du jour - Anti-triche côté serveur : carte du bon magasin, plafond de montant, délai minimum entre deux crédits (atomique, scans simultanés compris), tentatives refusées journalisées avec l'employé - App Expo SDK 54 / Expo Router : connexion, accueil, scanner QR avec lampe, fiche client, pavé numérique, récompenses, confirmation, erreurs, historique ; icônes générées depuis le logo Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67 lines
2.3 KiB
TypeScript
67 lines
2.3 KiB
TypeScript
import { useEffect } from 'react';
|
|
import { Stack } from 'expo-router';
|
|
import { StatusBar } from 'expo-status-bar';
|
|
import * as SplashScreen from 'expo-splash-screen';
|
|
import {
|
|
useFonts,
|
|
Figtree_400Regular,
|
|
Figtree_500Medium,
|
|
Figtree_600SemiBold,
|
|
Figtree_700Bold,
|
|
Figtree_800ExtraBold,
|
|
} from '@expo-google-fonts/figtree';
|
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
import { SessionProvider, useSession } from '../src/session';
|
|
import { font, useColors } from '../src/theme';
|
|
|
|
SplashScreen.preventAutoHideAsync();
|
|
|
|
function Navigator() {
|
|
const { status } = useSession();
|
|
const c = useColors();
|
|
|
|
useEffect(() => {
|
|
if (status !== 'loading') SplashScreen.hideAsync();
|
|
}, [status]);
|
|
|
|
if (status === 'loading') return null;
|
|
const signedIn = status === 'signed-in';
|
|
return (
|
|
<Stack
|
|
screenOptions={{
|
|
headerStyle: { backgroundColor: c.bg },
|
|
headerShadowVisible: false,
|
|
headerTintColor: c.text,
|
|
headerTitleStyle: { fontFamily: font.bold },
|
|
headerBackButtonDisplayMode: 'minimal',
|
|
contentStyle: { backgroundColor: c.bg },
|
|
}}
|
|
>
|
|
<Stack.Protected guard={!signedIn}>
|
|
<Stack.Screen name="login" options={{ headerShown: false }} />
|
|
</Stack.Protected>
|
|
<Stack.Protected guard={signedIn}>
|
|
<Stack.Screen name="index" options={{ headerShown: false }} />
|
|
<Stack.Screen name="scan" options={{ headerShown: false, presentation: 'fullScreenModal' }} />
|
|
<Stack.Screen name="client/[serial]/index" options={{ title: 'Client' }} />
|
|
<Stack.Screen name="client/[serial]/credit" options={{ title: 'Créditer' }} />
|
|
<Stack.Screen name="client/[serial]/rewards" options={{ title: 'Récompenses' }} />
|
|
<Stack.Screen name="done" options={{ headerShown: false, gestureEnabled: false }} />
|
|
<Stack.Screen name="history" options={{ title: 'Historique' }} />
|
|
</Stack.Protected>
|
|
</Stack>
|
|
);
|
|
}
|
|
|
|
export default function RootLayout() {
|
|
const [loaded] = useFonts({ Figtree_400Regular, Figtree_500Medium, Figtree_600SemiBold, Figtree_700Bold, Figtree_800ExtraBold });
|
|
if (!loaded) return null;
|
|
return (
|
|
<SafeAreaProvider>
|
|
<SessionProvider>
|
|
<StatusBar style="auto" />
|
|
<Navigator />
|
|
</SessionProvider>
|
|
</SafeAreaProvider>
|
|
);
|
|
}
|