Compare commits
2 commits
fb658ad460
...
0452865b82
| Author | SHA1 | Date | |
|---|---|---|---|
| 0452865b82 | |||
| dd629b6af2 |
21 changed files with 365 additions and 76 deletions
|
|
@ -68,3 +68,23 @@ npx expo start
|
||||||
|
|
||||||
Scannez le QR code affiché avec l'appareil photo de l'iPhone (app **Expo Go** installée, même réseau Wi-Fi que l'ordinateur).
|
Scannez le QR code affiché avec l'appareil photo de l'iPhone (app **Expo Go** installée, même réseau Wi-Fi que l'ordinateur).
|
||||||
L'adresse de l'API utilisée est celle du fichier `pro/.env`.
|
L'adresse de l'API utilisée est celle du fichier `pro/.env`.
|
||||||
|
|
||||||
|
## Mettre à jour l'app sans recompiler (EAS Update)
|
||||||
|
|
||||||
|
Depuis l'ajout d'`expo-updates`, les modifications du code de l'app (écrans, textes, icônes, corrections) se publient
|
||||||
|
**sans nouvelle compilation**. Au lancement, l'app vérifie s'il existe une nouvelle version : si oui, elle affiche
|
||||||
|
l'écran « Mise à jour en cours » avec une barre de progression et le pourcentage, puis « Mise à jour installée » avec
|
||||||
|
le bouton « Relancer l'application ». Sans mise à jour ou sans réseau, rien ne s'affiche et l'app démarre normalement.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx eas-cli update --channel production --message "Description courte du changement"
|
||||||
|
```
|
||||||
|
|
||||||
|
(dans le dossier `pro/`). La mise à jour utilise l'adresse de l'API de `pro/.env.production`.
|
||||||
|
|
||||||
|
**Une nouvelle compilation reste nécessaire** seulement quand on change la partie native de l'app :
|
||||||
|
ajout ou mise à jour d'un module natif (`npx expo install …`), permissions, icône, écran de démarrage,
|
||||||
|
nom ou identifiant, version de l'app (`version` dans `app.json`), ou montée de version d'Expo.
|
||||||
|
|
||||||
|
Les mises à jour ne s'appliquent qu'aux compilations qui contiennent `expo-updates` : le **build 3** (premier envoi
|
||||||
|
TestFlight) ne les reçoit pas ; toutes les compilations suivantes, si.
|
||||||
|
|
|
||||||
13
pro/app.json
13
pro/app.json
|
|
@ -15,6 +15,7 @@
|
||||||
"ITSAppUsesNonExemptEncryption": false,
|
"ITSAppUsesNonExemptEncryption": false,
|
||||||
"CFBundleDevelopmentRegion": "fr",
|
"CFBundleDevelopmentRegion": "fr",
|
||||||
"CFBundleLocalizations": [
|
"CFBundleLocalizations": [
|
||||||
|
"fr",
|
||||||
"fr"
|
"fr"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -27,9 +28,11 @@
|
||||||
"backgroundColor": "#0E7A66"
|
"backgroundColor": "#0E7A66"
|
||||||
},
|
},
|
||||||
"permissions": [
|
"permissions": [
|
||||||
|
"android.permission.CAMERA",
|
||||||
"android.permission.CAMERA"
|
"android.permission.CAMERA"
|
||||||
],
|
],
|
||||||
"blockedPermissions": [
|
"blockedPermissions": [
|
||||||
|
"android.permission.RECORD_AUDIO",
|
||||||
"android.permission.RECORD_AUDIO"
|
"android.permission.RECORD_AUDIO"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -63,6 +66,14 @@
|
||||||
"projectId": "2ac42d3a-9ded-4115-a8f5-0d3dbc9fe9ad"
|
"projectId": "2ac42d3a-9ded-4115-a8f5-0d3dbc9fe9ad"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"owner": "hunterlevrai"
|
"owner": "hunterlevrai",
|
||||||
|
"runtimeVersion": {
|
||||||
|
"policy": "appVersion"
|
||||||
|
},
|
||||||
|
"updates": {
|
||||||
|
"url": "https://u.expo.dev/2ac42d3a-9ded-4115-a8f5-0d3dbc9fe9ad",
|
||||||
|
"checkAutomatically": "NEVER",
|
||||||
|
"fallbackToCacheTimeout": 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import {
|
||||||
} from '@expo-google-fonts/figtree';
|
} from '@expo-google-fonts/figtree';
|
||||||
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
||||||
import { SessionProvider, useSession } from '../src/session';
|
import { SessionProvider, useSession } from '../src/session';
|
||||||
|
import { UpdateGate } from '../src/UpdateGate';
|
||||||
import { font, useColors } from '../src/theme';
|
import { font, useColors } from '../src/theme';
|
||||||
|
|
||||||
SplashScreen.preventAutoHideAsync();
|
SplashScreen.preventAutoHideAsync();
|
||||||
|
|
@ -66,7 +67,9 @@ export default function RootLayout() {
|
||||||
<SafeAreaProvider>
|
<SafeAreaProvider>
|
||||||
<SessionProvider>
|
<SessionProvider>
|
||||||
<StatusBar style="auto" />
|
<StatusBar style="auto" />
|
||||||
<Navigator />
|
<UpdateGate>
|
||||||
|
<Navigator />
|
||||||
|
</UpdateGate>
|
||||||
</SessionProvider>
|
</SessionProvider>
|
||||||
</SafeAreaProvider>
|
</SafeAreaProvider>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { describe } from '../src/errors';
|
||||||
import { useStore } from '../src/session';
|
import { useStore } from '../src/session';
|
||||||
import { Banner, Button, Card, T } from '../src/ui';
|
import { Banner, Button, Card, T } from '../src/ui';
|
||||||
import { font, useColors } from '../src/theme';
|
import { font, useColors } from '../src/theme';
|
||||||
|
import { Icon } from '../src/icons';
|
||||||
|
|
||||||
interface Overview {
|
interface Overview {
|
||||||
defaultTitle: string;
|
defaultTitle: string;
|
||||||
|
|
@ -93,7 +94,7 @@ export default function Campaigns() {
|
||||||
{/* Audience */}
|
{/* Audience */}
|
||||||
<View style={{ backgroundColor: c.primary, borderRadius: 22, padding: 20, flexDirection: 'row', alignItems: 'center', gap: 14 }}>
|
<View style={{ backgroundColor: c.primary, borderRadius: 22, padding: 20, flexDirection: 'row', alignItems: 'center', gap: 14 }}>
|
||||||
<View style={{ width: 52, height: 52, borderRadius: 16, backgroundColor: 'rgba(255,255,255,0.18)', alignItems: 'center', justifyContent: 'center' }}>
|
<View style={{ width: 52, height: 52, borderRadius: 16, backgroundColor: 'rgba(255,255,255,0.18)', alignItems: 'center', justifyContent: 'center' }}>
|
||||||
<T style={{ fontSize: 26 }}>📣</T>
|
<Icon name="megaphone" size={26} color="#FFFFFF" />
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<T style={{ color: c.onPrimary, fontFamily: font.extrabold, fontSize: 28 }}>{data?.audience.cards ?? '—'}</T>
|
<T style={{ color: c.onPrimary, fontFamily: font.extrabold, fontSize: 28 }}>{data?.audience.cards ?? '—'}</T>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { api, CardInfo } from '../../../src/api';
|
||||||
import { describe, ErrorScreen } from '../../../src/errors';
|
import { describe, ErrorScreen } from '../../../src/errors';
|
||||||
import { Banner, Button, Card, Screen, T, unit } from '../../../src/ui';
|
import { Banner, Button, Card, Screen, T, unit } from '../../../src/ui';
|
||||||
import { font, useColors } from '../../../src/theme';
|
import { font, useColors } from '../../../src/theme';
|
||||||
|
import { Icon } from '../../../src/icons';
|
||||||
|
|
||||||
function ago(iso: string) {
|
function ago(iso: string) {
|
||||||
const min = Math.round((Date.now() - new Date(iso).getTime()) / 60000);
|
const min = Math.round((Date.now() - new Date(iso).getTime()) / 60000);
|
||||||
|
|
@ -110,7 +111,7 @@ export default function ClientCard() {
|
||||||
{card.gifts.map((g) => (
|
{card.gifts.map((g) => (
|
||||||
<Card key={g.id} style={{ padding: 14, flexDirection: 'row', alignItems: 'center', gap: 12 }}>
|
<Card key={g.id} style={{ padding: 14, flexDirection: 'row', alignItems: 'center', gap: 12 }}>
|
||||||
<View style={{ width: 44, height: 44, borderRadius: 22, backgroundColor: c.warnBg, alignItems: 'center', justifyContent: 'center' }}>
|
<View style={{ width: 44, height: 44, borderRadius: 22, backgroundColor: c.warnBg, alignItems: 'center', justifyContent: 'center' }}>
|
||||||
<T style={{ fontSize: 22 }}>🎁</T>
|
<Icon name="gift" size={22} color={c.warn} />
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1, gap: 2 }}>
|
<View style={{ flex: 1, gap: 2 }}>
|
||||||
<T v="label">{g.label}</T>
|
<T v="label">{g.label}</T>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import { useCard } from '../../../src/useCard';
|
||||||
import { ErrorScreen } from '../../../src/errors';
|
import { ErrorScreen } from '../../../src/errors';
|
||||||
import { Button, Screen, T, unit } from '../../../src/ui';
|
import { Button, Screen, T, unit } from '../../../src/ui';
|
||||||
import { font, useColors } from '../../../src/theme';
|
import { font, useColors } from '../../../src/theme';
|
||||||
|
import { Icon } from '../../../src/icons';
|
||||||
|
|
||||||
/** Choix d'une récompense (maquette 6) : les accessibles d'abord, les autres grisées. */
|
/** Choix d'une récompense (maquette 6) : les accessibles d'abord, les autres grisées. */
|
||||||
export default function Rewards() {
|
export default function Rewards() {
|
||||||
|
|
@ -75,7 +76,7 @@ export default function Rewards() {
|
||||||
>
|
>
|
||||||
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>
|
||||||
<View style={{ width: 46, height: 46, borderRadius: 23, backgroundColor: ok ? c.warnBg : c.surface2, alignItems: 'center', justifyContent: 'center' }}>
|
<View style={{ width: 46, height: 46, borderRadius: 23, backgroundColor: ok ? c.warnBg : c.surface2, alignItems: 'center', justifyContent: 'center' }}>
|
||||||
<T style={{ fontSize: 22 }}>{ok ? '🎁' : '🔒'}</T>
|
<Icon name={ok ? 'gift' : 'lock'} size={22} color={ok ? c.warn : c.text3} />
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1, gap: 2 }}>
|
<View style={{ flex: 1, gap: 2 }}>
|
||||||
<T v="label" style={{ fontSize: 17, color: ok ? c.text : c.text3 }}>{r.label}</T>
|
<T v="label" style={{ fontSize: 17, color: ok ? c.text : c.text3 }}>{r.label}</T>
|
||||||
|
|
@ -114,7 +115,7 @@ export default function Rewards() {
|
||||||
{card.balance} <T style={{ color: store.design.foregroundColor, fontSize: 18 }}>{unit(mode, card.balance)}</T>
|
{card.balance} <T style={{ color: store.design.foregroundColor, fontSize: 18 }}>{unit(mode, card.balance)}</T>
|
||||||
</T>
|
</T>
|
||||||
</View>
|
</View>
|
||||||
<T style={{ fontSize: 34 }}>⭐</T>
|
<Icon name="star" size={34} color={c.warn} />
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{available.length > 0 ? (
|
{available.length > 0 ? (
|
||||||
|
|
@ -124,7 +125,7 @@ export default function Rewards() {
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<View style={{ alignItems: 'center', gap: 6, paddingVertical: 12 }}>
|
<View style={{ alignItems: 'center', gap: 6, paddingVertical: 12 }}>
|
||||||
<T style={{ fontSize: 32 }}>⏳</T>
|
<Icon name="hourglass" size={32} color={c.text3} />
|
||||||
<T v="muted" style={{ textAlign: 'center' }}>Aucune récompense disponible pour l'instant.</T>
|
<T v="muted" style={{ textAlign: 'center' }}>Aucune récompense disponible pour l'instant.</T>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import Svg, { Path } from 'react-native-svg';
|
||||||
import { useStore } from '../src/session';
|
import { useStore } from '../src/session';
|
||||||
import { Button, Screen, T, unit } from '../src/ui';
|
import { Button, Screen, T, unit } from '../src/ui';
|
||||||
import { font, useColors } from '../src/theme';
|
import { font, useColors } from '../src/theme';
|
||||||
|
import { Icon } from '../src/icons';
|
||||||
|
|
||||||
/** Confirmation (maquette 7) : nouveau solde, Wallet mis à jour. */
|
/** Confirmation (maquette 7) : nouveau solde, Wallet mis à jour. */
|
||||||
export default function Done() {
|
export default function Done() {
|
||||||
|
|
@ -38,7 +39,7 @@ export default function Done() {
|
||||||
style={{ width: 100, height: 100, borderRadius: 50, backgroundColor: tint, alignItems: 'center', justifyContent: 'center', transform: [{ scale }] }}
|
style={{ width: 100, height: 100, borderRadius: 50, backgroundColor: tint, alignItems: 'center', justifyContent: 'center', transform: [{ scale }] }}
|
||||||
>
|
>
|
||||||
{redeem ? (
|
{redeem ? (
|
||||||
<T style={{ fontSize: 46 }}>🎁</T>
|
<Icon name="gift" size={46} color={fg} />
|
||||||
) : (
|
) : (
|
||||||
<Svg width={50} height={50} viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth={2.6} strokeLinecap="round" strokeLinejoin="round">
|
<Svg width={50} height={50} viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth={2.6} strokeLinecap="round" strokeLinejoin="round">
|
||||||
<Path d="M5 12.5l4.5 4.5L19 7.5" />
|
<Path d="M5 12.5l4.5 4.5L19 7.5" />
|
||||||
|
|
@ -67,7 +68,7 @@ export default function Done() {
|
||||||
{p.balance} <T style={{ color: fg, fontSize: 18 }}>{unit(mode, balance)}</T>
|
{p.balance} <T style={{ color: fg, fontSize: 18 }}>{unit(mode, balance)}</T>
|
||||||
</T>
|
</T>
|
||||||
</View>
|
</View>
|
||||||
<T style={{ color: fg, opacity: 0.8, fontSize: 12, marginBottom: 6 }}>Wallet mis à jour ✓</T>
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 4, marginBottom: 6, opacity: 0.8 }}><T style={{ color: fg, fontSize: 12 }}>Wallet mis à jour</T><Icon name="check" size={13} color={fg} strokeWidth={2.5} /></View>
|
||||||
</View>
|
</View>
|
||||||
{(next || ready > 0) && (
|
{(next || ready > 0) && (
|
||||||
<View style={{ gap: 6 }}>
|
<View style={{ gap: 6 }}>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { api, Operation } from '../src/api';
|
||||||
import { useSession, useStore } from '../src/session';
|
import { useSession, useStore } from '../src/session';
|
||||||
import { Banner, Card, T, euros, unit } from '../src/ui';
|
import { Banner, Card, T, euros, unit } from '../src/ui';
|
||||||
import { font, useColors } from '../src/theme';
|
import { font, useColors } from '../src/theme';
|
||||||
|
import { Icon, IconName } from '../src/icons';
|
||||||
|
|
||||||
type Period = 'today' | 'week';
|
type Period = 'today' | 'week';
|
||||||
|
|
||||||
|
|
@ -100,7 +101,7 @@ export default function History() {
|
||||||
ListEmptyComponent={
|
ListEmptyComponent={
|
||||||
!loading ? (
|
!loading ? (
|
||||||
<View style={{ alignItems: 'center', marginTop: 48, gap: 6 }}>
|
<View style={{ alignItems: 'center', marginTop: 48, gap: 6 }}>
|
||||||
<T style={{ fontSize: 36 }}>🗒️</T>
|
<Icon name="list" size={36} color={c.text3} />
|
||||||
<T v="muted" style={{ textAlign: 'center' }}>Aucune opération sur la période.</T>
|
<T v="muted" style={{ textAlign: 'center' }}>Aucune opération sur la période.</T>
|
||||||
</View>
|
</View>
|
||||||
) : null
|
) : null
|
||||||
|
|
@ -119,7 +120,7 @@ export default function History() {
|
||||||
: o.amountCents
|
: o.amountCents
|
||||||
? euros(o.amountCents)
|
? euros(o.amountCents)
|
||||||
: 'Passage';
|
: 'Passage';
|
||||||
const [iconBg, iconFg, icon] = rejected ? [c.errBg, c.err, '!'] : redeem ? [c.warnBg, c.warn, '★'] : [c.okBg, c.ok, '+'];
|
const [iconBg, iconFg, icon] = (rejected ? [c.errBg, c.err, 'alert'] : redeem ? [c.warnBg, c.warn, 'star'] : [c.okBg, c.ok, 'plus']) as [string, string, IconName];
|
||||||
return (
|
return (
|
||||||
<View style={{ gap: 8 }}>
|
<View style={{ gap: 8 }}>
|
||||||
{newDay && (
|
{newDay && (
|
||||||
|
|
@ -129,7 +130,7 @@ export default function History() {
|
||||||
)}
|
)}
|
||||||
<Card style={{ flexDirection: 'row', alignItems: 'center', gap: 12, padding: 12, opacity: rejected ? 0.85 : 1 }}>
|
<Card style={{ flexDirection: 'row', alignItems: 'center', gap: 12, padding: 12, opacity: rejected ? 0.85 : 1 }}>
|
||||||
<View style={{ width: 40, height: 40, borderRadius: 20, backgroundColor: iconBg, alignItems: 'center', justifyContent: 'center' }}>
|
<View style={{ width: 40, height: 40, borderRadius: 20, backgroundColor: iconBg, alignItems: 'center', justifyContent: 'center' }}>
|
||||||
<T style={{ fontFamily: font.extrabold, fontSize: 18, color: iconFg }}>{icon}</T>
|
<Icon name={icon} size={20} color={iconFg} strokeWidth={2.4} />
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1, gap: 2 }}>
|
<View style={{ flex: 1, gap: 2 }}>
|
||||||
<T v="label" numberOfLines={1}>{o.customerFirstName}</T>
|
<T v="label" numberOfLines={1}>{o.customerFirstName}</T>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { api, API_URL, Summary } from '../src/api';
|
||||||
import { useSession, useStore } from '../src/session';
|
import { useSession, useStore } from '../src/session';
|
||||||
import { BrandSymbol, Button, Card, T, unit } from '../src/ui';
|
import { BrandSymbol, Button, Card, T, unit } from '../src/ui';
|
||||||
import { font, useColors } from '../src/theme';
|
import { font, useColors } from '../src/theme';
|
||||||
|
import { Icon, IconName } from '../src/icons';
|
||||||
|
|
||||||
function ScanIcon({ color }: { color: string }) {
|
function ScanIcon({ color }: { color: string }) {
|
||||||
return (
|
return (
|
||||||
|
|
@ -55,20 +56,20 @@ function Header() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Ligne d'action ou de réglage : pictogramme, titre, sous-titre, chevron. */
|
/** Ligne d'action ou de réglage : pictogramme, titre, sous-titre, chevron. */
|
||||||
function Row({ icon, title, sub, onPress }: { icon: string; title: string; sub?: string; onPress: () => void }) {
|
function Row({ icon, title, sub, onPress }: { icon: IconName; title: string; sub?: string; onPress: () => void }) {
|
||||||
const c = useColors();
|
const c = useColors();
|
||||||
return (
|
return (
|
||||||
<Pressable accessibilityRole="button" onPress={onPress}>
|
<Pressable accessibilityRole="button" onPress={onPress}>
|
||||||
{({ pressed }) => (
|
{({ pressed }) => (
|
||||||
<Card style={{ padding: 14, flexDirection: 'row', alignItems: 'center', gap: 14, opacity: pressed ? 0.7 : 1 }}>
|
<Card style={{ padding: 14, flexDirection: 'row', alignItems: 'center', gap: 14, opacity: pressed ? 0.7 : 1 }}>
|
||||||
<View style={{ width: 44, height: 44, borderRadius: 13, backgroundColor: c.primarySoft, alignItems: 'center', justifyContent: 'center' }}>
|
<View style={{ width: 44, height: 44, borderRadius: 13, backgroundColor: c.primarySoft, alignItems: 'center', justifyContent: 'center' }}>
|
||||||
<T style={{ fontSize: 22 }}>{icon}</T>
|
<Icon name={icon} size={22} color={c.primary} />
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1, gap: 2 }}>
|
<View style={{ flex: 1, gap: 2 }}>
|
||||||
<T style={{ fontFamily: font.bold, fontSize: 16 }}>{title}</T>
|
<T style={{ fontFamily: font.bold, fontSize: 16 }}>{title}</T>
|
||||||
{!!sub && <T v="muted" style={{ fontSize: 13 }} numberOfLines={2}>{sub}</T>}
|
{!!sub && <T v="muted" style={{ fontSize: 13 }} numberOfLines={2}>{sub}</T>}
|
||||||
</View>
|
</View>
|
||||||
<T style={{ color: c.text3, fontSize: 22 }}>›</T>
|
<Icon name="chevronRight" size={20} color={c.text3} />
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
|
|
@ -87,7 +88,7 @@ function NoCardYet() {
|
||||||
<Header />
|
<Header />
|
||||||
<View style={{ alignItems: 'center', gap: 10, paddingVertical: 16 }}>
|
<View style={{ alignItems: 'center', gap: 10, paddingVertical: 16 }}>
|
||||||
<View style={{ width: 96, height: 96, borderRadius: 48, backgroundColor: c.primarySoft, alignItems: 'center', justifyContent: 'center' }}>
|
<View style={{ width: 96, height: 96, borderRadius: 48, backgroundColor: c.primarySoft, alignItems: 'center', justifyContent: 'center' }}>
|
||||||
<T style={{ fontSize: 44 }}>🎨</T>
|
<Icon name="palette" size={44} color={c.primary} />
|
||||||
</View>
|
</View>
|
||||||
<T v="h1" style={{ textAlign: 'center' }}>{isManager ? 'Dernière étape' : 'Presque prêt'}</T>
|
<T v="h1" style={{ textAlign: 'center' }}>{isManager ? 'Dernière étape' : 'Presque prêt'}</T>
|
||||||
<T v="muted" style={{ textAlign: 'center' }}>
|
<T v="muted" style={{ textAlign: 'center' }}>
|
||||||
|
|
@ -100,8 +101,8 @@ function NoCardYet() {
|
||||||
<Button label="C’est fait, actualiser" variant="secondary" onPress={reload} />
|
<Button label="C’est fait, actualiser" variant="secondary" onPress={reload} />
|
||||||
{isManager && (
|
{isManager && (
|
||||||
<View style={{ gap: 10, marginTop: 8 }}>
|
<View style={{ gap: 10, marginTop: 8 }}>
|
||||||
<Row icon="👥" title="Employés" sub="Créez les comptes de votre équipe" onPress={() => router.push('/team')} />
|
<Row icon="users" title="Employés" sub="Créez les comptes de votre équipe" onPress={() => router.push('/team')} />
|
||||||
<Row icon="🧩" title="Modules" sub="Préparez vos campagnes, relances et cadeaux" onPress={() => router.push('/loyalty')} />
|
<Row icon="puzzle" title="Modules" sub="Préparez vos campagnes, relances et cadeaux" onPress={() => router.push('/loyalty')} />
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
@ -168,7 +169,7 @@ function Counter() {
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<T v="h1">
|
<T v="h1">
|
||||||
{greeting()} {me?.displayName.split(' ')[0]} 👋
|
{greeting()} {me?.displayName.split(' ')[0]}
|
||||||
</T>
|
</T>
|
||||||
|
|
||||||
{/* Action principale */}
|
{/* Action principale */}
|
||||||
|
|
@ -201,13 +202,13 @@ function Counter() {
|
||||||
<View style={{ gap: 10 }}>
|
<View style={{ gap: 10 }}>
|
||||||
<T v="label" style={sectionTitle(c)}>{isManager ? "Aujourd'hui au magasin" : "Mes opérations aujourd'hui"}</T>
|
<T v="label" style={sectionTitle(c)}>{isManager ? "Aujourd'hui au magasin" : "Mes opérations aujourd'hui"}</T>
|
||||||
<View style={{ flexDirection: 'row', gap: 10 }}>
|
<View style={{ flexDirection: 'row', gap: 10 }}>
|
||||||
{[
|
{([
|
||||||
['🧾', summary?.operations ?? '—', 'opérations'],
|
['receipt', summary?.operations ?? '—', 'opérations'],
|
||||||
['➕', summary?.pointsGiven ?? '—', `${u} donnés`],
|
['plusCircle', summary?.pointsGiven ?? '—', `${u} donnés`],
|
||||||
['🎁', summary?.rewards ?? '—', 'récompenses'],
|
['gift', summary?.rewards ?? '—', 'récompenses'],
|
||||||
].map(([icon, n, l]) => (
|
] as [IconName, string | number, string][]).map(([icon, n, l]) => (
|
||||||
<View key={String(l)} style={{ flex: 1, padding: 14, gap: 4, borderRadius: 18, backgroundColor: c.primarySoft }}>
|
<View key={String(l)} style={{ flex: 1, padding: 14, gap: 4, borderRadius: 18, backgroundColor: c.primarySoft }}>
|
||||||
<T style={{ fontSize: 16 }}>{icon}</T>
|
<Icon name={icon} size={18} color={c.primary} />
|
||||||
<T style={{ fontFamily: font.extrabold, fontSize: 26, color: c.primary }}>{n}</T>
|
<T style={{ fontFamily: font.extrabold, fontSize: 26, color: c.primary }}>{n}</T>
|
||||||
<T v="muted" style={{ fontSize: 12 }} numberOfLines={1}>{l}</T>
|
<T v="muted" style={{ fontSize: 12 }} numberOfLines={1}>{l}</T>
|
||||||
</View>
|
</View>
|
||||||
|
|
@ -217,9 +218,9 @@ function Counter() {
|
||||||
|
|
||||||
{/* Autres actions */}
|
{/* Autres actions */}
|
||||||
<View style={{ gap: 10 }}>
|
<View style={{ gap: 10 }}>
|
||||||
{isManager && <Row icon="📣" title="Envoyer une campagne" sub="Une notification à tous vos clients" onPress={() => router.push('/campaigns')} />}
|
{isManager && <Row icon="megaphone" title="Envoyer une campagne" sub="Une notification à tous vos clients" onPress={() => router.push('/campaigns')} />}
|
||||||
{isManager && <Row icon="📊" title="Statistiques" sub="Passages, clients fidèles, exports" onPress={() => router.push('/stats')} />}
|
{isManager && <Row icon="chart" title="Statistiques" sub="Passages, clients fidèles, exports" onPress={() => router.push('/stats')} />}
|
||||||
<Row icon="🕘" title="Historique des opérations" sub={isManager ? 'Toutes les opérations du magasin' : 'Vos opérations'} onPress={() => router.push('/history')} />
|
<Row icon="history" title="Historique des opérations" sub={isManager ? 'Toutes les opérations du magasin' : 'Vos opérations'} onPress={() => router.push('/history')} />
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
@ -234,11 +235,11 @@ function ConfigTab() {
|
||||||
return (
|
return (
|
||||||
<View style={{ gap: 10 }}>
|
<View style={{ gap: 10 }}>
|
||||||
<T v="label" style={sectionTitle(c)}>Fidélisation</T>
|
<T v="label" style={sectionTitle(c)}>Fidélisation</T>
|
||||||
<Row icon="🧩" title="Modules" sub="Campagnes, relances, anniversaire, avis Google, parrainage" onPress={() => router.push('/loyalty')} />
|
<Row icon="puzzle" title="Modules" sub="Campagnes, relances, anniversaire, avis Google, parrainage" onPress={() => router.push('/loyalty')} />
|
||||||
<Row icon="🎨" title="Carte de fidélité" sub="Logo, couleurs, règle de points, récompenses (espace web)" onPress={() => Linking.openURL(ESPACE_URL)} />
|
<Row icon="palette" title="Carte de fidélité" sub="Logo, couleurs, règle de points, récompenses (espace web)" onPress={() => Linking.openURL(ESPACE_URL)} />
|
||||||
<T v="label" style={[sectionTitle(c), { marginTop: 10 }]}>Équipe et compte</T>
|
<T v="label" style={[sectionTitle(c), { marginTop: 10 }]}>Équipe et compte</T>
|
||||||
<Row icon="👥" title="Employés" sub="Comptes, rôles Employé / Dirigeant, mots de passe" onPress={() => router.push('/team')} />
|
<Row icon="users" title="Employés" sub="Comptes, rôles Employé / Dirigeant, mots de passe" onPress={() => router.push('/team')} />
|
||||||
<Row icon="🔐" title="Mon compte" sub="Mot de passe, déconnexion" onPress={() => router.push('/account')} />
|
<Row icon="key" title="Mon compte" sub="Mot de passe, déconnexion" onPress={() => router.push('/account')} />
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { describe } from '../src/errors';
|
||||||
import { Banner, Card, T } from '../src/ui';
|
import { Banner, Card, T } from '../src/ui';
|
||||||
import { font, useColors } from '../src/theme';
|
import { font, useColors } from '../src/theme';
|
||||||
import { MODULE_ICON, ModuleInfo } from '../src/modules';
|
import { MODULE_ICON, ModuleInfo } from '../src/modules';
|
||||||
|
import { Icon } from '../src/icons';
|
||||||
|
|
||||||
/** Modules complémentaires du magasin (dirigeants) : activation directe et accès aux réglages. */
|
/** Modules complémentaires du magasin (dirigeants) : activation directe et accès aux réglages. */
|
||||||
export default function Modules() {
|
export default function Modules() {
|
||||||
|
|
@ -43,7 +44,7 @@ export default function Modules() {
|
||||||
{({ pressed }) => (
|
{({ pressed }) => (
|
||||||
<Card style={{ padding: 14, flexDirection: 'row', alignItems: 'center', gap: 14, opacity: pressed ? 0.7 : m.available ? 1 : 0.6 }}>
|
<Card style={{ padding: 14, flexDirection: 'row', alignItems: 'center', gap: 14, opacity: pressed ? 0.7 : m.available ? 1 : 0.6 }}>
|
||||||
<View style={{ width: 48, height: 48, borderRadius: 14, backgroundColor: m.available && m.config.enabled ? c.primarySoft : c.surface2, alignItems: 'center', justifyContent: 'center' }}>
|
<View style={{ width: 48, height: 48, borderRadius: 14, backgroundColor: m.available && m.config.enabled ? c.primarySoft : c.surface2, alignItems: 'center', justifyContent: 'center' }}>
|
||||||
<T style={{ fontSize: 24 }}>{MODULE_ICON[m.id] ?? '🧩'}</T>
|
<Icon name={MODULE_ICON[m.id] ?? 'puzzle'} size={24} color={m.available && m.config.enabled ? c.primary : c.text3} />
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1, gap: 2 }}>
|
<View style={{ flex: 1, gap: 2 }}>
|
||||||
<T style={{ fontFamily: font.bold, fontSize: 17 }} numberOfLines={1}>{m.name}</T>
|
<T style={{ fontFamily: font.bold, fontSize: 17 }} numberOfLines={1}>{m.name}</T>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { describe } from '../../src/errors';
|
||||||
import { FieldDef, isMessageField, MODULE_ICON, ModuleInfo, Value } from '../../src/modules';
|
import { FieldDef, isMessageField, MODULE_ICON, ModuleInfo, Value } from '../../src/modules';
|
||||||
import { Banner, Button, Card, T } from '../../src/ui';
|
import { Banner, Button, Card, T } from '../../src/ui';
|
||||||
import { font, useColors } from '../../src/theme';
|
import { font, useColors } from '../../src/theme';
|
||||||
|
import { Icon } from '../../src/icons';
|
||||||
|
|
||||||
function Field({ f, value, onChange }: { f: FieldDef; value: Value; onChange: (v: Value) => void }) {
|
function Field({ f, value, onChange }: { f: FieldDef; value: Value; onChange: (v: Value) => void }) {
|
||||||
const c = useColors();
|
const c = useColors();
|
||||||
|
|
@ -142,7 +143,7 @@ export default function ModuleScreen() {
|
||||||
<Card style={{ gap: 14 }}>
|
<Card style={{ gap: 14 }}>
|
||||||
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 14 }}>
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 14 }}>
|
||||||
<View style={{ width: 52, height: 52, borderRadius: 16, backgroundColor: enabled ? c.primarySoft : c.surface2, alignItems: 'center', justifyContent: 'center' }}>
|
<View style={{ width: 52, height: 52, borderRadius: 16, backgroundColor: enabled ? c.primarySoft : c.surface2, alignItems: 'center', justifyContent: 'center' }}>
|
||||||
<T style={{ fontSize: 26 }}>{MODULE_ICON[m.id] ?? '🧩'}</T>
|
<Icon name={MODULE_ICON[m.id] ?? 'puzzle'} size={26} color={enabled ? c.primary : c.text3} />
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<T style={{ fontFamily: font.bold, fontSize: 18 }}>{m.name}</T>
|
<T style={{ fontFamily: font.bold, fontSize: 18 }}>{m.name}</T>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import { api } from '../src/api';
|
||||||
import { describe } from '../src/errors';
|
import { describe } from '../src/errors';
|
||||||
import { Button, Screen, T } from '../src/ui';
|
import { Button, Screen, T } from '../src/ui';
|
||||||
import { font, useColors } from '../src/theme';
|
import { font, useColors } from '../src/theme';
|
||||||
|
import { Icon } from '../src/icons';
|
||||||
|
|
||||||
/** Les numéros de carte commencent par « MEP » (voir le back-end). */
|
/** Les numéros de carte commencent par « MEP » (voir le back-end). */
|
||||||
const SERIAL = /^MEP[A-Z2-9]{16}$/;
|
const SERIAL = /^MEP[A-Z2-9]{16}$/;
|
||||||
|
|
@ -152,7 +153,7 @@ export default function Scan() {
|
||||||
<Screen noHeader style={{ justifyContent: 'center', alignItems: 'stretch' }}>
|
<Screen noHeader style={{ justifyContent: 'center', alignItems: 'stretch' }}>
|
||||||
<View style={{ alignItems: 'center', gap: 14 }}>
|
<View style={{ alignItems: 'center', gap: 14 }}>
|
||||||
<View style={{ width: 96, height: 96, borderRadius: 48, backgroundColor: c.primarySoft, alignItems: 'center', justifyContent: 'center' }}>
|
<View style={{ width: 96, height: 96, borderRadius: 48, backgroundColor: c.primarySoft, alignItems: 'center', justifyContent: 'center' }}>
|
||||||
<T style={{ fontSize: 44 }}>📷</T>
|
<Icon name="camera" size={44} color={c.primary} />
|
||||||
</View>
|
</View>
|
||||||
<T v="h1" style={{ textAlign: 'center' }}>Accès à la caméra</T>
|
<T v="h1" style={{ textAlign: 'center' }}>Accès à la caméra</T>
|
||||||
<T v="muted" style={{ textAlign: 'center' }}>La caméra sert uniquement à lire le QR code de la carte de fidélité du client.</T>
|
<T v="muted" style={{ textAlign: 'center' }}>La caméra sert uniquement à lire le QR code de la carte de fidélité du client.</T>
|
||||||
|
|
@ -221,7 +222,7 @@ export default function Scan() {
|
||||||
{/* Barre du haut : fermer + consigne */}
|
{/* Barre du haut : fermer + consigne */}
|
||||||
<View style={{ gap: 18 }}>
|
<View style={{ gap: 18 }}>
|
||||||
<Pressable accessibilityRole="button" accessibilityLabel="Fermer" onPress={() => router.back()} style={styles.round} hitSlop={8}>
|
<Pressable accessibilityRole="button" accessibilityLabel="Fermer" onPress={() => router.back()} style={styles.round} hitSlop={8}>
|
||||||
<T style={{ color: '#fff', fontSize: 22, lineHeight: 24 }}>✕</T>
|
<Icon name="close" size={22} color="#FFFFFF" />
|
||||||
</Pressable>
|
</Pressable>
|
||||||
<View style={{ alignItems: 'center', gap: 4 }}>
|
<View style={{ alignItems: 'center', gap: 4 }}>
|
||||||
<T style={{ color: '#fff', fontFamily: font.bold, fontSize: 22, textAlign: 'center' }}>Scannez la carte du client</T>
|
<T style={{ color: '#fff', fontFamily: font.bold, fontSize: 22, textAlign: 'center' }}>Scannez la carte du client</T>
|
||||||
|
|
@ -242,7 +243,7 @@ export default function Scan() {
|
||||||
onPress={() => setTorch((t) => !t)}
|
onPress={() => setTorch((t) => !t)}
|
||||||
style={[styles.round, { width: 64, height: 64, borderRadius: 32 }, torch && { backgroundColor: '#F2B544' }]}
|
style={[styles.round, { width: 64, height: 64, borderRadius: 32 }, torch && { backgroundColor: '#F2B544' }]}
|
||||||
>
|
>
|
||||||
<T style={{ fontSize: 26 }}>🔦</T>
|
<Icon name="flashlight" size={26} color={torch ? '#1C1C19' : '#FFFFFF'} />
|
||||||
</Pressable>
|
</Pressable>
|
||||||
<T style={{ color: 'rgba(255,255,255,0.8)', fontSize: 13 }}>{torch ? 'Lampe allumée' : 'Lampe'}</T>
|
<T style={{ color: 'rgba(255,255,255,0.8)', fontSize: 13 }}>{torch ? 'Lampe allumée' : 'Lampe'}</T>
|
||||||
<Pressable accessibilityRole="button" onPress={() => setManual(true)} hitSlop={10} style={{ paddingVertical: 8, paddingHorizontal: 16, borderRadius: 999, backgroundColor: 'rgba(255,255,255,0.2)' }}>
|
<Pressable accessibilityRole="button" onPress={() => setManual(true)} hitSlop={10} style={{ paddingVertical: 8, paddingHorizontal: 16, borderRadius: 999, backgroundColor: 'rgba(255,255,255,0.2)' }}>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { api, ApiError } from '../src/api';
|
||||||
import { describe } from '../src/errors';
|
import { describe } from '../src/errors';
|
||||||
import { Banner, Card, T } from '../src/ui';
|
import { Banner, Card, T } from '../src/ui';
|
||||||
import { font, useColors } from '../src/theme';
|
import { font, useColors } from '../src/theme';
|
||||||
|
import { Icon, IconName } from '../src/icons';
|
||||||
|
|
||||||
interface Stats {
|
interface Stats {
|
||||||
pointsMode: 'AMOUNT' | 'STAMP';
|
pointsMode: 'AMOUNT' | 'STAMP';
|
||||||
|
|
@ -78,21 +79,20 @@ export default function StatsScreen() {
|
||||||
const k = data?.kpis;
|
const k = data?.kpis;
|
||||||
const max = Math.max(1, ...(data?.series.map((s) => s.visits) ?? [1]));
|
const max = Math.max(1, ...(data?.series.map((s) => s.visits) ?? [1]));
|
||||||
// Le passage est mis en avant ; les autres indicateurs en tuiles.
|
// Le passage est mis en avant ; les autres indicateurs en tuiles.
|
||||||
const tiles: [string, string, string, string?][] = k
|
const tiles: [IconName, string, string, string?][] = k
|
||||||
? [
|
? [
|
||||||
['🆕', 'Nouvelles cartes', String(k.newCards), `${k.cardsTotal} au total`],
|
['sparkle', 'Nouvelles cartes', String(k.newCards), `${k.cardsTotal} au total`],
|
||||||
['👥', 'Clients actifs', String(k.activeCustomers), `${k.visitsPerCustomer} passage(s) / client`],
|
['users', 'Clients actifs', String(k.activeCustomers), `${k.visitsPerCustomer} passage(s) / client`],
|
||||||
['🔁', 'Clients fidèles', k.returningRate === null ? '—' : `${k.returningRate} %`, 'venus 2 fois ou plus'],
|
['repeat', 'Clients fidèles', k.returningRate === null ? '—' : `${k.returningRate} %`, 'venus 2 fois ou plus'],
|
||||||
['🎁', 'Récompenses', String(k.rewardsRedeemed), 'utilisées'],
|
['gift', 'Récompenses', String(k.rewardsRedeemed), 'utilisées'],
|
||||||
...(data!.pointsMode === 'AMOUNT'
|
...(data!.pointsMode === 'AMOUNT'
|
||||||
? ([
|
? ([
|
||||||
['💶', 'Achats', euros(k.revenueCents), k.averageBasketCents === null ? '' : `panier moyen ${euros(k.averageBasketCents)}`],
|
['euro', 'Achats', euros(k.revenueCents), k.averageBasketCents === null ? '' : `panier moyen ${euros(k.averageBasketCents)}`],
|
||||||
] as [string, string, string, string][])
|
] as [IconName, string, string, string][])
|
||||||
: []),
|
: []),
|
||||||
]
|
]
|
||||||
: [];
|
: [];
|
||||||
const trend = k?.visitsChange ?? null;
|
const trend = k?.visitsChange ?? null;
|
||||||
const MEDAL = ['🥇', '🥈', '🥉'];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollView contentContainerStyle={{ padding: 20, gap: 18 }} bounces={false} overScrollMode="never">
|
<ScrollView contentContainerStyle={{ padding: 20, gap: 18 }} bounces={false} overScrollMode="never">
|
||||||
|
|
@ -148,7 +148,7 @@ export default function StatsScreen() {
|
||||||
</View>
|
</View>
|
||||||
{data.busiest && (
|
{data.busiest && (
|
||||||
<T style={{ color: c.onPrimary, fontSize: 14 }}>
|
<T style={{ color: c.onPrimary, fontSize: 14 }}>
|
||||||
⏱ Créneau le plus fréquenté : <T style={{ color: c.onPrimary, fontFamily: font.bold, fontSize: 14 }}>{data.busiest}</T>
|
Créneau le plus fréquenté : <T style={{ color: c.onPrimary, fontFamily: font.bold, fontSize: 14 }}>{data.busiest}</T>
|
||||||
</T>
|
</T>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
@ -157,7 +157,7 @@ export default function StatsScreen() {
|
||||||
{tiles.map(([icon, label, value, hint]) => (
|
{tiles.map(([icon, label, value, hint]) => (
|
||||||
<Card key={label} style={{ width: '47%', flexGrow: 1, padding: 14, gap: 4 }}>
|
<Card key={label} style={{ width: '47%', flexGrow: 1, padding: 14, gap: 4 }}>
|
||||||
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>
|
||||||
<T style={{ fontSize: 16 }}>{icon}</T>
|
<Icon name={icon} size={16} color={c.primary} />
|
||||||
<T v="muted" style={{ fontSize: 13 }} numberOfLines={1}>{label}</T>
|
<T v="muted" style={{ fontSize: 13 }} numberOfLines={1}>{label}</T>
|
||||||
</View>
|
</View>
|
||||||
<T style={{ fontFamily: font.extrabold, fontSize: 26 }}>{value}</T>
|
<T style={{ fontFamily: font.extrabold, fontSize: 26 }}>{value}</T>
|
||||||
|
|
@ -172,7 +172,7 @@ export default function StatsScreen() {
|
||||||
{data.top.slice(0, 5).map((t, i) => (
|
{data.top.slice(0, 5).map((t, i) => (
|
||||||
<View key={i} style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>
|
<View key={i} style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>
|
||||||
<View style={{ width: 36, height: 36, borderRadius: 18, backgroundColor: i < 3 ? c.warnBg : c.surface2, alignItems: 'center', justifyContent: 'center' }}>
|
<View style={{ width: 36, height: 36, borderRadius: 18, backgroundColor: i < 3 ? c.warnBg : c.surface2, alignItems: 'center', justifyContent: 'center' }}>
|
||||||
<T style={{ fontSize: i < 3 ? 18 : 14, fontFamily: font.bold, color: c.text3 }}>{MEDAL[i] ?? i + 1}</T>
|
<T style={{ fontSize: i < 3 ? 18 : 14, fontFamily: font.bold, color: c.text3 }}>{i + 1}</T>
|
||||||
</View>
|
</View>
|
||||||
<T v="label" style={{ flex: 1 }} numberOfLines={1}>{t.firstName}</T>
|
<T v="label" style={{ flex: 1 }} numberOfLines={1}>{t.firstName}</T>
|
||||||
<T v="muted" style={{ fontSize: 14 }}>
|
<T v="muted" style={{ fontSize: 14 }}>
|
||||||
|
|
@ -189,14 +189,14 @@ export default function StatsScreen() {
|
||||||
<T v="muted" style={{ fontSize: 14 }}>Fichier CSV (ouvrable avec Excel), envoyé uniquement par e-mail au dirigeant de la société.</T>
|
<T v="muted" style={{ fontSize: 14 }}>Fichier CSV (ouvrable avec Excel), envoyé uniquement par e-mail au dirigeant de la société.</T>
|
||||||
{(
|
{(
|
||||||
[
|
[
|
||||||
['customers', '📇', 'Fichier clients', 'Tous les clients et leur solde'],
|
['customers', 'idCard', 'Fichier clients', 'Tous les clients et leur solde'],
|
||||||
['transactions', '🧾', 'Opérations de la période', `Les ${PERIODS.find(([d]) => d === days)?.[1]} sélectionnés`],
|
['transactions', 'receipt', 'Opérations de la période', `Les ${PERIODS.find(([d]) => d === days)?.[1]} sélectionnés`],
|
||||||
] as const
|
] as const
|
||||||
).map(([kind, icon, title, sub]) => (
|
).map(([kind, icon, title, sub]) => (
|
||||||
<Pressable key={kind} accessibilityRole="button" disabled={!!sending} onPress={() => exportCsv(kind)}>
|
<Pressable key={kind} accessibilityRole="button" disabled={!!sending} onPress={() => exportCsv(kind)}>
|
||||||
{({ pressed }) => (
|
{({ pressed }) => (
|
||||||
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 12, padding: 12, borderRadius: 14, backgroundColor: pressed ? c.primarySoft : c.surface2 }}>
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 12, padding: 12, borderRadius: 14, backgroundColor: pressed ? c.primarySoft : c.surface2 }}>
|
||||||
<T style={{ fontSize: 22 }}>{icon}</T>
|
<Icon name={icon} size={22} color={c.primary} />
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<T v="label">{title}</T>
|
<T v="label">{title}</T>
|
||||||
<T v="muted" style={{ fontSize: 13 }}>{sub}</T>
|
<T v="muted" style={{ fontSize: 13 }}>{sub}</T>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { describe } from '../src/errors';
|
||||||
import { useSession } from '../src/session';
|
import { useSession } from '../src/session';
|
||||||
import { Banner, Button, Card, T } from '../src/ui';
|
import { Banner, Button, Card, T } from '../src/ui';
|
||||||
import { font, useColors } from '../src/theme';
|
import { font, useColors } from '../src/theme';
|
||||||
|
import { Icon } from '../src/icons';
|
||||||
|
|
||||||
type Role = 'MANAGER' | 'EMPLOYEE';
|
type Role = 'MANAGER' | 'EMPLOYEE';
|
||||||
interface Member {
|
interface Member {
|
||||||
|
|
@ -115,7 +116,7 @@ export default function Team() {
|
||||||
{/* Identifiants à transmettre (création ou nouveau mot de passe) */}
|
{/* Identifiants à transmettre (création ou nouveau mot de passe) */}
|
||||||
{created?.provisionalPassword && (
|
{created?.provisionalPassword && (
|
||||||
<View style={{ backgroundColor: c.okBg, borderRadius: 20, padding: 18, gap: 10 }}>
|
<View style={{ backgroundColor: c.okBg, borderRadius: 20, padding: 18, gap: 10 }}>
|
||||||
<T v="label" style={{ color: c.ok }}>✓ Identifiants de {created.displayName}</T>
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}><Icon name="checkCircle" size={18} color={c.ok} /><T v="label" style={{ color: c.ok }}>Identifiants de {created.displayName}</T></View>
|
||||||
<View style={{ backgroundColor: c.surface, borderRadius: 14, padding: 14, gap: 4 }}>
|
<View style={{ backgroundColor: c.surface, borderRadius: 14, padding: 14, gap: 4 }}>
|
||||||
<T v="muted" style={{ fontSize: 13 }}>Identifiant</T>
|
<T v="muted" style={{ fontSize: 13 }}>Identifiant</T>
|
||||||
<T v="label" selectable>{created.email}</T>
|
<T v="label" selectable>{created.email}</T>
|
||||||
|
|
|
||||||
|
|
@ -7,18 +7,21 @@
|
||||||
"base": {
|
"base": {
|
||||||
"env": {
|
"env": {
|
||||||
"EXPO_PUBLIC_API_URL": "https://api.monespacepro.eu"
|
"EXPO_PUBLIC_API_URL": "https://api.monespacepro.eu"
|
||||||
}
|
},
|
||||||
|
"channel": "base"
|
||||||
},
|
},
|
||||||
"preview": {
|
"preview": {
|
||||||
"extends": "base",
|
"extends": "base",
|
||||||
"distribution": "internal",
|
"distribution": "internal",
|
||||||
"android": {
|
"android": {
|
||||||
"buildType": "apk"
|
"buildType": "apk"
|
||||||
}
|
},
|
||||||
|
"channel": "preview"
|
||||||
},
|
},
|
||||||
"production": {
|
"production": {
|
||||||
"extends": "base",
|
"extends": "base",
|
||||||
"autoIncrement": true
|
"autoIncrement": true,
|
||||||
|
"channel": "production"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"submit": {
|
"submit": {
|
||||||
|
|
|
||||||
83
pro/package-lock.json
generated
83
pro/package-lock.json
generated
|
|
@ -20,6 +20,7 @@
|
||||||
"expo-splash-screen": "~57.0.9",
|
"expo-splash-screen": "~57.0.9",
|
||||||
"expo-status-bar": "~57.0.1",
|
"expo-status-bar": "~57.0.1",
|
||||||
"expo-system-ui": "~57.0.4",
|
"expo-system-ui": "~57.0.4",
|
||||||
|
"expo-updates": "~57.0.25",
|
||||||
"react": "19.2.3",
|
"react": "19.2.3",
|
||||||
"react-dom": "19.2.3",
|
"react-dom": "19.2.3",
|
||||||
"react-native": "0.86.3",
|
"react-native": "0.86.3",
|
||||||
|
|
@ -4385,6 +4386,12 @@
|
||||||
"react-native": "*"
|
"react-native": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/expo-eas-client": {
|
||||||
|
"version": "57.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/expo-eas-client/-/expo-eas-client-57.0.5.tgz",
|
||||||
|
"integrity": "sha512-7Ut6TbaYZDURHZkhKRGZdLgq4EE7sHc6VrKAcU0Pzj1Bd+Nsb/XseViYuch2+X/+RvQMlzu8Eyf4YvBVpDCivQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/expo-file-system": {
|
"node_modules/expo-file-system": {
|
||||||
"version": "57.0.7",
|
"version": "57.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/expo-file-system/-/expo-file-system-57.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/expo-file-system/-/expo-file-system-57.0.7.tgz",
|
||||||
|
|
@ -4429,6 +4436,12 @@
|
||||||
"expo": "*"
|
"expo": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/expo-json-utils": {
|
||||||
|
"version": "57.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/expo-json-utils/-/expo-json-utils-57.0.2.tgz",
|
||||||
|
"integrity": "sha512-9kYZECLKE3pYZQs+kt3+ggY83Lfryog9/UEo3HJKGcHUZeKKtlFBIPFjI4LzREubsvjP7AsvG0FdEX9EquIoAQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/expo-keep-awake": {
|
"node_modules/expo-keep-awake": {
|
||||||
"version": "57.0.2",
|
"version": "57.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/expo-keep-awake/-/expo-keep-awake-57.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/expo-keep-awake/-/expo-keep-awake-57.0.2.tgz",
|
||||||
|
|
@ -4453,6 +4466,18 @@
|
||||||
"react-native": "*"
|
"react-native": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/expo-manifests": {
|
||||||
|
"version": "57.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/expo-manifests/-/expo-manifests-57.0.2.tgz",
|
||||||
|
"integrity": "sha512-pPIIcKR73OShwlWMg8H90WRzKUd2krDdKlKAwuQV1FtUwE7H3hQEFw0ePFQY9yFoGMF/77ryYwNKfI5umMcCog==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"expo-json-utils": "~57.0.2"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"expo": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/expo-modules-autolinking": {
|
"node_modules/expo-modules-autolinking": {
|
||||||
"version": "57.0.14",
|
"version": "57.0.14",
|
||||||
"resolved": "https://registry.npmjs.org/expo-modules-autolinking/-/expo-modules-autolinking-57.0.14.tgz",
|
"resolved": "https://registry.npmjs.org/expo-modules-autolinking/-/expo-modules-autolinking-57.0.14.tgz",
|
||||||
|
|
@ -4649,6 +4674,12 @@
|
||||||
"react-native": "*"
|
"react-native": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/expo-structured-headers": {
|
||||||
|
"version": "57.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/expo-structured-headers/-/expo-structured-headers-57.0.1.tgz",
|
||||||
|
"integrity": "sha512-5VwmitVr2J716pOuHXWmEnHbZhZg63DBOZKH5tj0SR8Sps/3jSAf9wf9+UGTKcKgAxGf1PPwQ0lAQ2bG3RwjAg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/expo-symbols": {
|
"node_modules/expo-symbols": {
|
||||||
"version": "57.0.3",
|
"version": "57.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/expo-symbols/-/expo-symbols-57.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/expo-symbols/-/expo-symbols-57.0.3.tgz",
|
||||||
|
|
@ -4685,6 +4716,58 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/expo-updates": {
|
||||||
|
"version": "57.0.25",
|
||||||
|
"resolved": "https://registry.npmjs.org/expo-updates/-/expo-updates-57.0.25.tgz",
|
||||||
|
"integrity": "sha512-rLXR7Oi3X//qMvYbNUzT9cQYEdhxkJZYmhA36kgvjlPvZkKCPTP89uBe9lUQ9aoYx0Z/M/qHHJZldhf9Jm7qJA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@expo/code-signing-certificates": "^0.0.6",
|
||||||
|
"@expo/plist": "^0.8.1",
|
||||||
|
"@expo/spawn-async": "^1.8.0",
|
||||||
|
"arg": "^4.1.0",
|
||||||
|
"chalk": "^4.1.2",
|
||||||
|
"debug": "^4.3.4",
|
||||||
|
"expo-eas-client": "~57.0.5",
|
||||||
|
"expo-manifests": "~57.0.2",
|
||||||
|
"expo-structured-headers": "~57.0.1",
|
||||||
|
"expo-updates-interface": "~57.0.2",
|
||||||
|
"getenv": "^2.0.0",
|
||||||
|
"glob": "^13.0.0",
|
||||||
|
"ignore": "^5.3.1",
|
||||||
|
"nullthrows": "^1.1.1",
|
||||||
|
"resolve-from": "^5.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"expo-updates": "bin/cli.js"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"expo": "*",
|
||||||
|
"expo-dev-client": "*",
|
||||||
|
"react": "*",
|
||||||
|
"react-native": "*"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"expo-dev-client": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/expo-updates-interface": {
|
||||||
|
"version": "57.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/expo-updates-interface/-/expo-updates-interface-57.0.2.tgz",
|
||||||
|
"integrity": "sha512-x3SA5toiHZEkW+5oeNdUM1Rvt6M3ExegQsSwS3Z1+S9gn9utGYTGBkb8MBQivhjIZiRlQYDIhauxA8kySQEWtQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"expo": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/expo-updates/node_modules/arg": {
|
||||||
|
"version": "4.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||||
|
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/exponential-backoff": {
|
"node_modules/exponential-backoff": {
|
||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.3.tgz",
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
"expo-splash-screen": "~57.0.9",
|
"expo-splash-screen": "~57.0.9",
|
||||||
"expo-status-bar": "~57.0.1",
|
"expo-status-bar": "~57.0.1",
|
||||||
"expo-system-ui": "~57.0.4",
|
"expo-system-ui": "~57.0.4",
|
||||||
|
"expo-updates": "~57.0.25",
|
||||||
"react": "19.2.3",
|
"react": "19.2.3",
|
||||||
"react-dom": "19.2.3",
|
"react-dom": "19.2.3",
|
||||||
"react-native": "0.86.3",
|
"react-native": "0.86.3",
|
||||||
|
|
|
||||||
91
pro/src/UpdateGate.tsx
Normal file
91
pro/src/UpdateGate.tsx
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
import { ReactNode, useEffect, useState } from 'react';
|
||||||
|
import { StyleSheet, View } from 'react-native';
|
||||||
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||||
|
import * as Updates from 'expo-updates';
|
||||||
|
import { Icon } from './icons';
|
||||||
|
import { BrandSymbol, Button, T } from './ui';
|
||||||
|
import { font, useColors } from './theme';
|
||||||
|
|
||||||
|
type Phase = 'idle' | 'downloading' | 'ready';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mises à jour à distance (EAS Update) : au lancement, si une nouvelle version existe, elle est téléchargée
|
||||||
|
* avec une barre de progression, puis l'app demande à être relancée pour l'appliquer.
|
||||||
|
* Sans mise à jour, en développement ou en cas d'erreur réseau : rien ne s'affiche, l'app démarre normalement.
|
||||||
|
*/
|
||||||
|
export function UpdateGate({ children }: { children: ReactNode }) {
|
||||||
|
const c = useColors();
|
||||||
|
const { downloadProgress } = Updates.useUpdates();
|
||||||
|
const [phase, setPhase] = useState<Phase>('idle');
|
||||||
|
const [restarting, setRestarting] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (__DEV__ || !Updates.isEnabled) return;
|
||||||
|
let cancelled = false;
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
const check = await Updates.checkForUpdateAsync();
|
||||||
|
if (cancelled || !check.isAvailable) return;
|
||||||
|
setPhase('downloading');
|
||||||
|
const result = await Updates.fetchUpdateAsync();
|
||||||
|
if (!cancelled) setPhase(result.isNew ? 'ready' : 'idle');
|
||||||
|
} catch {
|
||||||
|
// Pas de réseau ou serveur indisponible : l'app continue avec la version installée.
|
||||||
|
if (!cancelled) setPhase('idle');
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
return () => {
|
||||||
|
cancelled = true;
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
async function restart() {
|
||||||
|
setRestarting(true);
|
||||||
|
try {
|
||||||
|
await Updates.reloadAsync();
|
||||||
|
} catch {
|
||||||
|
setRestarting(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const percent = Math.max(0, Math.min(100, Math.round((downloadProgress ?? 0) * 100)));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
{children}
|
||||||
|
{phase !== 'idle' && (
|
||||||
|
<View style={[StyleSheet.absoluteFill, { backgroundColor: c.bg }]} accessibilityViewIsModal>
|
||||||
|
<SafeAreaView style={{ flex: 1, padding: 28, justifyContent: 'center', gap: 28 }}>
|
||||||
|
<View style={{ alignItems: 'center', gap: 16 }}>
|
||||||
|
<View style={{ width: 96, height: 96, borderRadius: 28, backgroundColor: c.primarySoft, alignItems: 'center', justifyContent: 'center' }}>
|
||||||
|
{phase === 'ready' ? <Icon name="checkCircle" size={52} color={c.primary} /> : <BrandSymbol size={60} />}
|
||||||
|
</View>
|
||||||
|
<T v="h1" accessibilityRole="header" style={{ textAlign: 'center' }}>
|
||||||
|
{phase === 'ready' ? 'Mise à jour installée' : 'Mise à jour en cours'}
|
||||||
|
</T>
|
||||||
|
<T v="muted" style={{ textAlign: 'center' }}>
|
||||||
|
{phase === 'ready'
|
||||||
|
? 'Une nouvelle version de MonEspacePro a été installée. Relancez l’application pour l’utiliser.'
|
||||||
|
: 'Une nouvelle version de MonEspacePro est disponible. Ne fermez pas l’application pendant le téléchargement.'}
|
||||||
|
</T>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{phase === 'downloading' ? (
|
||||||
|
<View style={{ gap: 10 }} accessibilityRole="progressbar" accessibilityValue={{ min: 0, max: 100, now: percent, text: `${percent} %` }}>
|
||||||
|
<View style={{ height: 14, borderRadius: 7, backgroundColor: c.surface2, overflow: 'hidden' }}>
|
||||||
|
<View style={{ width: `${percent}%`, height: '100%', borderRadius: 7, backgroundColor: c.primary }} />
|
||||||
|
</View>
|
||||||
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
||||||
|
<T v="muted" style={{ fontSize: 14 }}>Téléchargement…</T>
|
||||||
|
<T style={{ fontFamily: font.bold, fontSize: 14, color: c.primary }}>{percent} %</T>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
) : (
|
||||||
|
<Button large label="Relancer l’application" onPress={restart} loading={restarting} />
|
||||||
|
)}
|
||||||
|
</SafeAreaView>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ import { router } from 'expo-router';
|
||||||
import { ApiError } from './api';
|
import { ApiError } from './api';
|
||||||
import { Button, Screen, T, euros } from './ui';
|
import { Button, Screen, T, euros } from './ui';
|
||||||
import { font, useColors } from './theme';
|
import { font, useColors } from './theme';
|
||||||
|
import { Icon, IconName } from './icons';
|
||||||
|
|
||||||
function minutes(sec: number) {
|
function minutes(sec: number) {
|
||||||
const m = Math.ceil(sec / 60);
|
const m = Math.ceil(sec / 60);
|
||||||
|
|
@ -13,7 +14,7 @@ export interface ErrorInfo {
|
||||||
title: string;
|
title: string;
|
||||||
detail: string;
|
detail: string;
|
||||||
/** Pictogramme de l'écran d'erreur. */
|
/** Pictogramme de l'écran d'erreur. */
|
||||||
icon: string;
|
icon: IconName;
|
||||||
/** Refus de l'anti-triche : la tentative est enregistrée dans l'historique. */
|
/** Refus de l'anti-triche : la tentative est enregistrée dans l'historique. */
|
||||||
logged?: boolean;
|
logged?: boolean;
|
||||||
/** Attendre ou réessayer peut suffire. */
|
/** Attendre ou réessayer peut suffire. */
|
||||||
|
|
@ -22,38 +23,38 @@ export interface ErrorInfo {
|
||||||
|
|
||||||
/** Message, conseil et pictogramme pour chaque erreur (maquettes 8a/8b/8c). */
|
/** Message, conseil et pictogramme pour chaque erreur (maquettes 8a/8b/8c). */
|
||||||
export function describe(e: unknown): ErrorInfo {
|
export function describe(e: unknown): ErrorInfo {
|
||||||
if (!(e instanceof ApiError)) return { title: 'Erreur inattendue', detail: 'Quelque chose s’est mal passé. Réessayez dans un instant.', icon: '⚠️', retryable: true };
|
if (!(e instanceof ApiError)) return { title: 'Erreur inattendue', detail: 'Quelque chose s’est mal passé. Réessayez dans un instant.', icon: 'alert', retryable: true };
|
||||||
const d = e.data as Record<string, number>;
|
const d = e.data as Record<string, number>;
|
||||||
switch (e.code) {
|
switch (e.code) {
|
||||||
case 'NETWORK':
|
case 'NETWORK':
|
||||||
return { title: 'Pas de connexion', detail: 'Le téléphone n’arrive pas à joindre MonEspacePro. Vérifiez le Wi-Fi ou les données mobiles, puis réessayez.', icon: '📶', retryable: true };
|
return { title: 'Pas de connexion', detail: 'Le téléphone n’arrive pas à joindre MonEspacePro. Vérifiez le Wi-Fi ou les données mobiles, puis réessayez.', icon: 'wifiOff', retryable: true };
|
||||||
case 'AMOUNT_OVER_LIMIT':
|
case 'AMOUNT_OVER_LIMIT':
|
||||||
return {
|
return {
|
||||||
title: `Montant supérieur au plafond (${euros(d.maxAmountCents)})`,
|
title: `Montant supérieur au plafond (${euros(d.maxAmountCents)})`,
|
||||||
detail: 'Vérifiez le montant saisi. Pour une commande exceptionnelle, contactez votre dirigeant.',
|
detail: 'Vérifiez le montant saisi. Pour une commande exceptionnelle, contactez votre dirigeant.',
|
||||||
icon: '💶',
|
icon: 'euro',
|
||||||
logged: true,
|
logged: true,
|
||||||
};
|
};
|
||||||
case 'TOO_SOON':
|
case 'TOO_SOON':
|
||||||
return {
|
return {
|
||||||
title: `Carte déjà créditée il y a ${minutes(d.elapsedSec || 60)}`,
|
title: `Carte déjà créditée il y a ${minutes(d.elapsedSec || 60)}`,
|
||||||
detail: `Réessayez dans ${minutes(d.retryAfterSec)}. Ce délai évite les doubles crédits.`,
|
detail: `Réessayez dans ${minutes(d.retryAfterSec)}. Ce délai évite les doubles crédits.`,
|
||||||
icon: '⏱️',
|
icon: 'timer',
|
||||||
logged: true,
|
logged: true,
|
||||||
};
|
};
|
||||||
case 'OTHER_STORE':
|
case 'OTHER_STORE':
|
||||||
return { title: 'Carte d’un autre magasin', detail: 'Ce client n’est pas inscrit au programme de votre magasin. Il peut s’inscrire avec le QR code du comptoir.', icon: '🏪' };
|
return { title: 'Carte d’un autre magasin', detail: 'Ce client n’est pas inscrit au programme de votre magasin. Il peut s’inscrire avec le QR code du comptoir.', icon: 'store' };
|
||||||
case 'UNKNOWN_CARD':
|
case 'UNKNOWN_CARD':
|
||||||
return { title: 'Carte inconnue', detail: 'Cette carte n’existe plus (supprimée par le client ?). Il peut se réinscrire avec le QR code du comptoir.', icon: '🔍' };
|
return { title: 'Carte inconnue', detail: 'Cette carte n’existe plus (supprimée par le client ?). Il peut se réinscrire avec le QR code du comptoir.', icon: 'search' };
|
||||||
case 'INSUFFICIENT_BALANCE':
|
case 'INSUFFICIENT_BALANCE':
|
||||||
return { title: 'Solde insuffisant', detail: `Il manque ${d.missing} pour cette récompense.`, icon: '🎁', logged: true };
|
return { title: 'Solde insuffisant', detail: `Il manque ${d.missing} pour cette récompense.`, icon: 'gift', logged: true };
|
||||||
case 'PLAN_REQUIRED':
|
case 'PLAN_REQUIRED':
|
||||||
case 'MODULE_DISABLED':
|
case 'MODULE_DISABLED':
|
||||||
return { title: 'Fonction non disponible', detail: e.message, icon: '🔒' };
|
return { title: 'Fonction non disponible', detail: e.message, icon: 'lock' };
|
||||||
default:
|
default:
|
||||||
if (e.status === 403) return { title: 'Accès réservé', detail: 'Cette action est réservée au Dirigeant du magasin.', icon: '🔒' };
|
if (e.status === 403) return { title: 'Accès réservé', detail: 'Cette action est réservée au Dirigeant du magasin.', icon: 'lock' };
|
||||||
if (e.status >= 500) return { title: 'Service momentanément indisponible', detail: 'MonEspacePro ne répond pas pour le moment. Réessayez dans quelques instants.', icon: '🛠️', retryable: true };
|
if (e.status >= 500) return { title: 'Service momentanément indisponible', detail: 'MonEspacePro ne répond pas pour le moment. Réessayez dans quelques instants.', icon: 'tool', retryable: true };
|
||||||
return { title: 'Opération impossible', detail: e.message, icon: '⚠️' };
|
return { title: 'Opération impossible', detail: e.message, icon: 'alert' };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,7 +67,7 @@ export function ErrorScreen({ error, onRetry }: { error: unknown; onRetry?: () =
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<View style={{ alignItems: 'center', gap: 14 }}>
|
<View style={{ alignItems: 'center', gap: 14 }}>
|
||||||
<View style={{ width: 112, height: 112, borderRadius: 56, backgroundColor: c.errBg, alignItems: 'center', justifyContent: 'center' }}>
|
<View style={{ width: 112, height: 112, borderRadius: 56, backgroundColor: c.errBg, alignItems: 'center', justifyContent: 'center' }}>
|
||||||
<T style={{ fontSize: 48, lineHeight: 56 }} accessibilityElementsHidden>{icon}</T>
|
<Icon name={icon} size={52} color={c.err} />
|
||||||
</View>
|
</View>
|
||||||
<T v="h1" accessibilityRole="alert" style={{ textAlign: 'center' }}>{title}</T>
|
<T v="h1" accessibilityRole="alert" style={{ textAlign: 'center' }}>{title}</T>
|
||||||
<T v="muted" style={{ textAlign: 'center' }}>{detail}</T>
|
<T v="muted" style={{ textAlign: 'center' }}>{detail}</T>
|
||||||
|
|
|
||||||
65
pro/src/icons.tsx
Normal file
65
pro/src/icons.tsx
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
import Svg, { Circle, Path, Rect } from 'react-native-svg';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Icônes de l'app (aucun emoji) : tracés 24 × 24, trait de 2, extrémités arrondies,
|
||||||
|
* dans le style des pictogrammes du site vitrine. La couleur suit le texte autour par défaut.
|
||||||
|
*/
|
||||||
|
const ICONS = {
|
||||||
|
megaphone: <Path d="M3 10.5v3a1 1 0 0 0 1 1h2.5L12 19V5L6.5 9.5H4a1 1 0 0 0-1 1zM15.5 8.5a4.5 4.5 0 0 1 0 7M18.5 5.5a8.5 8.5 0 0 1 0 13" />,
|
||||||
|
gift: <><Rect x={3} y={8} width={18} height={4.5} rx={1} /><Path d="M5 12.5V20h14v-7.5M12 8v12M12 8c-2 0-4.5-.8-4.5-2.8S10.5 3 12 8zM12 8c2 0 4.5-.8 4.5-2.8S13.5 3 12 8z" /></>,
|
||||||
|
lock: <><Rect x={5} y={11} width={14} height={9.5} rx={2} /><Path d="M8 11V8a4 4 0 0 1 8 0v3" /></>,
|
||||||
|
star: <Path d="M12 3.2l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17.2l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z" />,
|
||||||
|
hourglass: <Path d="M6.5 3h11M6.5 21h11M7.5 3v2.5a4.5 4.5 0 0 0 9 0V3M7.5 21v-2.5a4.5 4.5 0 0 1 9 0V21" />,
|
||||||
|
check: <Path d="M5 12.5l4.5 4.5L19 7.5" />,
|
||||||
|
checkCircle: <><Circle cx={12} cy={12} r={9} /><Path d="M8.2 12.4l2.6 2.6 5-5.2" /></>,
|
||||||
|
plus: <Path d="M12 5v14M5 12h14" />,
|
||||||
|
plusCircle: <><Circle cx={12} cy={12} r={9} /><Path d="M12 8v8M8 12h8" /></>,
|
||||||
|
alert: <Path d="M12 3.5l9.5 16.5h-19zM12 10v4.5M12 17.5h.01" />,
|
||||||
|
list: <><Rect x={5.5} y={4} width={13} height={17} rx={2} /><Path d="M9 3v2h6V3M9 10h6M9 13.5h6M9 17h3.5" /></>,
|
||||||
|
palette: <><Path d="M12 3a9 9 0 1 0 0 18c1 0 1.6-.7 1.6-1.5 0-.4-.2-.8-.4-1.1-.2-.3-.4-.7-.4-1.1 0-.9.7-1.5 1.5-1.5H17a4 4 0 0 0 4-4C21 7 17 3 12 3z" /><Circle cx={7.5} cy={11.5} r={1} /><Circle cx={9.5} cy={7.5} r={1} /><Circle cx={14.5} cy={7.5} r={1} /></>,
|
||||||
|
users: <Path d="M9 11.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7zM2.5 20a6.5 6.5 0 0 1 13 0M16 4.5a3.5 3.5 0 0 1 0 7M18 14a6 6 0 0 1 3.5 6" />,
|
||||||
|
userPlus: <Path d="M9 11.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7zM2.5 20a6.5 6.5 0 0 1 13 0M19 8v6M16 11h6" />,
|
||||||
|
puzzle: <Path d="M10 4.5a2 2 0 0 1 4 0V6h4v4h-1.5a2 2 0 0 0 0 4H18v4h-4v-1.5a2 2 0 0 0-4 0V18H6v-4h1.5a2 2 0 0 0 0-4H6V6h4z" />,
|
||||||
|
receipt: <Path d="M6 3h12v18l-2-1.4-2 1.4-2-1.4-2 1.4-2-1.4L6 21zM9 8h6M9 11.5h6M9 15h3.5" />,
|
||||||
|
chart: <Path d="M4 20V11M10 20V5M16 20v-6M21 20H3" />,
|
||||||
|
history: <Path d="M3.5 12a8.5 8.5 0 1 0 2.5-6M3.5 4.5V9H8M12 7.5V12l3 2" />,
|
||||||
|
key: <><Circle cx={8} cy={15} r={4} /><Path d="M11 12l9-9M16.5 6.5l2.5 2.5M14.5 8.5l2 2" /></>,
|
||||||
|
camera: <><Path d="M4 8h3l1.8-2.6h6.4L17 8h3a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z" /><Circle cx={12} cy={13.5} r={3.5} /></>,
|
||||||
|
close: <Path d="M6 6l12 12M18 6L6 18" />,
|
||||||
|
flashlight: <Path d="M8 2.5h8v3.5l-2 4V21a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V10L8 6zM8 6h8M12 13v2.5" />,
|
||||||
|
sparkle: <Path d="M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 15.5l.7 1.8 1.8.7-1.8.7-.7 1.8-.7-1.8-1.8-.7 1.8-.7z" />,
|
||||||
|
repeat: <Path d="M17 2.5l3.5 3.5L17 9.5M3.5 11V9.5A3.5 3.5 0 0 1 7 6h13.5M7 21.5L3.5 18 7 14.5M20.5 13v1.5A3.5 3.5 0 0 1 17 18H3.5" />,
|
||||||
|
euro: <Path d="M17.5 6.6A7 7 0 1 0 17.5 17.4M4 10h9.5M4 14h9.5" />,
|
||||||
|
timer: <><Circle cx={12} cy={13.5} r={7.5} /><Path d="M12 10v3.5l2.2 1.8M9.5 2.5h5M12 2.5V6" /></>,
|
||||||
|
idCard: <><Rect x={3} y={5} width={18} height={14} rx={2} /><Circle cx={9} cy={11} r={2.2} /><Path d="M5.5 16.5a3.5 3.5 0 0 1 7 0M15 10h3.5M15 13.5h2.5" /></>,
|
||||||
|
wifiOff: <Path d="M3 3l18 18M8.5 16.4a5 5 0 0 1 6.2-.5M5 12.6a10 10 0 0 1 5-2.5M16.6 10.3A10 10 0 0 1 19 12.6M2 9a15 15 0 0 1 4.5-2.8M10.5 5.1A15 15 0 0 1 22 9M12 20h.01" />,
|
||||||
|
store: <Path d="M3 9.5L4.6 4h14.8L21 9.5M3 9.5h18v1a3 3 0 0 1-6 0 3 3 0 0 1-6 0 3 3 0 0 1-6 0zM5 13.5V21h14v-7.5M10 21v-4.5h4V21" />,
|
||||||
|
search: <><Circle cx={11} cy={11} r={6.5} /><Path d="M16 16l4.5 4.5" /></>,
|
||||||
|
tool: <Path d="M14.5 6.5a4.5 4.5 0 0 0 5.6 5.6L21.5 13.5 13.5 21.5l-1.4-1.4a4.5 4.5 0 0 0-5.6-5.6L4 17v3h3l2.5-2.5M14.5 6.5L17 4l3 3-2.5 2.5" />,
|
||||||
|
bell: <Path d="M6 16.5v-5.5a6 6 0 0 1 12 0v5.5l1.5 2h-15zM10 21h4" />,
|
||||||
|
clock: <><Circle cx={12} cy={12} r={9} /><Path d="M12 7v5l3 2" /></>,
|
||||||
|
cake: <Path d="M4 21h16M5 21v-7.5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2V21M5 15.5c1.2 1 2.4 1 3.5 0s2.3-1 3.5 0 2.3 1 3.5 0 2.3-1 3.5 0M12 11.5V8M12 4.5c.8.8.8 1.7 0 2.2-.8-.5-.8-1.4 0-2.2z" />,
|
||||||
|
tag: <><Path d="M3 11.5V4h7.5l10 10-7.5 7.5z" /><Circle cx={7.5} cy={8} r={1.3} /></>,
|
||||||
|
chevronRight: <Path d="M9 5l7 7-7 7" />,
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type IconName = keyof typeof ICONS;
|
||||||
|
|
||||||
|
export function Icon({ name, size = 22, color = '#1C1C19', strokeWidth = 2 }: { name: IconName; size?: number; color?: string; strokeWidth?: number }) {
|
||||||
|
return (
|
||||||
|
<Svg
|
||||||
|
width={size}
|
||||||
|
height={size}
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke={color}
|
||||||
|
strokeWidth={strokeWidth}
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
accessibilityElementsHidden
|
||||||
|
importantForAccessibility="no-hide-descendants"
|
||||||
|
>
|
||||||
|
{ICONS[name]}
|
||||||
|
</Svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import type { IconName } from './icons';
|
||||||
/** Modules complémentaires : définitions envoyées par l'API (backend/src/modules/catalog.ts). */
|
/** Modules complémentaires : définitions envoyées par l'API (backend/src/modules/catalog.ts). */
|
||||||
export type Value = string | number | boolean;
|
export type Value = string | number | boolean;
|
||||||
|
|
||||||
|
|
@ -20,14 +21,14 @@ export interface ModuleInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Pictogramme et teinte de chaque module (liste et en-tête des réglages). */
|
/** Pictogramme et teinte de chaque module (liste et en-tête des réglages). */
|
||||||
export const MODULE_ICON: Record<string, string> = {
|
export const MODULE_ICON: Record<string, IconName> = {
|
||||||
campaigns: '📣',
|
campaigns: 'megaphone',
|
||||||
reminders: '⏰',
|
reminders: 'clock',
|
||||||
birthday: '🎂',
|
birthday: 'cake',
|
||||||
reviews: '⭐',
|
reviews: 'star',
|
||||||
referral: '🤝',
|
referral: 'userPlus',
|
||||||
stats: '📊',
|
stats: 'chart',
|
||||||
whiteLabel: '🏷️',
|
whiteLabel: 'tag',
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Champs regroupés par section sur l'écran de réglages. */
|
/** Champs regroupés par section sur l'écran de réglages. */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue