MonEspacePro/pro/app/_layout.tsx
Tony AVERTY 226f3cedb8 Espace web du Dirigeant, inscription en ligne, employés et cadeaux dans l'app Pro
- Admin : /inscription (formule, magasin, mot de passe, paiement Stripe) et
  /espace (connexion Dirigeant, état de l'abonnement, conception de la carte)
- Admin : formule obligatoire à la création d'un magasin, plus d'essai gratuit,
  lien d'abonnement permanent, titre des campagnes
- App Pro : écran Employés (création avec rôle Employé / Dirigeant), Mon compte
  (mot de passe), titre des campagnes, remise des cadeaux en caisse, accueil
  avant la conception de la carte
- Site : boutons « Choisir » vers l'inscription, avec la périodicité choisie

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 11:52:09 +02:00

73 lines
2.7 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.Screen name="campaigns" options={{ title: 'Campagnes' }} />
<Stack.Screen name="stats" options={{ title: 'Statistiques' }} />
<Stack.Screen name="loyalty" options={{ title: 'Modules' }} />
<Stack.Screen name="module/[id]" options={{ title: 'Module' }} />
<Stack.Screen name="team" options={{ title: 'Employés' }} />
<Stack.Screen name="account" options={{ title: 'Mon compte' }} />
</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>
);
}