11import React , { useEffect , useState } from 'react' ;
22import { TextInput , Button , Group , Box , LoadingOverlay , Alert } from '@mantine/core' ;
33import { UserProfileData } from '@common/types/msGraphApi' ;
4- import { useAuth } from '@ui/components/AuthContext' ;
54import { notifications } from '@mantine/notifications' ;
65import { useNavigate } from 'react-router-dom' ;
7- import { IconMoodSmileBeam , IconQuestionMark } from '@tabler/icons-react' ;
6+ import { IconMoodSmileBeam } from '@tabler/icons-react' ;
87
98interface ManageProfileComponentProps {
109 getProfile : ( ) => Promise < UserProfileData > ;
1110 setProfile : ( data : UserProfileData ) => Promise < any > ;
1211 firstTime : boolean ;
13- returnTo ?: string ;
1412}
1513
1614export const ManageProfileComponent : React . FC < ManageProfileComponentProps > = ( {
1715 getProfile,
1816 setProfile,
1917 firstTime,
20- returnTo,
2118} ) => {
22- const { userData, setLoginStatus } = useAuth ( ) ;
2319 const navigate = useNavigate ( ) ;
2420 const [ userProfile , setUserProfile ] = useState < undefined | null | UserProfileData > ( undefined ) ;
2521 const [ loading , setLoading ] = useState ( false ) ;
@@ -53,10 +49,6 @@ export const ManageProfileComponent: React.FC<ManageProfileComponentProps> = ({
5349 title : 'Profile updated successfully' ,
5450 message : 'Changes may take some time to reflect.' ,
5551 } ) ;
56- setLoginStatus ( true ) ;
57- if ( returnTo ) {
58- return navigate ( returnTo ) ;
59- }
6052 await fetchProfile ( ) ;
6153 } catch ( e ) {
6254 console . error ( e ) ;
@@ -97,7 +89,7 @@ export const ManageProfileComponent: React.FC<ManageProfileComponentProps> = ({
9789 onChange = { ( e ) =>
9890 setUserProfile ( ( prev ) => prev && { ...prev , displayName : e . target . value } )
9991 }
100- placeholder = { userData ?. name }
92+ placeholder = { userProfile ?. displayName }
10193 required
10294 />
10395 < TextInput
@@ -120,8 +112,9 @@ export const ManageProfileComponent: React.FC<ManageProfileComponentProps> = ({
120112 label = "Email"
121113 value = { userProfile ?. mail || '' }
122114 onChange = { ( e ) => setUserProfile ( ( prev ) => prev && { ...prev , mail : e . target . value } ) }
123- placeholder = { userData ?. email }
115+ placeholder = { userProfile ?. mail }
124116 required
117+ disabled
125118 />
126119
127120 < TextInput
0 commit comments