@@ -200,16 +200,26 @@ export const ProfileSection: React.FC<ProfileSectionProps> = ({ plugin }) => {
200200 < div className = "row" >
201201 < div className = "col-md-3 mb-3 mb-md-0 text-center" >
202202 < div className = "mb-2 position-relative d-inline-block" >
203- < img
204- src = { avatarPreview || editedProfile ?. avatar_url || displayProfile . avatar_url || 'https://via.placeholder.com/100' }
205- alt = "Profile Avatar"
206- className = "rounded-circle"
207- style = { { width : '100px' , height : '100px' , objectFit : 'cover' } }
208- onError = { ( e ) => {
209- const target = e . target as HTMLImageElement
210- target . src = 'https://via.placeholder.com/100'
211- } }
212- />
203+ { ( avatarPreview || editedProfile ?. avatar_url || displayProfile . avatar_url ) ? (
204+ < img
205+ src = { avatarPreview || editedProfile ?. avatar_url || displayProfile . avatar_url }
206+ alt = "Profile Avatar"
207+ className = "rounded-circle"
208+ style = { { width : '100px' , height : '100px' , objectFit : 'cover' } }
209+ onError = { ( e ) => {
210+ const target = e . target as HTMLImageElement
211+ target . src = 'https://via.placeholder.com/100?text=Not+Available'
212+ } }
213+ />
214+ ) : (
215+ < div
216+ className = "rounded-circle d-flex align-items-center justify-content-center bg-secondary text-white"
217+ style = { { width : '100px' , height : '100px' , fontSize : '0.7rem' } }
218+ title = "Avatar not available"
219+ >
220+ Not available
221+ </ div >
222+ ) }
213223 </ div >
214224 < div >
215225 < button
@@ -241,7 +251,7 @@ export const ProfileSection: React.FC<ProfileSectionProps> = ({ plugin }) => {
241251 className = "form-control form-control-sm"
242252 value = { editedProfile ?. username || '' }
243253 onChange = { ( e ) => handleFieldChange ( 'username' , e . target . value ) }
244- placeholder = "Enter username"
254+ placeholder = { isEditable ? "Enter username" : ( ! editedProfile ?. username || editedProfile . username === '' ) ? "Not available" : "" }
245255 disabled = { ! isEditable }
246256 readOnly = { ! isEditable }
247257 />
@@ -254,7 +264,7 @@ export const ProfileSection: React.FC<ProfileSectionProps> = ({ plugin }) => {
254264 className = "form-control form-control-sm"
255265 value = { editedProfile ?. email || '' }
256266 onChange = { ( e ) => handleFieldChange ( 'email' , e . target . value ) }
257- placeholder = "Enter email"
267+ placeholder = { isEditable ? "Enter email" : ( ! editedProfile ?. email || editedProfile . email === '' ) ? "Not available" : "" }
258268 disabled = { ! isEditable }
259269 readOnly = { ! isEditable }
260270 />
0 commit comments