Skip to content
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

Open
wants to merge 4 commits into
base: test
Choose a base branch
from

Conversation

AsaoOoo0o0o
Copy link

closed #169

  • 头像新增 web3.bio 标识
  • 个人简介新增 web3.bio 来源
  • web2 social 新增 web3.bio 来源
  • web3 social 样式调整
  • 删除 socialLink 未使用的 extra
  • 部分 style 替换为 tailwind 写法
  • 代码格式被 prettier 自动格式化了,看起来有些更改

Copy link

vercel bot commented Mar 20, 2025

@AsaoOoo0o0o is attempting to deploy a commit to the OpenBuild Team on Vercel.

A member of the Team first needs to authorize it.

@ourai ourai self-requested a review March 20, 2025 16:34
@ourai ourai self-assigned this Mar 20, 2025
@ourai ourai added the enhancement New feature or request label Mar 20, 2025
@ourai ourai added this to the 2025W12 milestone Mar 20, 2025
Copy link

vercel bot commented Mar 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
openbuild-frontend ✅ Ready (Inspect) Visit Preview Mar 21, 2025 1:27am

const baseUserDesc = data?.base.user_bio;
const web3BioDesc = data?.web3Bio?.find(v => v.description)?.description;
return baseUserDesc || web3BioDesc || '--';
}, [data]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 复杂度低的纯计算不需要用 useMemo
  2. 计算过程没有强依赖组件内部状态,可以在组件外部定义函数。

/>
<div className="relative">
<Avatar
className="-mt-[104px] md:mt-0"
Copy link
Member

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}
Copy link
Member

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"
/>
)}
Copy link
Member

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',
Copy link
Member

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)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

web3BioLink 这个函数不需要:

  1. 函数里第一行的 reduce 应该拿出来在数组遍历操作(map)前计算,以避免重复计算;
  2. 函数里第二行作为 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">
Copy link
Member

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
Copy link
Member

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,
}}
Copy link
Member

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不需要函数,直接一个对象就行了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

个人主页信息与 Web3.bio Profile 数据融合改进
2 participants