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) {
|
if (stamp) {
|
||||||
return (
|
return (
|
||||||
<Screen style={{ justifyContent: 'center' }}>
|
<Screen style={{ alignItems: 'stretch' }}>
|
||||||
<T v="h1" style={{ textAlign: 'center' }}>+1 tampon</T>
|
<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>
|
<T v="muted" style={{ textAlign: 'center' }}>Un tampon par passage, quel que soit le montant.</T>
|
||||||
|
</View>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<Button large label="Valider le tampon" onPress={submit} loading={busy} />
|
<Button large label="Valider le tampon" onPress={submit} loading={busy} />
|
||||||
|
<Button label="Annuler" variant="secondary" onPress={() => router.back()} />
|
||||||
</Screen>
|
</Screen>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QUICK = [5, 10, 20, 50];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Screen>
|
<Screen>
|
||||||
<View style={{ alignItems: 'center', gap: 6, paddingTop: 8 }}>
|
{/* Montant et points gagnés */}
|
||||||
<T v="muted">Montant de la commande</T>
|
<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
|
<T
|
||||||
accessibilityLabel={`Montant ${euros(cents)}`}
|
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'} €
|
{input || '0'} €
|
||||||
</T>
|
</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)}`}
|
{overLimit ? `Plafond : ${euros(store.maxAmountCents)}` : `+ ${points} ${unit('AMOUNT', points)}`}
|
||||||
</T>
|
</T>
|
||||||
</View>
|
</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' }}>
|
{/* Montants rapides */}
|
||||||
{KEYS.map((k) => (
|
<View style={{ flexDirection: 'row', gap: 8 }}>
|
||||||
|
{QUICK.map((q) => (
|
||||||
<Pressable
|
<Pressable
|
||||||
key={k}
|
key={q}
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
accessibilityLabel={k === '⌫' ? 'Effacer' : k === ',' ? 'Virgule' : k}
|
accessibilityLabel={`${q} euros`}
|
||||||
onPress={() => press(k)}
|
onPress={() => {
|
||||||
style={({ pressed }) => ({
|
Haptics.selectionAsync();
|
||||||
width: '31%',
|
setInput(String(q));
|
||||||
flexGrow: 1,
|
}}
|
||||||
height: 64,
|
style={({ pressed }) => ({ flex: 1, height: 44, borderRadius: 999, alignItems: 'center', justifyContent: 'center', backgroundColor: pressed ? c.primary : c.primarySoft })}
|
||||||
borderRadius: 14,
|
|
||||||
backgroundColor: pressed ? c.surface2 : c.surface,
|
|
||||||
borderWidth: 1,
|
|
||||||
borderColor: c.border,
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center',
|
|
||||||
})}
|
|
||||||
>
|
>
|
||||||
<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>
|
</Pressable>
|
||||||
))}
|
))}
|
||||||
</View>
|
</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>
|
</Screen>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue