@@ -8,6 +8,15 @@ import LoadingSpinner from "./LoadingSpinner";
88import "../css/base/form.scss" ;
99import "../css/base/table.scss" ;
1010
11+ interface UserInfo {
12+ firstName : string ;
13+ lastName : string ;
14+ bio : string ;
15+ pronouns : string ;
16+ pronunciation : string ;
17+ profileImage : string ;
18+ }
19+
1120const UserProfile : React . FC = ( ) => {
1221 const { id } = useParams ( ) ;
1322 let userId = Number ( id ) ;
@@ -16,12 +25,13 @@ const UserProfile: React.FC = () => {
1625 const updateMutation = useUserInfoUpdateMutation ( userId ) ;
1726 const [ isEditing , setIsEditing ] = useState ( false ) ;
1827
19- const [ formData , setFormData ] = useState ( {
28+ const [ formData , setFormData ] = useState < UserInfo > ( {
2029 firstName : "" ,
2130 lastName : "" ,
2231 bio : "" ,
2332 pronouns : "" ,
24- pronunciation : ""
33+ pronunciation : "" ,
34+ profileImage : ""
2535 } ) ;
2636
2737 const [ showSaveSpinner , setShowSaveSpinner ] = useState ( false ) ;
@@ -30,12 +40,14 @@ const UserProfile: React.FC = () => {
3040 // Populate form data with fetched user data
3141 useEffect ( ( ) => {
3242 if ( requestedData ) {
43+ console . log ( requestedData ) ;
3344 setFormData ( {
3445 firstName : requestedData . firstName || "" ,
3546 lastName : requestedData . lastName || "" ,
3647 bio : requestedData . bio || "" ,
3748 pronouns : requestedData . pronouns || "" ,
38- pronunciation : requestedData . pronunciation || ""
49+ pronunciation : requestedData . pronunciation || "" ,
50+ profileImage : requestedData . profileImage || ""
3951 } ) ;
4052 }
4153 } , [ requestedData ] ) ;
@@ -59,6 +71,7 @@ const UserProfile: React.FC = () => {
5971 // Handle input changes
6072 const handleInputChange = ( e : React . ChangeEvent < HTMLInputElement | HTMLTextAreaElement > ) => {
6173 const { name, value } = e . target ;
74+ console . log ( "Changes" ) ;
6275 setFormData ( prev => ( {
6376 ...prev ,
6477 [ name ] : value
@@ -117,9 +130,18 @@ const UserProfile: React.FC = () => {
117130 return (
118131 < div id = "user-profile-form" >
119132 < h2 className = "form-title" > User Profile</ h2 >
120-
121- < ImageUploader />
122133 < div className = "csm-form" >
134+ < div className = "form-item" >
135+ < label htmlFor = "profile" className = "form-label" >
136+ Profile Image
137+ </ label >
138+ { isEditing ? (
139+ < ImageUploader />
140+ ) : (
141+ // <p>{formData.profileImage}</p>
142+ < img src = { formData . profileImage } />
143+ ) }
144+ </ div >
123145 < div className = "form-item" >
124146 < label htmlFor = "firstName" className = "form-label" >
125147 First Name:
0 commit comments