1
- import { useEffect , useState } from "react" ;
2
- import { Button , Dropdown , DropdownButton } from "react-bootstrap" ;
3
- import { faCamera , faTrash , faUpload , } from "@fortawesome/free-solid-svg-icons" ;
4
- import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
1
+ import React , { useState , useEffect } from "react" ;
2
+ import { Button , Dropdown , DropdownButton } from "react-bootstrap" ;
3
+ import { faCamera , faTrash , faUpload } from "@fortawesome/free-solid-svg-icons" ;
4
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
5
5
import { toast } from 'react-toastify' ;
6
6
import 'react-toastify/dist/ReactToastify.css' ;
7
-
8
- import { handleProfileImageError } from '../utils/ImageUtils' ;
7
+ import Avatar from '@mui/material/Avatar' ;
9
8
10
9
function ProfileImage ( {
11
10
imageSrc,
@@ -40,7 +39,7 @@ function ProfileImage({
40
39
setIsHovered ( false ) ;
41
40
const timeout = setTimeout ( ( ) => {
42
41
setShowDropdown ( false ) ;
43
- } , 300 ) ;
42
+ } , 300 ) ;
44
43
setHideDropdownTimeout ( timeout ) ;
45
44
} ;
46
45
@@ -64,7 +63,7 @@ function ProfileImage({
64
63
return ( ) => {
65
64
document . removeEventListener ( "click" , handleDocumentClick ) ;
66
65
} ;
67
- } , [ showDropdown ] ) ;
66
+ } , [ showDropdown ] ) ;
68
67
69
68
return (
70
69
< div
@@ -82,14 +81,14 @@ function ProfileImage({
82
81
cursor : showOptions ? "pointer" : "default" ,
83
82
} }
84
83
>
85
- < img
84
+ < Avatar
86
85
src = { imageSrc }
87
- className = { `rounded-circle shadow ${ isHovered ? "opacity-50" : "" } ` }
88
86
alt = { imageAlt }
89
- width = { width }
90
- height = { height }
91
- onError = { handleProfileImageError }
92
- />
87
+ sx = { { width, height } }
88
+ className = { `shadow ${ isHovered ? "opacity-50" : "" } ` }
89
+ >
90
+ { imageAlt . charAt ( 0 ) . toUpperCase ( ) }
91
+ </ Avatar >
93
92
</ Button >
94
93
{ isHovered && showOptions && (
95
94
< div className = "position-absolute top-50 start-50 translate-middle" >
0 commit comments