- Écrans sans en-tête (confirmation, autorisation caméra) : marge haute de sécurité - Récompenses : bouton « Retour » ; confirmation : « Retour à la fiche client » - Fiche client rechargée à chaque affichage (solde à jour) - Cartes à ombre légère, boutons plus arrondis, halo de validation, accueil avec salutation et chiffres du jour sur fond teinté Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
57 lines
2.8 KiB
TypeScript
57 lines
2.8 KiB
TypeScript
import { useEffect, useRef } from 'react';
|
||
import { Animated, View } from 'react-native';
|
||
import { router, useLocalSearchParams } from 'expo-router';
|
||
import Svg, { Path } from 'react-native-svg';
|
||
import { useStore } from '../src/session';
|
||
import { Button, Card, Screen, T, unit } from '../src/ui';
|
||
import { font, useColors } from '../src/theme';
|
||
|
||
/** Confirmation (maquette 7) : nouveau solde, Wallet mis à jour. */
|
||
export default function Done() {
|
||
const c = useColors();
|
||
const store = useStore();
|
||
const p = useLocalSearchParams<{ kind: 'credit' | 'redeem'; firstName: string; points: string; balance: string; reward?: string }>();
|
||
const scale = useRef(new Animated.Value(0.4)).current;
|
||
const mode = store.design.pointsMode;
|
||
const n = Number(p.points);
|
||
|
||
useEffect(() => {
|
||
Animated.spring(scale, { toValue: 1, friction: 5, useNativeDriver: true }).start();
|
||
}, [scale]);
|
||
|
||
return (
|
||
<Screen noHeader style={{ alignItems: 'stretch' }}>
|
||
<View style={{ flex: 1 }} />
|
||
<View style={{ alignItems: 'center', gap: 16 }}>
|
||
{/* Halo + pastille de validation */}
|
||
<View style={{ width: 132, height: 132, borderRadius: 66, backgroundColor: c.okBg, alignItems: 'center', justifyContent: 'center' }}>
|
||
<Animated.View
|
||
style={{ width: 96, height: 96, borderRadius: 48, backgroundColor: c.ok, alignItems: 'center', justifyContent: 'center', transform: [{ scale }] }}
|
||
>
|
||
<Svg width={48} height={48} viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth={2.6} strokeLinecap="round" strokeLinejoin="round">
|
||
<Path d="M5 12.5l4.5 4.5L19 7.5" />
|
||
</Svg>
|
||
</Animated.View>
|
||
</View>
|
||
<T v="h1" accessibilityRole="alert" style={{ textAlign: 'center' }}>
|
||
{p.kind === 'redeem' ? `${p.reward} validé` : `+ ${n} ${unit(mode, n)}`}
|
||
</T>
|
||
<T v="muted" style={{ textAlign: 'center' }}>
|
||
{p.kind === 'redeem' ? `− ${n} ${unit(mode, n)} pour ${p.firstName}` : `pour ${p.firstName}`}
|
||
</T>
|
||
</View>
|
||
<Card style={{ alignItems: 'center', paddingVertical: 22 }}>
|
||
<T v="muted">Nouveau solde</T>
|
||
<T style={{ fontFamily: font.extrabold, fontSize: 44, lineHeight: 50 }}>
|
||
{p.balance} <T style={{ fontSize: 20 }}>{unit(mode, Number(p.balance))}</T>
|
||
</T>
|
||
<T v="muted" style={{ fontSize: 14, textAlign: 'center' }}>Le Wallet du client est mis à jour.</T>
|
||
</Card>
|
||
<View style={{ flex: 1 }} />
|
||
<Button large label="Scanner une autre carte" onPress={() => router.replace('/scan')} />
|
||
{/* Retour à la fiche du client (autre récompense, crédit…) */}
|
||
{router.canGoBack() && <Button label="Retour à la fiche client" variant="secondary" onPress={() => router.back()} />}
|
||
<Button label="Accueil" variant="secondary" onPress={() => router.dismissTo('/')} />
|
||
</Screen>
|
||
);
|
||
}
|