@@ -7,7 +7,7 @@ import { API_URL } from '../config';
77import ConfirmationModal from './ConfirmationModal' ;
88
99export default function Settings ( ) {
10- const { logout } = useAuth ( ) ;
10+ const { logout, user , isLoading } = useAuth ( ) ;
1111
1212 // Password State
1313 const [ passData , setPassData ] = useState ( { currentPassword : '' , newPassword : '' } ) ;
@@ -17,6 +17,7 @@ export default function Settings() {
1717 const [ deletePass , setDeletePass ] = useState ( '' ) ;
1818 const [ loadingDelete , setLoadingDelete ] = useState ( false ) ;
1919 const [ showDeleteModal , setShowDeleteModal ] = useState ( false ) ;
20+ const pageLoading = isLoading ;
2021
2122 // Handle Password Change
2223 const handlePasswordChange = async ( e ) => {
@@ -58,6 +59,22 @@ export default function Settings() {
5859 setShowDeleteModal ( true ) ;
5960 } ;
6061
62+ const SettingsSkeleton = ( ) => (
63+ < div style = { { maxWidth : '600px' , margin : '0 auto' , padding : '2rem' , display : 'flex' , flexDirection : 'column' , gap : '2rem' } } >
64+ < div className = "skeleton" style = { { width : '140px' , height : '28px' } } />
65+ { [ 1 , 2 ] . map ( i => (
66+ < div key = { i } className = "glass-card" style = { { borderRadius : '8px' , padding : '1.5rem' , display : 'flex' , flexDirection : 'column' , gap : '1rem' } } >
67+ < div className = "skeleton" style = { { width : '160px' , height : '20px' } } />
68+ < div className = "skeleton" style = { { width : '100%' , height : '38px' , borderRadius : '6px' } } />
69+ < div className = "skeleton" style = { { width : '100%' , height : '38px' , borderRadius : '6px' } } />
70+ < div className = "skeleton" style = { { width : '100px' , height : '34px' , borderRadius : '6px' } } />
71+ </ div >
72+ ) ) }
73+ </ div >
74+ ) ;
75+
76+ if ( pageLoading ) return < SettingsSkeleton /> ;
77+
6178 return (
6279 < div className = "container" style = { { maxWidth : '800px' , margin : '0 auto' , paddingBottom : '4rem' } } >
6380 < div className = "page-header" style = { { marginBottom : '3rem' , borderBottom : 'none' , display : 'flex' , justifyContent : 'space-between' , alignItems : 'flex-start' } } >
@@ -69,16 +86,16 @@ export default function Settings() {
6986 < div style = { {
7087 padding : '6px 14px' ,
7188 borderRadius : '20px' ,
72- backgroundColor : useAuth ( ) . user ?. isVerified ? 'rgba(62, 207, 142, 0.1)' : 'rgba(255, 193, 7, 0.1)' ,
73- border : `1px solid ${ useAuth ( ) . user ?. isVerified ? 'rgba(62, 207, 142, 0.2)' : 'rgba(255, 193, 7, 0.2)' } ` ,
74- color : useAuth ( ) . user ?. isVerified ? '#3ECF8E' : '#FFC107' ,
89+ backgroundColor : user ?. isVerified ? 'rgba(62, 207, 142, 0.1)' : 'rgba(255, 193, 7, 0.1)' ,
90+ border : `1px solid ${ user ?. isVerified ? 'rgba(62, 207, 142, 0.2)' : 'rgba(255, 193, 7, 0.2)' } ` ,
91+ color : user ?. isVerified ? '#3ECF8E' : '#FFC107' ,
7592 display : 'flex' ,
7693 alignItems : 'center' ,
7794 gap : '8px' ,
7895 fontWeight : 600 ,
7996 fontSize : '0.9rem'
8097 } } >
81- { useAuth ( ) . user ?. isVerified ? (
98+ { user ?. isVerified ? (
8299 < >
83100 < CheckCircle size = { 16 } /> Verified Account
84101 </ >
0 commit comments