chore: build
This commit is contained in:
@@ -46,9 +46,11 @@ export default function ProfilePage() {
|
||||
const [twoFAAdminEnabled, setTwoFAAdminEnabled] = useState(false);
|
||||
const [twoFALoading, setTwoFALoading] = useState(false);
|
||||
|
||||
// Modal confirmation infos par défaut
|
||||
const [showSaveModal, setShowSaveModal] = useState(false);
|
||||
const [showUnlinkModal, setShowUnlinkModal] = useState(false);
|
||||
// Modals confirmation
|
||||
const [showSaveModal, setShowSaveModal] = useState(false);
|
||||
const [showConfirmAddressModal, setShowConfirmAddressModal] = useState(false);
|
||||
const [showConfirmContactModal, setShowConfirmContactModal] = useState(false);
|
||||
const [showUnlinkModal, setShowUnlinkModal] = useState(false);
|
||||
const [showUnlinkSuccessModal, setShowUnlinkSuccessModal] = useState(false);
|
||||
|
||||
const username = extractUsernameFromToken() ?? '';
|
||||
@@ -91,6 +93,7 @@ export default function ProfilePage() {
|
||||
|
||||
const saveAddress = () => {
|
||||
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.');
|
||||
};
|
||||
|
||||
@@ -139,6 +142,7 @@ export default function ProfilePage() {
|
||||
};
|
||||
|
||||
const saveContact = async () => {
|
||||
setShowConfirmContactModal(false);
|
||||
setSavingContact(true);
|
||||
const res = await updateMyProfile({ nom: nom.trim(), prenom: prenom.trim(), telephone: telephone.trim() });
|
||||
setSavingContact(false);
|
||||
@@ -211,7 +215,7 @@ export default function ProfilePage() {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<button className="profile-btn" onClick={saveContact} disabled={savingContact}>
|
||||
<button className="profile-btn" onClick={() => setShowConfirmContactModal(true)} disabled={savingContact}>
|
||||
<FontAwesomeIcon icon={faSave} />
|
||||
{savingContact ? ' Enregistrement...' : ' Enregistrer le compte'}
|
||||
</button>
|
||||
@@ -238,7 +242,7 @@ export default function ProfilePage() {
|
||||
placeholder="Numéro, rue, ville, code postal"
|
||||
/>
|
||||
</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
|
||||
</button>
|
||||
</div>
|
||||
@@ -367,6 +371,56 @@ export default function ProfilePage() {
|
||||
</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 && (
|
||||
<div className="profile-modal-overlay" onClick={() => setShowUnlinkModal(false)}>
|
||||
<div className="profile-modal" onClick={(e) => e.stopPropagation()}>
|
||||
|
||||
Reference in New Issue
Block a user