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

Add jazzicon to delegate #174

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.47.0",
"react-jazzicon": "^1.0.4",
"react-tooltip": "^5.23.0",
"swr": "^2.2.4",
"viem": "~1.10.7",
Expand Down
10 changes: 7 additions & 3 deletions pages/[id]/delegate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import Image from 'next/image';
import { useAccount, useEnsAvatar, useEnsName, useNetwork, useWalletClient } from 'wagmi';
import { isAddress, formatUnits } from 'viem';
import { useForm } from 'react-hook-form';
import Jazzicon, { jsNumberForAddress } from 'react-jazzicon';

import { useBalances } from '@/hooks/useBalances';
import { useConfig } from '@/hooks/useConfig';
import { useHasMounted } from '@/hooks/useHasMounted';
Expand Down Expand Up @@ -149,15 +151,17 @@ const Delegate: NextPage = () => {
<div className="flex align-center p-4 gap-1">
<div className="self-center font-mono">
{mounted && delegatee !== ZERO_ADDRESS ? (
<div className="flex items-start gap-1">
{delegateEnsAvatar && (
<div className="flex items-center gap-1">
{delegateEnsAvatar ? (
<img
className="inline-block h-6 w-6 rounded-full"
src={delegateEnsAvatar}
alt=""
/>
) : (
<Jazzicon diameter={24} seed={jsNumberForAddress(delegatee || '')} />
)}
{delegateEnsName || delegatee}{' '}
<p className="text-sm self-end">{delegateEnsName || delegatee}</p>
<InformationCircleIcon
id="delegate-address-information"
className="h-4"
Expand Down
20 changes: 20 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4574,6 +4574,13 @@ __metadata:
languageName: node
linkType: hard

"mersenne-twister@npm:^1.1.0":
version: 1.1.0
resolution: "mersenne-twister@npm:1.1.0"
checksum: 7de1940ded117f2aad9320ae4d21d647b0ecf0667abbadcfe6a2835c669feb674ef46cb7a72da7af69a56d8b19e50e95e2fb7ef6d780efab7a6acd4d87f4cb2d
languageName: node
linkType: hard

"micromatch@npm:^4.0.4, micromatch@npm:^4.0.5":
version: 4.0.5
resolution: "micromatch@npm:4.0.5"
Expand Down Expand Up @@ -5527,6 +5534,18 @@ __metadata:
languageName: node
linkType: hard

"react-jazzicon@npm:^1.0.4":
version: 1.0.4
resolution: "react-jazzicon@npm:1.0.4"
dependencies:
mersenne-twister: ^1.1.0
peerDependencies:
react: ">=17.0.0"
react-dom: ">=17.0.0"
checksum: e975b143b001f6e06bf6269498749e174550a86dfd85c255c64750f2adfa0b94d5ac8d79e04eb8b136f94067ee30ce47dae06312f9f1d37219319dc2c658d671
languageName: node
linkType: hard

"react-remove-scroll-bar@npm:^2.3.3":
version: 2.3.4
resolution: "react-remove-scroll-bar@npm:2.3.4"
Expand Down Expand Up @@ -6959,6 +6978,7 @@ __metadata:
react: ^18.2.0
react-dom: ^18.2.0
react-hook-form: ^7.47.0
react-jazzicon: ^1.0.4
react-tooltip: ^5.23.0
swr: ^2.2.4
tailwindcss: ^3.3.3
Expand Down