From 88030da8bef5d9244b12ffadfbc357204f52dc3f Mon Sep 17 00:00:00 2001 From: Xor290 Date: Thu, 11 Jun 2026 23:23:29 +0200 Subject: [PATCH] chore: build --- .../src/screens/auth/AdminLoginScreen.tsx | 2 +- .../src/screens/auth/CabineLoginScreen.tsx | 2 +- .../src/screens/auth/DeliveryLoginScreen.tsx | 2 +- mobile/src/screens/auth/ClientLoginScreen.tsx | 171 +++++++-------- mobile/src/screens/client/ProfileScreen.tsx | 194 ++++++++++++++++-- 5 files changed, 263 insertions(+), 108 deletions(-) diff --git a/frontend-admin/src/screens/auth/AdminLoginScreen.tsx b/frontend-admin/src/screens/auth/AdminLoginScreen.tsx index 837fe69e..faa3bc63 100644 --- a/frontend-admin/src/screens/auth/AdminLoginScreen.tsx +++ b/frontend-admin/src/screens/auth/AdminLoginScreen.tsx @@ -60,7 +60,7 @@ export default function AdminLoginScreen() { heroTitle: { fontSize: screenWidth < 380 ? fontSize.xl : fontSize.xxl, fontWeight: "800", - color: colors.textWhite, + color: colors.textPrimary, marginTop: spacing.m, letterSpacing: 0.5, }, diff --git a/frontend-admin/src/screens/auth/CabineLoginScreen.tsx b/frontend-admin/src/screens/auth/CabineLoginScreen.tsx index dc817225..0721454c 100644 --- a/frontend-admin/src/screens/auth/CabineLoginScreen.tsx +++ b/frontend-admin/src/screens/auth/CabineLoginScreen.tsx @@ -60,7 +60,7 @@ export default function CabineLoginScreen() { heroTitle: { fontSize: screenWidth < 380 ? fontSize.xl : fontSize.xxl, fontWeight: "800", - color: colors.textWhite, + color: colors.textPrimary, marginTop: spacing.m, letterSpacing: 0.5, }, diff --git a/frontend-admin/src/screens/auth/DeliveryLoginScreen.tsx b/frontend-admin/src/screens/auth/DeliveryLoginScreen.tsx index 4f25bc9f..155274f9 100644 --- a/frontend-admin/src/screens/auth/DeliveryLoginScreen.tsx +++ b/frontend-admin/src/screens/auth/DeliveryLoginScreen.tsx @@ -60,7 +60,7 @@ export default function DeliveryLoginScreen() { heroTitle: { fontSize: screenWidth < 380 ? fontSize.xl : fontSize.xxl, fontWeight: "800", - color: colors.textWhite, + color: colors.textPrimary, marginTop: spacing.m, letterSpacing: 0.5, }, diff --git a/mobile/src/screens/auth/ClientLoginScreen.tsx b/mobile/src/screens/auth/ClientLoginScreen.tsx index 9d4baff2..020ea82b 100644 --- a/mobile/src/screens/auth/ClientLoginScreen.tsx +++ b/mobile/src/screens/auth/ClientLoginScreen.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useState, useMemo } from "react"; import { View, Text, @@ -85,9 +85,75 @@ const LoginClient = () => { if (apiError) setApiError(""); }; + const styles = useMemo( + () => + StyleSheet.create({ + container: { flex: 1, backgroundColor: colors.bgSecondary }, + scrollContent: { + flexGrow: 1, + justifyContent: "center", + alignItems: "center", + padding: 16, + }, + card: { + width: "100%", + maxWidth: 400, + borderRadius: 16, + padding: 24, + backgroundColor: colors.bgPrimary, + }, + header: { alignItems: "center", marginBottom: 24 }, + title: { + fontSize: 24, + fontWeight: "bold", + marginTop: 8, + color: colors.textPrimary, + }, + subtitle: { + fontSize: 14, + marginTop: 4, + textAlign: "center", + color: colors.textMuted, + }, + apiError: { + backgroundColor: "#fee2e2", + color: "#991b1b", + padding: 12, + borderRadius: 6, + marginBottom: 16, + textAlign: "center", + }, + inputGroup: { marginBottom: 16 }, + label: { marginBottom: 4, fontWeight: "500", color: colors.textSecondary }, + inputWrapper: { + flexDirection: "row", + alignItems: "center", + borderWidth: 1, + borderRadius: 8, + paddingHorizontal: 12, + borderColor: colors.border, + backgroundColor: colors.bgInput, + }, + icon: { marginRight: 8 }, + input: { flex: 1, height: 40, color: colors.textPrimary }, + inputError: { borderColor: "#ef4444" }, + errorText: { color: "#ef4444", fontSize: 12, marginTop: 4 }, + eyeButton: { padding: 4 }, + submitButton: { + backgroundColor: colors.accent, + borderRadius: 8, + padding: 12, + alignItems: "center", + marginTop: 8, + }, + submitText: { color: colors.white, fontWeight: "600", fontSize: 16 }, + }), + [colors], + ); + return ( { keyboardShouldPersistTaps="handled" showsVerticalScrollIndicator={false} > - + - - + + Connexion Client - + Accédez à votre espace personnel @@ -113,20 +177,10 @@ const LoginClient = () => { ) : null} - + Username Telegram - + { style={styles.icon} /> { - + Mot de passe - + { style={styles.icon} /> { disabled={isLoading} > {isLoading ? ( - + ) : ( Se connecter )} @@ -227,52 +263,3 @@ const LoginClient = () => { }; export default LoginClient; - -const styles = StyleSheet.create({ - container: { - flex: 1, - }, - scrollContent: { - flexGrow: 1, - justifyContent: "center", - alignItems: "center", - padding: 16, - }, - card: { width: "100%", maxWidth: 400, borderRadius: 16, padding: 24 }, - header: { alignItems: "center", marginBottom: 24 }, - title: { fontSize: 24, fontWeight: "bold", marginTop: 8 }, - subtitle: { fontSize: 14, marginTop: 4, textAlign: "center" }, - apiError: { - backgroundColor: "#fee2e2", - color: "#991b1b", - padding: 12, - borderRadius: 6, - marginBottom: 16, - textAlign: "center", - }, - inputGroup: { marginBottom: 16 }, - label: { marginBottom: 4, fontWeight: "500" }, - inputWrapper: { - flexDirection: "row", - alignItems: "center", - borderWidth: 1, - borderRadius: 8, - paddingHorizontal: 12, - }, - icon: { marginRight: 8 }, - input: { flex: 1, height: 40 }, - inputError: { borderColor: "#ef4444" }, - errorText: { color: "#ef4444", fontSize: 12, marginTop: 4 }, - eyeButton: { padding: 4 }, - submitButton: { - backgroundColor: "#7c3aed", - borderRadius: 8, - padding: 12, - alignItems: "center", - marginTop: 8, - }, - submitText: { color: "white", fontWeight: "600", fontSize: 16 }, - signup: { marginTop: 16, alignItems: "center" }, - signupText: {}, - signupLink: { color: "#a78bfa", fontWeight: "600" }, -}); diff --git a/mobile/src/screens/client/ProfileScreen.tsx b/mobile/src/screens/client/ProfileScreen.tsx index cde530fc..14ce2cbb 100644 --- a/mobile/src/screens/client/ProfileScreen.tsx +++ b/mobile/src/screens/client/ProfileScreen.tsx @@ -55,8 +55,17 @@ export default function ProfileScreen() { const [twoFAAdminEnabled, setTwoFAAdminEnabled] = useState(false); const [twoFALoading, setTwoFALoading] = useState(false); - // Modal confirmation infos par défaut - const [showSaveModal, setShowSaveModal] = useState(false); + // Modals confirmation sauvegarde + const [showSaveModal, setShowSaveModal] = useState(false); + const [showConfirmContactModal, setShowConfirmContactModal] = useState(false); + const [showConfirmAddressModal, setShowConfirmAddressModal] = useState(false); + + // Modal succès / erreur générique + const [showSuccessModal, setShowSuccessModal] = useState(false); + const [successTitle, setSuccessTitle] = useState(""); + const [successMsg, setSuccessMsg] = useState(""); + const [showErrorModal, setShowErrorModal] = useState(false); + const [errorMsg, setErrorMsg] = useState(""); // Modal changement de mot de passe const [showPasswordModal, setShowPasswordModal] = useState(false); @@ -117,12 +126,17 @@ export default function ProfileScreen() { AsyncStorage.setItem(STORAGE_SIGNAL, signalPseudo.trim()), ]); setShowSaveModal(false); - Alert.alert("Enregistré", "Informations par défaut sauvegardées"); + setSuccessTitle("Informations sauvegardées"); + setSuccessMsg("Téléphone et pseudo Signal seront pré-remplis lors de vos prochaines commandes."); + setShowSuccessModal(true); }; const saveAddress = async () => { + setShowConfirmAddressModal(false); await AsyncStorage.setItem(STORAGE_ADDRESS, defaultAddress.trim()); - Alert.alert("Enregistré", "Adresse par défaut sauvegardée"); + setSuccessTitle("Adresse sauvegardée"); + setSuccessMsg("Votre adresse par défaut sera pré-remplie à la prochaine commande."); + setShowSuccessModal(true); }; const handleLinkTelegram = async () => { @@ -157,15 +171,18 @@ export default function ProfileScreen() { const handleChangePassword = async () => { if (!currentPwd || !newPwd || !confirmPwd) { - Alert.alert("Erreur", "Veuillez remplir tous les champs"); + setErrorMsg("Veuillez remplir tous les champs."); + setShowErrorModal(true); return; } if (newPwd.length < 8) { - Alert.alert("Erreur", "Le nouveau mot de passe doit contenir au moins 8 caractères"); + setErrorMsg("Le nouveau mot de passe doit contenir au moins 8 caractères."); + setShowErrorModal(true); return; } if (newPwd !== confirmPwd) { - Alert.alert("Erreur", "Les nouveaux mots de passe ne correspondent pas"); + setErrorMsg("Les nouveaux mots de passe ne correspondent pas."); + setShowErrorModal(true); return; } setSavingPassword(true); @@ -174,9 +191,12 @@ export default function ProfileScreen() { if (result.success) { setShowPasswordModal(false); setCurrentPwd(""); setNewPwd(""); setConfirmPwd(""); - Alert.alert("Succès", "Mot de passe modifié avec succès"); + setSuccessTitle("Mot de passe modifié"); + setSuccessMsg("Votre mot de passe a été changé avec succès."); + setShowSuccessModal(true); } else { - Alert.alert("Erreur", result.message || "Erreur inattendue"); + setErrorMsg(result.message || "Erreur inattendue lors du changement de mot de passe."); + setShowErrorModal(true); } } finally { setSavingPassword(false); @@ -195,13 +215,17 @@ export default function ProfileScreen() { }; const saveContact = async () => { + setShowConfirmContactModal(false); setSavingContact(true); const res = await updateMyProfile({ nom: nom.trim(), prenom: prenom.trim(), telephone: telephone.trim() }); setSavingContact(false); if (res.success) { - Alert.alert("Succès", res.message ?? "Profil mis à jour"); + setSuccessTitle("Compte mis à jour"); + setSuccessMsg(res.message ?? "Vos informations de compte ont été enregistrées avec succès."); + setShowSuccessModal(true); } else { - Alert.alert("Erreur", res.message ?? "Erreur lors de la mise à jour"); + setErrorMsg(res.message ?? "Erreur lors de la mise à jour du profil."); + setShowErrorModal(true); } }; @@ -422,7 +446,7 @@ export default function ProfileScreen() { setShowConfirmContactModal(true)} disabled={savingContact} > @@ -451,7 +475,7 @@ export default function ProfileScreen() { /> setShowConfirmAddressModal(true)} > @@ -797,6 +821,150 @@ export default function ProfileScreen() { + {/* Modal confirmation — Enregistrer le compte */} + setShowConfirmContactModal(false)} + > + setShowConfirmContactModal(false)} + > + {}}> + + + + + Mettre à jour le compte ? + + Vos informations (prénom, nom, téléphone) seront enregistrées sur votre compte. + + + setShowConfirmContactModal(false)} + > + Annuler + + + Confirmer + + + + + + + + {/* Modal confirmation — Enregistrer l'adresse */} + setShowConfirmAddressModal(false)} + > + setShowConfirmAddressModal(false)} + > + {}}> + + + + + Enregistrer l'adresse ? + + Cette adresse sera pré-remplie automatiquement lors de vos prochaines commandes. + + + setShowConfirmAddressModal(false)} + > + Annuler + + + Confirmer + + + + + + + + {/* Modal succès générique */} + setShowSuccessModal(false)} + > + setShowSuccessModal(false)} + > + {}}> + + + + + {successTitle} + {successMsg} + + setShowSuccessModal(false)} + > + Fermer + + + + + + + + {/* Modal erreur générique */} + setShowErrorModal(false)} + > + setShowErrorModal(false)} + > + {}}> + + + + + Une erreur est survenue + {errorMsg} + + setShowErrorModal(false)} + > + Fermer + + + + + + + ); }