App : pastille de validation sous la Dynamic Island, bouton retour, finitions visuelles

- É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>
This commit is contained in:
Tony AVERTY 2026-10-07 14:12:46 +02:00
parent cc7357b3cf
commit 567d9fb877
6 changed files with 54 additions and 17 deletions

View file

@ -6,7 +6,7 @@ import { api, Reward } from '../../../src/api';
import { useStore } from '../../../src/session';
import { useCard } from '../../../src/useCard';
import { ErrorScreen } from '../../../src/errors';
import { Screen, T, unit } from '../../../src/ui';
import { Button, Screen, T, unit } from '../../../src/ui';
import { font, useColors } from '../../../src/theme';
/** Choix d'une récompense (maquette 6) : les accessibles d'abord, les autres grisées. */
@ -88,6 +88,8 @@ export default function Rewards() {
);
})}
</View>
<View style={{ flex: 1 }} />
<Button label="Retour" variant="secondary" onPress={() => router.back()} />
</Screen>
);
}

View file

@ -20,8 +20,11 @@ export default function Done() {
}, [scale]);
return (
<Screen style={{ justifyContent: 'center', alignItems: 'stretch' }}>
<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 }] }}
>
@ -29,6 +32,7 @@ export default function Done() {
<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>
@ -36,7 +40,7 @@ export default function Done() {
{p.kind === 'redeem' ? `− ${n} ${unit(mode, n)} pour ${p.firstName}` : `pour ${p.firstName}`}
</T>
</View>
<Card style={{ alignItems: 'center' }}>
<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>
@ -45,6 +49,8 @@ export default function Done() {
</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>
);

View file

@ -87,9 +87,9 @@ function Counter() {
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>
<BrandSymbol size={36} />
<View style={{ flex: 1 }}>
<T v="label" numberOfLines={1}>{store.name}</T>
<T v="h2" numberOfLines={1}>{store.name}</T>
<T v="muted" numberOfLines={1}>
{me?.displayName} · {isManager ? 'Dirigeant' : 'Employé'}
Bonjour {me?.displayName.split(' ')[0]} · {isManager ? 'Dirigeant' : 'Employé'}
</T>
</View>
<Pressable
@ -158,8 +158,8 @@ function Counter() {
[summary?.pointsGiven ?? '—', `${u} donnés`],
[summary?.rewards ?? '—', 'récompenses'],
].map(([n, l]) => (
<Card key={String(l)} style={{ flex: 1, padding: 14, gap: 2 }}>
<T style={{ fontFamily: font.extrabold, fontSize: 26 }}>{n}</T>
<Card key={String(l)} style={{ flex: 1, padding: 14, gap: 2, backgroundColor: c.primarySoft, borderColor: c.primarySoft }}>
<T style={{ fontFamily: font.extrabold, fontSize: 26, color: c.primary }}>{n}</T>
<T v="muted" style={{ fontSize: 13 }}>{l}</T>
</Card>
))}

View file

@ -19,7 +19,7 @@ export default function Scan() {
if (!permission) return null;
if (!permission.granted) {
return (
<Screen style={{ justifyContent: 'center' }}>
<Screen noHeader style={{ justifyContent: 'center' }}>
<T v="h1">Accès à la caméra</T>
<T v="muted">La caméra sert uniquement à lire le QR code de la carte de fidélité du client.</T>
{permission.canAskAgain ? (

View file

@ -4,11 +4,15 @@ import { SafeAreaView } from 'react-native-safe-area-context';
import Svg, { Circle, Path } from 'react-native-svg';
import { font, useColors } from './theme';
export function Screen({ children, scroll = false, style }: { children: ReactNode; scroll?: boolean; style?: ViewStyle }) {
/**
* Écran standard. `noHeader` : écran sans barre de titre, le contenu reste sous
* la Dynamic Island / l'encoche (marge haute de sécurité).
*/
export function Screen({ children, scroll = false, style, noHeader = false }: { children: ReactNode; scroll?: boolean; style?: ViewStyle; noHeader?: boolean }) {
const c = useColors();
const inner = <View style={[{ padding: 20, gap: 20, flexGrow: 1 }, style]}>{children}</View>;
return (
<SafeAreaView style={{ flex: 1, backgroundColor: c.bg }} edges={['bottom', 'left', 'right']}>
<SafeAreaView style={{ flex: 1, backgroundColor: c.bg }} edges={noHeader ? ['top', 'bottom', 'left', 'right'] : ['bottom', 'left', 'right']}>
{scroll ? <ScrollView contentContainerStyle={{ flexGrow: 1 }}>{inner}</ScrollView> : inner}
</SafeAreaView>
);
@ -79,7 +83,29 @@ export function Button({
export function Card({ children, style }: { children: ReactNode; style?: ViewStyle }) {
const c = useColors();
return <View style={[{ backgroundColor: c.surface, borderColor: c.border, borderWidth: 1, borderRadius: 16, padding: 18, gap: 8 }, style]}>{children}</View>;
return (
<View
style={[
{
backgroundColor: c.surface,
borderColor: c.border,
borderWidth: StyleSheet.hairlineWidth,
borderRadius: 18,
padding: 18,
gap: 8,
// Ombre légère : les cartes se détachent du fond sans trait épais.
shadowColor: '#000',
shadowOpacity: 0.05,
shadowRadius: 10,
shadowOffset: { width: 0, height: 3 },
elevation: 1,
},
style,
]}
>
{children}
</View>
);
}
export function Banner({ tone, children }: { tone: 'error' | 'warn' | 'ok'; children: ReactNode }) {
@ -111,5 +137,5 @@ export function unit(mode: 'AMOUNT' | 'STAMP', n = 2) {
}
const styles = StyleSheet.create({
btn: { borderRadius: 14, borderWidth: 1, paddingHorizontal: 20, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 10 },
btn: { borderRadius: 16, borderWidth: 1, paddingHorizontal: 20, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 10 },
});

View file

@ -1,5 +1,5 @@
import { useCallback, useEffect, useState } from 'react';
import { useLocalSearchParams } from 'expo-router';
import { useCallback, useState } from 'react';
import { useFocusEffect, useLocalSearchParams } from 'expo-router';
import { api, CardInfo } from './api';
/** Carte scannée (paramètre de route `serial`), rechargeable. */
@ -17,9 +17,12 @@ export function useCard() {
}
}, [serial]);
useEffect(() => {
// Rechargée à chaque affichage : solde à jour après un crédit ou une récompense.
useFocusEffect(
useCallback(() => {
load();
}, [load]);
}, [load]),
);
return { serial, card, setCard, error, reload: load };
}