Compare commits

..

No commits in common. "1f11874755b0b55d2ad451f6e06688aa9840fcf8" and "b7cd62519db9a10277c05b3f459bf0cb2ebfa83a" have entirely different histories.

2 changed files with 7 additions and 49 deletions

View File

@ -93,16 +93,6 @@ export default function App() {
const [changePasswordError, setChangePasswordError] = useState<string | null>(null);
const [changePasswordSuccess, setChangePasswordSuccess] = useState<boolean>(false);
// Auto-clear change password success banner after 4 seconds
useEffect(() => {
if (changePasswordSuccess) {
const timer = setTimeout(() => {
setChangePasswordSuccess(false);
}, 4000);
return () => clearTimeout(timer);
}
}, [changePasswordSuccess]);
// Auth Form State
const [authEmail, setAuthEmail] = useState('');
const [authPassword, setAuthPassword] = useState('');
@ -421,16 +411,6 @@ export default function App() {
}
};
const handleCloseProfileDrawer = () => {
setShowProfileDrawer(false);
setShowPasswordChange(false);
setChangePasswordError(null);
setChangePasswordSuccess(false);
setChangeOldPassword('');
setChangeNewPassword('');
setChangeConfirmPassword('');
};
const handleLogout = () => {
localStorage.removeItem('access_token');
setUserToken(null);
@ -439,7 +419,7 @@ export default function App() {
setAppliedCoupon(null);
setCouponCode('');
setPricingCalc(null);
handleCloseProfileDrawer();
setShowProfileDrawer(false);
setProfileDisplayName('');
setProfilePhone('');
setProfileCountry(initialRegion.country);
@ -599,12 +579,6 @@ export default function App() {
if (activeTab === 'logged-out') {
switchTab('storefront');
}
setShowPasswordChange(false);
setChangeOldPassword('');
setChangeNewPassword('');
setChangeConfirmPassword('');
setChangePasswordError(null);
setChangePasswordSuccess(false);
} catch (err: any) {
setAuthError(err.response?.data?.detail || 'Authentication failed. Please check credentials.');
} finally {
@ -661,8 +635,7 @@ export default function App() {
setChangeNewPassword('');
setChangeConfirmPassword('');
setShowPasswordChange(false);
setChangePasswordSuccess(false);
setChangePasswordError(null);
setChangePasswordSuccess(true);
setPasswordUpdatedPopup(true);
} catch (err: any) {
console.error(err);
@ -1113,11 +1086,7 @@ export default function App() {
activeTab={activeTab}
onSwitchTab={switchTab}
loggedInUser={loggedInUser}
onOpenProfile={() => {
setChangePasswordSuccess(false);
setChangePasswordError(null);
setShowProfileDrawer(true);
}}
onOpenProfile={() => setShowProfileDrawer(true)}
onOpenAuth={(mode) => {
setAuthMode(mode);
setShowAuthModal(true);
@ -1249,7 +1218,7 @@ export default function App() {
{/* 🧭 Profile Drawer */}
<ProfileDrawer
isOpen={showProfileDrawer}
onClose={handleCloseProfileDrawer}
onClose={() => setShowProfileDrawer(false)}
loggedInUser={loggedInUser}
profileDisplayName={profileDisplayName}
setProfileDisplayName={setProfileDisplayName}
@ -1272,17 +1241,15 @@ export default function App() {
setChangeConfirmPassword={setChangeConfirmPassword}
changePasswordLoading={changePasswordLoading}
changePasswordError={changePasswordError}
setChangePasswordError={setChangePasswordError}
changePasswordSuccess={changePasswordSuccess}
setChangePasswordSuccess={setChangePasswordSuccess}
onChangePassword={handleChangePassword}
onLogout={handleLogout}
onBrowseStorefront={() => {
handleCloseProfileDrawer();
setShowProfileDrawer(false);
switchTab('storefront');
}}
onViewSubscriptions={() => {
handleCloseProfileDrawer();
setShowProfileDrawer(false);
switchTab('subscriptions');
}}
curriculumModules={curriculumModules}

View File

@ -34,9 +34,7 @@ interface ProfileDrawerProps {
setChangeConfirmPassword: (pwd: string) => void;
changePasswordLoading: boolean;
changePasswordError: string | null;
setChangePasswordError?: (err: string | null) => void;
changePasswordSuccess: boolean;
setChangePasswordSuccess?: (success: boolean) => void;
onChangePassword: (e: React.FormEvent) => Promise<void>;
onLogout: () => void;
onBrowseStorefront: () => void;
@ -70,9 +68,7 @@ export const ProfileDrawer: React.FC<ProfileDrawerProps> = ({
setChangeConfirmPassword,
changePasswordLoading,
changePasswordError,
setChangePasswordError,
changePasswordSuccess,
setChangePasswordSuccess,
onChangePassword,
onLogout,
onBrowseStorefront,
@ -93,11 +89,8 @@ export const ProfileDrawer: React.FC<ProfileDrawerProps> = ({
const p = parsePhoneNumber(profilePhone, profileCountry);
setDialCode(p.dialCode);
setLocalPhone(p.localDigits);
} else {
if (setChangePasswordSuccess) setChangePasswordSuccess(false);
if (setChangePasswordError) setChangePasswordError(null);
}
}, [isOpen, setChangePasswordSuccess, setChangePasswordError]);
}, [isOpen]);
const handleLocalPhoneChange = (newLocal: string) => {
setLocalPhone(newLocal);
@ -246,8 +239,6 @@ export const ProfileDrawer: React.FC<ProfileDrawerProps> = ({
type="button"
onClick={() => {
setShowPasswordChange(!showPasswordChange);
if (setChangePasswordSuccess) setChangePasswordSuccess(false);
if (setChangePasswordError) setChangePasswordError(null);
}}
className="text-xs text-indigo-600 hover:text-indigo-700 font-bold"
>