2023-11-08 20:24:44 -08:00
|
|
|
import useProfileDetails from 'hooks/useProfileDetails'
|
2022-07-26 21:40:17 -07:00
|
|
|
import ProfileIcon from '../icons/ProfileIcon'
|
|
|
|
|
|
|
|
const ProfileImage = ({
|
|
|
|
imageSize,
|
|
|
|
placeholderSize,
|
2022-09-20 22:31:54 -07:00
|
|
|
imageUrl,
|
|
|
|
isOwnerProfile,
|
2022-07-26 21:40:17 -07:00
|
|
|
}: {
|
|
|
|
imageSize: string
|
|
|
|
placeholderSize: string
|
2023-03-27 03:08:17 -07:00
|
|
|
imageUrl?: string | null
|
2022-09-20 22:31:54 -07:00
|
|
|
isOwnerProfile?: boolean
|
2022-07-26 21:40:17 -07:00
|
|
|
}) => {
|
2023-11-08 20:24:44 -08:00
|
|
|
const { data: profile } = useProfileDetails()
|
2022-07-26 21:40:17 -07:00
|
|
|
|
2022-12-23 10:53:57 -08:00
|
|
|
return imageUrl || (isOwnerProfile && profile?.profile_image_url) ? (
|
2022-07-26 21:40:17 -07:00
|
|
|
<img
|
|
|
|
alt=""
|
2022-12-23 10:53:57 -08:00
|
|
|
src={imageUrl ? imageUrl : profile?.profile_image_url}
|
2023-04-19 18:12:45 -07:00
|
|
|
className={`rounded-full`}
|
2022-07-26 21:40:17 -07:00
|
|
|
style={{ width: `${imageSize}px`, height: `${imageSize}px` }}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<div
|
2022-09-20 22:31:54 -07:00
|
|
|
className={`flex flex-shrink-0 items-center justify-center rounded-full bg-th-bkg-3`}
|
2022-07-26 21:40:17 -07:00
|
|
|
style={{ width: `${imageSize}px`, height: `${imageSize}px` }}
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
width: `${placeholderSize}px`,
|
|
|
|
height: `${placeholderSize}px`,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<ProfileIcon className={`h-full w-full text-th-fgd-3`} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ProfileImage
|