-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 个人主页信息与 Web3.bio Profile 数据融合改进 #178
base: test
Are you sure you want to change the base?
Conversation
@AsaoOoo0o0o is attempting to deploy a commit to the OpenBuild Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
const baseUserDesc = data?.base.user_bio; | ||
const web3BioDesc = data?.web3Bio?.find(v => v.description)?.description; | ||
return baseUserDesc || web3BioDesc || '--'; | ||
}, [data]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 复杂度低的纯计算不需要用
useMemo
; - 计算过程没有强依赖组件内部状态,可以在组件外部定义函数。
/> | ||
<div className="relative"> | ||
<Avatar | ||
className="-mt-[104px] md:mt-0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class 应该挪到父层 div
<Avatar | ||
className="-mt-[104px] md:mt-0" | ||
size={110} | ||
src={data.base.user_avatar} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
头像没有从 Web3bio 获取。
user_avatar
返回的路径中包含 /config/avatar
是系统默认头像,代表用户自己没设置过头像,这时尝试从 Web3bio 获取,如果没有就用系统默认的。
alt="web3bio" | ||
className="size-6 rounded-full absolute right-1 bottom-1 border-1 border-white" | ||
/> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用了 Web3bio 的头像时才显示这个
const web3BioSocialKeyMap = { | ||
user_github: 'github', | ||
user_discord: 'discord', | ||
user_twitter: 'x', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该是 user_x: 'twitter'
吧?
@@ -53,7 +69,7 @@ function SocialInfoWidget({ className, data }) { | |||
const socials = useMemo( | |||
() => | |||
Object.keys(data.social) | |||
.map(i => socialsInfo(i, data.social[i])) | |||
.map(i => socialsInfo(i, data.social[i], web3BioLink(i, data))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
web3BioLink
这个函数不需要:
- 函数里第一行的
reduce
应该拿出来在数组遍历操作(map
)前计算,以避免重复计算; - 函数里第二行作为
socialsInfo
的第三个参数传进去。
<div className="mt-6 text-xs flex gap-1"> | ||
<p className="uppercase opacity-60 font-bold flex-1">Onchain Identities</p> | ||
<div className="opacity-40">Built with</div> | ||
<a className="" href={`https://web3.bio/${data.social.user_wallet}`} target="_blank" rel="noreferrer"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
className
多余
<p className="uppercase opacity-60 font-bold flex-1">Onchain Identities</p> | ||
<div className="opacity-40">Built with</div> | ||
<a className="" href={`https://web3.bio/${data.social.user_wallet}`} target="_blank" rel="noreferrer"> | ||
web3.bio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
首字母大写
style={{ | ||
borderColor: socialsConfig(k).color, | ||
backgroundColor: socialsConfig(k).color, | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
设计图上边框和背景色不一样吧?另外,用 Tailwind CSS class 的形式设置
@@ -36,18 +35,65 @@ function resolveLinks({ social, web3Bio = [] }) { | |||
return web3Bio.reduce((p, c) => [].concat(p, filterExistsInOpenBuild(c.links, social)), []); | |||
} | |||
|
|||
function socialsConfig(type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不需要函数,直接一个对象就行了
closed #169