App : onglets Scan | Configuration pour le Dirigeant

Scan : scanner, chiffres du jour, campagne, statistiques, historique.
Configuration : modules, employés, carte de fidélité (espace web), mon compte.
L'employé garde un écran unique sans onglets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Tony AVERTY 2026-10-07 13:35:07 +02:00
parent a1f6db8819
commit a510efc496

View file

@ -59,6 +59,7 @@ function Counter() {
const store = useStore();
const [summary, setSummary] = useState<Summary | null>(null);
const [refreshing, setRefreshing] = useState(false);
const [tab, setTab] = useState<'scan' | 'config'>('scan');
const load = useCallback(async () => {
try {
@ -113,6 +114,31 @@ function Counter() {
</Pressable>
</View>
{isManager && (
<View accessibilityRole="tablist" style={{ flexDirection: 'row', backgroundColor: c.surface, borderRadius: 14, padding: 4, borderWidth: 1, borderColor: c.border }}>
{(
[
['scan', 'Scan'],
['config', 'Configuration'],
] as const
).map(([k, label]) => (
<Pressable
key={k}
accessibilityRole="tab"
accessibilityState={{ selected: tab === k }}
onPress={() => setTab(k)}
style={{ flex: 1, paddingVertical: 10, borderRadius: 10, alignItems: 'center', backgroundColor: tab === k ? c.primary : 'transparent' }}
>
<T style={{ fontFamily: font.bold, fontSize: 15, color: tab === k ? c.onPrimary : c.text }}>{label}</T>
</Pressable>
))}
</View>
)}
{tab === 'config' && isManager ? (
<ConfigTab />
) : (
<>
<Pressable
accessibilityRole="button"
accessibilityLabel="Scanner une carte"
@ -149,13 +175,41 @@ function Counter() {
</View>
<View style={{ flex: 1 }} />
{isManager && <Button label="Modules" variant="secondary" onPress={() => router.push('/loyalty')} />}
{isManager && <Button label="Campagnes" variant="secondary" onPress={() => router.push('/campaigns')} />}
{isManager && <Button label="Employés" variant="secondary" onPress={() => router.push('/team')} />}
{isManager && <Button label="Envoyer une campagne" variant="secondary" onPress={() => router.push('/campaigns')} />}
{isManager && <Button label="Statistiques" variant="secondary" onPress={() => router.push('/stats')} />}
<Button label="Historique des opérations" variant="secondary" onPress={() => router.push('/history')} />
<Button label="Mon compte" variant="secondary" onPress={() => router.push('/account')} />
{!isManager && <Button label="Mon compte" variant="secondary" onPress={() => router.push('/account')} />}
</>
)}
</ScrollView>
</SafeAreaView>
);
}
/** Onglet Configuration (Dirigeant) : tout ce qui se règle. */
function ConfigTab() {
const c = useColors();
const rows: [string, string, () => void][] = [
['Modules', 'Campagnes, relances, anniversaire, avis Google, parrainage : activation, textes et récompenses', () => router.push('/loyalty')],
['Employés', 'Comptes, rôles Employé / Dirigeant, mots de passe', () => router.push('/team')],
['Carte de fidélité', 'Logo, couleurs, règle de points, récompenses (espace web)', () => Linking.openURL(ESPACE_URL)],
['Mon compte', 'Mot de passe', () => router.push('/account')],
];
return (
<View style={{ gap: 12 }}>
{rows.map(([title, sub, go]) => (
<Pressable key={title} accessibilityRole="button" onPress={go}>
{({ pressed }) => (
<Card style={{ padding: 16, gap: 4, opacity: pressed ? 0.7 : 1 }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
<T style={{ fontFamily: font.bold, fontSize: 17 }}>{title}</T>
<T style={{ color: c.text3, fontSize: 20 }}>›</T>
</View>
<T v="muted" style={{ fontSize: 14 }}>{sub}</T>
</Card>
)}
</Pressable>
))}
</View>
);
}