chore: build

This commit is contained in:
2026-06-12 15:44:36 +02:00
parent 0a8548033d
commit 370b1a5742
+59 -5
View File
@@ -46,9 +46,11 @@ export default function ProfilePage() {
const [twoFAAdminEnabled, setTwoFAAdminEnabled] = useState(false); const [twoFAAdminEnabled, setTwoFAAdminEnabled] = useState(false);
const [twoFALoading, setTwoFALoading] = useState(false); const [twoFALoading, setTwoFALoading] = useState(false);
// Modal confirmation infos par défaut // Modals confirmation
const [showSaveModal, setShowSaveModal] = useState(false); const [showSaveModal, setShowSaveModal] = useState(false);
const [showUnlinkModal, setShowUnlinkModal] = useState(false); const [showConfirmAddressModal, setShowConfirmAddressModal] = useState(false);
const [showConfirmContactModal, setShowConfirmContactModal] = useState(false);
const [showUnlinkModal, setShowUnlinkModal] = useState(false);
const [showUnlinkSuccessModal, setShowUnlinkSuccessModal] = useState(false); const [showUnlinkSuccessModal, setShowUnlinkSuccessModal] = useState(false);
const username = extractUsernameFromToken() ?? ''; const username = extractUsernameFromToken() ?? '';
@@ -91,6 +93,7 @@ export default function ProfilePage() {
const saveAddress = () => { const saveAddress = () => {
localStorage.setItem(STORAGE_ADDRESS, defaultAddress.trim()); localStorage.setItem(STORAGE_ADDRESS, defaultAddress.trim());
setShowConfirmAddressModal(false);
showSuccess('Adresse enregistrée', 'Votre adresse par défaut a été sauvegardée et sera pré-remplie à votre prochaine commande.'); showSuccess('Adresse enregistrée', 'Votre adresse par défaut a été sauvegardée et sera pré-remplie à votre prochaine commande.');
}; };
@@ -139,6 +142,7 @@ export default function ProfilePage() {
}; };
const saveContact = async () => { const saveContact = async () => {
setShowConfirmContactModal(false);
setSavingContact(true); setSavingContact(true);
const res = await updateMyProfile({ nom: nom.trim(), prenom: prenom.trim(), telephone: telephone.trim() }); const res = await updateMyProfile({ nom: nom.trim(), prenom: prenom.trim(), telephone: telephone.trim() });
setSavingContact(false); setSavingContact(false);
@@ -211,7 +215,7 @@ export default function ProfilePage() {
/> />
</div> </div>
</div> </div>
<button className="profile-btn" onClick={saveContact} disabled={savingContact}> <button className="profile-btn" onClick={() => setShowConfirmContactModal(true)} disabled={savingContact}>
<FontAwesomeIcon icon={faSave} /> <FontAwesomeIcon icon={faSave} />
{savingContact ? ' Enregistrement...' : ' Enregistrer le compte'} {savingContact ? ' Enregistrement...' : ' Enregistrer le compte'}
</button> </button>
@@ -238,7 +242,7 @@ export default function ProfilePage() {
placeholder="Numéro, rue, ville, code postal" placeholder="Numéro, rue, ville, code postal"
/> />
</div> </div>
<button className="profile-btn profile-btn--secondary" onClick={saveAddress} style={{ marginTop: '0.8rem' }}> <button className="profile-btn profile-btn--secondary" onClick={() => setShowConfirmAddressModal(true)} style={{ marginTop: '0.8rem' }}>
<FontAwesomeIcon icon={faSave} /> Enregistrer l'adresse <FontAwesomeIcon icon={faSave} /> Enregistrer l'adresse
</button> </button>
</div> </div>
@@ -367,6 +371,56 @@ export default function ProfilePage() {
</div> </div>
)} )}
{showConfirmAddressModal && (
<div className="profile-modal-overlay" onClick={() => setShowConfirmAddressModal(false)}>
<div className="profile-modal" onClick={(e) => e.stopPropagation()}>
<button className="profile-modal-close" onClick={() => setShowConfirmAddressModal(false)}>
<FontAwesomeIcon icon={faTimes} />
</button>
<div className="profile-modal-icon">
<FontAwesomeIcon icon={faMapMarkerAlt} />
</div>
<h3 className="profile-modal-title">Enregistrer l'adresse ?</h3>
<p className="profile-modal-body">
Cette adresse sera sauvegardée localement et pré-remplie lors de vos prochaines commandes.
</p>
<div className="profile-modal-actions">
<button className="profile-modal-btn profile-modal-btn--cancel" onClick={() => setShowConfirmAddressModal(false)}>
Annuler
</button>
<button className="profile-modal-btn profile-modal-btn--confirm" onClick={saveAddress}>
<FontAwesomeIcon icon={faCheckCircle} /> Confirmer
</button>
</div>
</div>
</div>
)}
{showConfirmContactModal && (
<div className="profile-modal-overlay" onClick={() => setShowConfirmContactModal(false)}>
<div className="profile-modal" onClick={(e) => e.stopPropagation()}>
<button className="profile-modal-close" onClick={() => setShowConfirmContactModal(false)}>
<FontAwesomeIcon icon={faTimes} />
</button>
<div className="profile-modal-icon">
<FontAwesomeIcon icon={faUser} />
</div>
<h3 className="profile-modal-title">Enregistrer le compte ?</h3>
<p className="profile-modal-body">
Vos informations (prénom, nom, téléphone) seront mises à jour sur votre compte.
</p>
<div className="profile-modal-actions">
<button className="profile-modal-btn profile-modal-btn--cancel" onClick={() => setShowConfirmContactModal(false)}>
Annuler
</button>
<button className="profile-modal-btn profile-modal-btn--confirm" onClick={saveContact} disabled={savingContact}>
<FontAwesomeIcon icon={faCheckCircle} /> {savingContact ? 'Enregistrement...' : 'Confirmer'}
</button>
</div>
</div>
</div>
)}
{showUnlinkModal && ( {showUnlinkModal && (
<div className="profile-modal-overlay" onClick={() => setShowUnlinkModal(false)}> <div className="profile-modal-overlay" onClick={() => setShowUnlinkModal(false)}>
<div className="profile-modal" onClick={(e) => e.stopPropagation()}> <div className="profile-modal" onClick={(e) => e.stopPropagation()}>