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]: Use default basename avatar when possible #1002

Merged
merged 3 commits into from
Aug 7, 2024

Conversation

kirkas
Copy link
Contributor

@kirkas kirkas commented Aug 7, 2024

  • feat: Add isBasename and getBaseDefaultProfilePicture function to resolve to default avatars.
  • feat: Modify getAvatar to resolve default avatars, only for basenames.
image

Copy link

vercel bot commented Aug 7, 2024

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

Name Status Preview Comments Updated (UTC)
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 8:45pm

@@ -5,3 +5,22 @@ export const RESOLVER_ADDRESSES_BY_CHAIN_ID: ResolverAddressesByChainIdMap = {
[baseSepolia.id]: '0x6533C94869D28fAA8dF77cc63f9e2b2D6Cf77eBA',
[base.id]: '0xC6d566A56A1aFf6508b41f6c90ff131615583BCD',
};

// Basename default profile pictures
const BASE_DEFAULT_PROFILE_PICTURES1 = `<svg width="3000" height="3000" viewBox="0 0 3000 3000" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_5569_72801)"><rect width="3000" height="3000" fill="#155DFD"/><circle cx="1500" cy="1500" r="1500" fill="#155DFD"/><path d="M2596.93 1721.27C2605.58 1648.75 2610.21 1574.9 2610.21 1500C2610.21 1425.1 2605.58 1351.4 2596.93 1278.73C2770.3 1177.28 2815.96 914.534 2631.1 772.941C2553.96 713.858 2472.05 660.593 2385.96 614.042C2339.26 528.102 2286.14 446.041 2227.06 368.904C2085.47 184.192 1822.72 229.699 1721.27 403.071C1648.75 394.417 1574.9 389.792 1500 389.792C1425.1 389.792 1351.4 394.417 1278.73 403.071C1177.28 229.699 914.534 184.043 772.941 368.904C713.858 446.041 660.593 527.953 614.042 614.042C528.102 660.742 446.041 713.858 368.904 772.941C184.192 914.534 229.699 1177.28 403.071 1278.73C394.417 1351.25 389.792 1425.1 389.792 1500C389.792 1574.9 394.417 1648.6 403.071 1721.27C229.699 1822.72 184.043 2085.47 368.904 2227.06C446.041 2286.14 527.953 2339.41 614.042 2385.96C660.742 2471.9 713.858 2553.96 772.941 2631.1C914.534 2815.81 1177.28 2770.3 1278.73 2596.93C1351.25 2605.58 1425.1 2610.21 1500 2610.21C1574.9 2610.21 1648.6 2605.58 1721.27 2596.93C1822.72 2770.3 2085.47 2815.96 2227.06 2631.1C2286.14 2553.96 2339.41 2472.05 2385.96 2385.96C2471.9 2339.26 2553.96 2286.14 2631.1 2227.06C2815.81 2085.47 2770.3 1822.72 2596.93 1721.27Z" fill="white"/><path d="M1391.06 1500C1391.06 1647.89 1358.4 1781.62 1305.74 1878.28C1253.03 1975.05 1180.69 2034 1101.53 2034C1022.36 2034 950.031 1975.05 897.314 1878.28C844.66 1781.62 812 1647.89 812 1500C812 1352.11 844.66 1218.38 897.314 1121.72C950.031 1024.95 1022.36 966 1101.53 966C1180.69 966 1253.03 1024.95 1305.74 1121.72C1358.4 1218.38 1391.06 1352.11 1391.06 1500Z" fill="#155DFD" stroke="white" stroke-width="6"/><ellipse cx="1102.57" cy="1194.93" rx="126.414" ry="231.934" fill="white"/><path d="M2187.16 1500C2187.16 1647.89 2154.5 1781.62 2101.84 1878.28C2049.13 1975.05 1976.79 2034 1897.63 2034C1818.46 2034 1746.13 1975.05 1693.41 1878.28C1640.76 1781.62 1608.1 1647.89 1608.1 1500C1608.1 1352.11 1640.76 1218.38 1693.41 1121.72C1746.13 1024.95 1818.46 966 1897.63 966C1976.79 966 2049.13 1024.95 2101.84 1121.72C2154.5 1218.38 2187.16 1352.11 2187.16 1500Z" fill="#155DFD" stroke="white" stroke-width="6"/><ellipse cx="1896.58" cy="1194.93" rx="126.414" ry="231.934" fill="white"/></g><defs><clipPath id="clip0_5569_72801"><rect width="3000" height="3000" fill="white"/></clipPath></defs></svg>`;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we need a better place for those, as they take a lot of space.

return mainnetEnsAvatar;
}

// 3. If username is a basename (.base.eth / .basetest.eth), use default basename avatars
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the comments

@Zizzamia Zizzamia merged commit 9fbb7ec into main Aug 7, 2024
14 checks passed
@Zizzamia Zizzamia deleted the feat-user-default-basename-avatar branch August 7, 2024 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants