App : page de crédit retravaillée
Montant dans un bloc qui vire au rouge au-delà du plafond, points gagnés en pastille, montants rapides (5 à 50 €), pavé numérique plus doux (appui long sur ⌫ pour tout effacer), bouton « Créditer N points » ; mode tampons avec tampon aux couleurs de la carte et bouton Annuler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
39806791c4
commit
5f354e8987
1 changed files with 91 additions and 26 deletions
|
|
@ -60,55 +60,120 @@ export default function Credit() {
|
|||
|
||||
if (stamp) {
|
||||
return (
|
||||
<Screen style={{ justifyContent: 'center' }}>
|
||||
<T v="h1" style={{ textAlign: 'center' }}>+1 tampon</T>
|
||||
<Screen style={{ alignItems: 'stretch' }}>
|
||||
<View style={{ flex: 1 }} />
|
||||
<View style={{ alignItems: 'center', gap: 16 }}>
|
||||
{/* Tampon aux couleurs de la carte */}
|
||||
<View style={{ width: 150, height: 150, borderRadius: 75, backgroundColor: c.primarySoft, alignItems: 'center', justifyContent: 'center' }}>
|
||||
<View
|
||||
style={{
|
||||
width: 112,
|
||||
height: 112,
|
||||
borderRadius: 56,
|
||||
backgroundColor: store.design.backgroundColor,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
borderWidth: 4,
|
||||
borderStyle: 'dashed',
|
||||
borderColor: store.design.foregroundColor,
|
||||
}}
|
||||
>
|
||||
<T style={{ fontFamily: font.extrabold, fontSize: 40, color: store.design.foregroundColor }}>+1</T>
|
||||
</View>
|
||||
</View>
|
||||
<T v="h1" style={{ textAlign: 'center' }}>Ajouter un tampon</T>
|
||||
<T v="muted" style={{ textAlign: 'center' }}>Un tampon par passage, quel que soit le montant.</T>
|
||||
</View>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Button large label="Valider le tampon" onPress={submit} loading={busy} />
|
||||
<Button label="Annuler" variant="secondary" onPress={() => router.back()} />
|
||||
</Screen>
|
||||
);
|
||||
}
|
||||
|
||||
const QUICK = [5, 10, 20, 50];
|
||||
|
||||
return (
|
||||
<Screen>
|
||||
<View style={{ alignItems: 'center', gap: 6, paddingTop: 8 }}>
|
||||
<T v="muted">Montant de la commande</T>
|
||||
{/* Montant et points gagnés */}
|
||||
<View style={{ alignItems: 'center', gap: 8, paddingVertical: 18, borderRadius: 22, backgroundColor: overLimit ? c.errBg : c.surface }}>
|
||||
<T v="muted" style={{ fontSize: 14 }}>Montant de la commande</T>
|
||||
<T
|
||||
accessibilityLabel={`Montant ${euros(cents)}`}
|
||||
style={{ fontFamily: font.extrabold, fontSize: 52, lineHeight: 60, color: overLimit ? c.err : c.text }}
|
||||
adjustsFontSizeToFit
|
||||
numberOfLines={1}
|
||||
style={{ fontFamily: font.extrabold, fontSize: 56, lineHeight: 64, color: overLimit ? c.err : input ? c.text : c.text3 }}
|
||||
>
|
||||
{input || '0'} €
|
||||
</T>
|
||||
<T style={{ fontFamily: font.semibold, fontSize: 18, color: overLimit ? c.err : c.primary }}>
|
||||
<View style={{ paddingHorizontal: 14, paddingVertical: 6, borderRadius: 999, backgroundColor: overLimit ? c.err : points > 0 ? c.primarySoft : c.surface2 }}>
|
||||
<T style={{ fontFamily: font.bold, fontSize: 16, color: overLimit ? '#fff' : points > 0 ? c.primary : c.text3 }}>
|
||||
{overLimit ? `Plafond : ${euros(store.maxAmountCents)}` : `+ ${points} ${unit('AMOUNT', points)}`}
|
||||
</T>
|
||||
</View>
|
||||
<T v="muted" style={{ fontSize: 12 }}>
|
||||
{store.design.pointsPerEuro} {unit('AMOUNT', store.design.pointsPerEuro)} par euro
|
||||
</T>
|
||||
</View>
|
||||
|
||||
<View style={{ flex: 1, flexDirection: 'row', flexWrap: 'wrap', gap: 10, alignContent: 'flex-end' }}>
|
||||
{KEYS.map((k) => (
|
||||
{/* Montants rapides */}
|
||||
<View style={{ flexDirection: 'row', gap: 8 }}>
|
||||
{QUICK.map((q) => (
|
||||
<Pressable
|
||||
key={k}
|
||||
key={q}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={k === '⌫' ? 'Effacer' : k === ',' ? 'Virgule' : k}
|
||||
onPress={() => press(k)}
|
||||
style={({ pressed }) => ({
|
||||
width: '31%',
|
||||
flexGrow: 1,
|
||||
height: 64,
|
||||
borderRadius: 14,
|
||||
backgroundColor: pressed ? c.surface2 : c.surface,
|
||||
borderWidth: 1,
|
||||
borderColor: c.border,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
})}
|
||||
accessibilityLabel={`${q} euros`}
|
||||
onPress={() => {
|
||||
Haptics.selectionAsync();
|
||||
setInput(String(q));
|
||||
}}
|
||||
style={({ pressed }) => ({ flex: 1, height: 44, borderRadius: 999, alignItems: 'center', justifyContent: 'center', backgroundColor: pressed ? c.primary : c.primarySoft })}
|
||||
>
|
||||
<T style={{ fontFamily: font.semibold, fontSize: 26 }}>{k}</T>
|
||||
{({ pressed }) => <T style={{ fontFamily: font.bold, fontSize: 16, color: pressed ? c.onPrimary : c.primary }}>{q} €</T>}
|
||||
</Pressable>
|
||||
))}
|
||||
</View>
|
||||
|
||||
<Button large label="Valider" onPress={submit} loading={busy} disabled={points <= 0 || overLimit} />
|
||||
{/* Pavé numérique (appui long sur ⌫ : tout effacer) */}
|
||||
<View style={{ flex: 1, flexDirection: 'row', flexWrap: 'wrap', gap: 10, alignContent: 'flex-end' }}>
|
||||
{KEYS.map((k) => {
|
||||
const del = k === '⌫';
|
||||
return (
|
||||
<Pressable
|
||||
key={k}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={del ? 'Effacer' : k === ',' ? 'Virgule' : k}
|
||||
accessibilityHint={del ? 'Appui long pour tout effacer' : undefined}
|
||||
onPress={() => press(k)}
|
||||
onLongPress={del ? () => setInput('') : undefined}
|
||||
style={({ pressed }) => ({
|
||||
width: '31%',
|
||||
flexGrow: 1,
|
||||
height: 62,
|
||||
borderRadius: 18,
|
||||
backgroundColor: pressed ? c.primarySoft : del ? c.surface2 : c.surface,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
shadowColor: '#000',
|
||||
shadowOpacity: del ? 0 : 0.05,
|
||||
shadowRadius: 6,
|
||||
shadowOffset: { width: 0, height: 2 },
|
||||
elevation: del ? 0 : 1,
|
||||
})}
|
||||
>
|
||||
<T style={{ fontFamily: font.semibold, fontSize: 26, color: del ? c.text3 : c.text }}>{k}</T>
|
||||
</Pressable>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
|
||||
<Button
|
||||
large
|
||||
label={points > 0 && !overLimit ? `Créditer ${points} ${unit('AMOUNT', points)}` : 'Créditer'}
|
||||
onPress={submit}
|
||||
loading={busy}
|
||||
disabled={points <= 0 || overLimit}
|
||||
/>
|
||||
</Screen>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue