import { useCallback, useState } from 'react'; import { Image, Linking, Pressable, ScrollView, View } from 'react-native'; import { router, useFocusEffect } from 'expo-router'; import { SafeAreaView } from 'react-native-safe-area-context'; import Svg, { Path } from 'react-native-svg'; import { api, API_URL, Summary } from '../src/api'; import { useSession, useStore } from '../src/session'; import { BrandSymbol, Button, Card, T, unit } from '../src/ui'; import { font, useColors } from '../src/theme'; function ScanIcon({ color }: { color: string }) { return ( ); } /** Adresse de l'espace web du Dirigeant (conception de la carte). */ const ESPACE_URL = 'https://monespacepro.eu/espace'; const greeting = () => (new Date().getHours() >= 18 ? 'Bonsoir' : 'Bonjour'); const today = () => new Date().toLocaleDateString('fr-FR', { weekday: 'long', day: 'numeric', month: 'long' }); export default function Home() { const { me } = useSession(); // Magasin inscrit en ligne : tant que la carte n'est pas conçue, pas de scan possible. return me?.store.cardDesign ? : ; } /** En-tête commun : logo du magasin, date, accès au compte. */ function Header() { const c = useColors(); const { me } = useSession(); const logo = me?.store.cardDesign?.logoUrl; const first = me?.displayName.split(' ')[0] ?? ''; return ( {logo ? : } {me?.store.name} {today()} router.push('/account')}> {({ pressed }) => ( {first.charAt(0).toUpperCase()} )} ); } /** Ligne d'action ou de réglage : pictogramme, titre, sous-titre, chevron. */ function Row({ icon, title, sub, onPress }: { icon: string; title: string; sub?: string; onPress: () => void }) { const c = useColors(); return ( {({ pressed }) => ( {icon} {title} {!!sub && {sub}} › )} ); } const sectionTitle = (c: ReturnType) => ({ color: c.text3, textTransform: 'uppercase' as const, fontSize: 13, letterSpacing: 0.5 }); function NoCardYet() { const c = useColors(); const { me, reload } = useSession(); const isManager = me?.role === 'MANAGER'; return (
🎨 {isManager ? 'Dernière étape' : 'Presque prêt'} {isManager ? 'Concevez votre carte de fidélité (logo, couleurs, récompenses) sur votre espace web. Le scan des cartes s’active ensuite.' : 'La carte de fidélité du magasin n’est pas encore prête. Revenez un peu plus tard.'} {isManager &&