MonEspacePro/pro/app/loyalty.tsx
Tony AVERTY bf10beb89b Inscription en ligne automatique, rôle Dirigeant, cadeaux en nature, titre des campagnes
- Inscription depuis la page Tarif : paiement Stripe puis création automatique
  du magasin, de l'abonnement et du compte Dirigeant (webhook), e-mail de bienvenue
- Plus d'essai gratuit (site, Stripe, e-mails)
- Création d'un magasin dans l'admin : formule obligatoire, compte Dirigeant et
  lien de paiement permanent envoyés automatiquement
- Ouverture automatique du magasin dès l'abonnement payé et la carte conçue
- API du Dirigeant : carte, employés, fiche magasin ; changement de mot de passe
- Anniversaire et parrainage : cadeau en nature remis en caisse
- Campagnes : titre de notification choisi à chaque envoi
- « Gérant » devient « Dirigeant »

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 11:45:07 +02:00

43 lines
2 KiB
TypeScript

import { useCallback, useState } from 'react';
import { Pressable, ScrollView, View } from 'react-native';
import { router, useFocusEffect } from 'expo-router';
import { api } from '../src/api';
import { describe } from '../src/errors';
import { Banner, Card, T } from '../src/ui';
import { font, useColors } from '../src/theme';
import type { ModuleInfo } from '../src/modules';
/** Modules complémentaires du magasin (dirigeants) : état et accès aux réglages. */
export default function Modules() {
const c = useColors();
const [list, setList] = useState<ModuleInfo[] | null>(null);
const [error, setError] = useState<string | null>(null);
useFocusEffect(
useCallback(() => {
api.get<ModuleInfo[]>('/api/staff/modules').then(setList).catch((e) => setError(describe(e).detail));
}, []),
);
return (
<ScrollView contentContainerStyle={{ padding: 20, gap: 12 }}>
<T v="muted">Faites revenir vos clients avec des messages sur leur carte Wallet. Chaque module se règle entièrement : textes, délais, heures d'envoi.</T>
{error && <Banner tone="error">{error}</Banner>}
{list?.map((m) => {
const state = !m.available ? ['Non inclus', c.text3] : m.config.enabled ? ['Activé', c.ok] : ['Désactivé', c.text3];
return (
<Pressable key={m.id} accessibilityRole="button" onPress={() => router.push({ pathname: '/module/[id]', params: { id: m.id } })}>
{({ 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 }}>{m.name}</T>
<T style={{ fontFamily: font.semibold, fontSize: 13, color: state[1] }}>{state[0]}</T>
</View>
<T v="muted" style={{ fontSize: 14 }}>{m.tagline}</T>
</Card>
)}
</Pressable>
);
})}
</ScrollView>
);
}