@@ -22,7 +22,6 @@ import { useState } from 'react';
22
22
import { toast } from 'react-toastify' ;
23
23
import useSWR from 'swr' ;
24
24
25
- import Avatar from '@/components/Avatar' ;
26
25
import { Button } from '@/components/Button' ;
27
26
import { RepositioningIcon } from '@/components/Icons' ;
28
27
import { SvgIcon } from '@/components/Image' ;
@@ -32,6 +31,13 @@ import { useUser } from '#/state/application/hooks';
32
31
33
32
import SocialInfoWidget from '../social-info' ;
34
33
import IdentitySwitch from './IdentitySwitch' ;
34
+ import ProfileAvatar from './ProfileAvatar' ;
35
+
36
+ function getUserDesc ( data ) {
37
+ const baseUserDesc = data ?. base . user_bio ;
38
+ const web3BioDesc = data ?. web3Bio ?. find ( v => v . description ) ?. description ;
39
+ return baseUserDesc || web3BioDesc || '--' ;
40
+ }
35
41
36
42
function ProfileCardWidget ( { className, data } ) {
37
43
const router = useRouter ( ) ;
@@ -78,27 +84,27 @@ function ProfileCardWidget({ className, data }) {
78
84
return (
79
85
< div className = { clsx ( 'relative md:w-[360px] md:rounded-lg md:p-6 md:bg-white' , className ) } >
80
86
< div className = "flex flex-col gap-2 items-center" >
81
- < Avatar
82
- className = "-mt-[104px] md:mt-0"
83
- size = { 110 }
84
- src = { data . base . user_avatar }
85
- defaultSrc = "https://s3.us-west-1.amazonaws.com/file.openbuild.xyz/config/avatar/04.svg"
86
- alt = { data ?. base . user_nick_name }
87
- />
87
+ < ProfileAvatar data = { data } className = "-mt-[104px] md:mt-0 relative" />
88
88
< h6 className = "text-[24px] leading-none" >
89
89
< a href = { `/u/${ handle } ` } > { data ?. base . user_nick_name } </ a >
90
90
</ h6 >
91
- { ! creatorAvailable && < div className = "flex items-center text-sm" >
92
- < RepositioningIcon className = "mr-1" />
93
- < p className = "text-sm opacity-60" >
94
- { data . base ?. user_city } , { data . base ?. user_country }
95
- </ p >
96
- </ div > }
97
- < p className = "text-sm text-center" > { data ?. base . user_bio !== '' ? data ?. base . user_bio : '--' } </ p >
91
+ { ! creatorAvailable && (
92
+ < div className = "flex items-center text-sm" >
93
+ < RepositioningIcon className = "mr-1" />
94
+ < p className = "text-sm opacity-60" >
95
+ { data . base ?. user_city } , { data . base ?. user_country }
96
+ </ p >
97
+ </ div >
98
+ ) }
99
+ < p className = "text-sm text-center" > { getUserDesc ( data ) } </ p >
98
100
</ div >
99
101
< div className = "my-6 flex gap-7 justify-center text-sm" >
100
- < Link href = { `/u/${ handle } /followers` } > < strong > { data ?. follow ?. followers } </ strong > < span className = "opacity-60" > followers</ span > </ Link >
101
- < Link href = { `/u/${ handle } /following` } > < strong > { data ?. follow ?. following } </ strong > < span className = "opacity-60" > following</ span > </ Link >
102
+ < Link href = { `/u/${ handle } /followers` } >
103
+ < strong > { data ?. follow ?. followers } </ strong > < span className = "opacity-60" > followers</ span >
104
+ </ Link >
105
+ < Link href = { `/u/${ handle } /following` } >
106
+ < strong > { data ?. follow ?. following } </ strong > < span className = "opacity-60" > following</ span >
107
+ </ Link >
102
108
</ div >
103
109
{ user ?. base . user_id === data ?. base ?. user_id ? (
104
110
< Link href = "/profile" >
@@ -107,11 +113,13 @@ function ProfileCardWidget({ className, data }) {
107
113
< span className = "!font-bold" > Edit</ span >
108
114
</ Button >
109
115
</ Link >
110
- ) : ( ( status === 'authenticated' && followData ?. follow ) || followLoading ?
116
+ ) : ( status === 'authenticated' && followData ?. follow ) || followLoading ? (
111
117
< Button className = "group" loading = { followLoading } fullWidth variant = "outlined" onClick = { unfollow } >
112
118
< span className = "!font-bold block group-hover:hidden" > Following</ span >
113
119
< span className = "!font-bold hidden group-hover:block" > Unfollow</ span >
114
- </ Button > : < Button fullWidth variant = "contained" loading = { followLoading } onClick = { follow } >
120
+ </ Button >
121
+ ) : (
122
+ < Button fullWidth variant = "contained" loading = { followLoading } onClick = { follow } >
115
123
< SvgIcon name = "plus" size = { 16 } />
116
124
< span className = "!font-bold" > Follow</ span >
117
125
</ Button >
@@ -127,9 +135,7 @@ function ProfileCardWidget({ className, data }) {
127
135
<Link href="/" className="text-xs opacity-60">+ Follow</Link>
128
136
</div>
129
137
</>} */ }
130
- { creatorAvailable && (
131
- < IdentitySwitch className = "absolute top-4 right-4" userName = { handle } />
132
- ) }
138
+ { creatorAvailable && < IdentitySwitch className = "absolute top-4 right-4" userName = { handle } /> }
133
139
< SocialInfoWidget className = "hidden md:block" data = { data } />
134
140
</ div >
135
141
) ;
0 commit comments