diff --git a/src/domain/profile/widgets/social-info/SocialInfo.js b/src/domain/profile/widgets/social-info/SocialInfo.js
index 0a78d71..7e62c1a 100644
--- a/src/domain/profile/widgets/social-info/SocialInfo.js
+++ b/src/domain/profile/widgets/social-info/SocialInfo.js
@@ -24,14 +24,9 @@ import Web3BioProfile from './Web3BioProfile';
const web3BioSocialKeyMap = {
user_github: 'github',
user_discord: 'discord',
- user_twitter: 'x',
+ user_x: 'twitter',
};
-function web3BioLink(type, { web3Bio = [] }) {
- const web3BioLinks = web3Bio.reduce((p, c) => (c.links ? { ...p, ...c.links } : p), {});
- return web3BioLinks[web3BioSocialKeyMap[type]]?.link;
-}
-
function socialsInfo(type, link, web3BioLink) {
const showWeb3Bio = !link && web3BioLink;
@@ -66,21 +61,21 @@ function socialsInfo(type, link, web3BioLink) {
}
function SocialInfoWidget({ className, data }) {
- const socials = useMemo(
- () =>
- Object.keys(data.social)
- .map(i => socialsInfo(i, data.social[i], web3BioLink(i, data)))
- .filter(s => {
- if (!s) {
- return false;
- }
+ const socials = useMemo(() => {
+ const web3BioSocials = (data?.web3Bio ?? []).reduce((p, c) => (c.links ? { ...p, ...c.links } : p), {});
- const enabled = s.enableKey ? data.base[s.enableKey] : true;
+ return Object.keys(data.social)
+ .map(i => socialsInfo(i, data.social[i], web3BioSocials[web3BioSocialKeyMap[i]]?.link))
+ .filter(s => {
+ if (!s) {
+ return false;
+ }
- return enabled && !!s.link;
- }),
- [data],
- );
+ const enabled = s.enableKey ? data.base[s.enableKey] : true;
+
+ return enabled && !!s.link;
+ });
+ }, [data]);
return (
diff --git a/src/domain/profile/widgets/social-info/Web3BioProfile.js b/src/domain/profile/widgets/social-info/Web3BioProfile.js
index a928860..47eee94 100644
--- a/src/domain/profile/widgets/social-info/Web3BioProfile.js
+++ b/src/domain/profile/widgets/social-info/Web3BioProfile.js
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import clsx from 'clsx';
+
import { SvgIcon } from '@/components/Image';
import { capitalize } from '@/utils';
@@ -27,6 +29,25 @@ const specialTextMap = {
linkedin: 'LinkedIn',
};
+const socialsConfig = {
+ farcaster: {
+ icon: 'farcaster-purple',
+ class: 'bg-[#8A63D2]/10 border-[#8A63D2]/10',
+ },
+ lens: {
+ icon: 'lens-green',
+ class: 'bg-[#6BC674]/10 border-[#6BC674]/10',
+ },
+ basenames: {
+ icon: 'basenames-blue',
+ class: 'bg-[#0052FF]/10 border-[#0052FF]/10',
+ },
+ default: {
+ icon: 'link',
+ class: 'bg-[#1A1A1A]/10 border-[#1A1A1A]/10',
+ },
+};
+
function filterExistsInOpenBuild(links, social) {
return Object.entries(links).filter(([k]) => !socialKeyMap[k] || !(socialKeyMap[k] in social));
}
@@ -35,31 +56,6 @@ function resolveLinks({ social, web3Bio = [] }) {
return web3Bio.reduce((p, c) => [].concat(p, filterExistsInOpenBuild(c.links, social)), []);
}
-function socialsConfig(type) {
- switch (type) {
- case 'farcaster':
- return {
- icon: 'farcaster-purple',
- color: '#8A63D21A',
- };
- case 'lens':
- return {
- icon: 'lens-green',
- color: '#6BC6741A',
- };
- case 'basenames':
- return {
- icon: 'basenames-blue',
- color: '#0052FF1A',
- };
- default:
- return {
- icon: 'link',
- color: '#1A1A1A1A',
- };
- }
-}
-
function Web3BioProfile({ data }) {
const links = resolveLinks(data);
@@ -69,28 +65,27 @@ function Web3BioProfile({ data }) {
>
)
diff --git a/src/shared/components/Avatar/index.js b/src/shared/components/Avatar/index.tsx
similarity index 66%
rename from src/shared/components/Avatar/index.js
rename to src/shared/components/Avatar/index.tsx
index 9c5963e..6c0eaef 100644
--- a/src/shared/components/Avatar/index.js
+++ b/src/shared/components/Avatar/index.tsx
@@ -18,9 +18,23 @@ import clsx from 'clsx';
import Image from '../Image';
-function Avatar({ className, size, src, defaultSrc, alt, user }) {
+function Avatar({
+ size,
+ className,
+ src,
+ defaultSrc,
+ alt,
+ user,
+}: {
+ size: number;
+ className?: string;
+ src?: string;
+ defaultSrc?: string;
+ alt?: string;
+ user?: { user_handle: string; user_nick_name: string; user_avatar: string };
+}) {
const resolvedAlt = alt || (user && user.user_nick_name) || '';
- const imgClassName = `rounded-full object-fill w-[${size}px] h-[${size}px]`;
+ const imgClassName = 'rounded-full object-fill';
const imgProps = {
width: size,
height: size,
@@ -29,10 +43,12 @@ function Avatar({ className, size, src, defaultSrc, alt, user }) {
};
return user ? (
-
+
- ) :
;
+ ) : (
+
+ );
}
export default Avatar;