Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
2139/claim identicon (#2161)
Browse files Browse the repository at this point in the history
* Modified IdenticonMod to allow passing in account as parameter

* Using Identicon component instead of dummy image

Co-authored-by: Leandro <[email protected]>
  • Loading branch information
alfetopito and Leandro authored Jan 15, 2022
1 parent d1cd9a6 commit 4c41c57
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/custom/components/Identicon/IdenticonMod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ export const StyledIdenticonContainer = styled.div`
background-color: ${({ theme }) => theme.bg4};
`

export default function Identicon({ size = 16 }: IdenticonProps) {
const { account, library } = useActiveWeb3React()
export default function Identicon({ account: customAccount, size = 16 }: IdenticonProps) {
const { account: chainAccount, library } = useActiveWeb3React()
const account = customAccount || chainAccount

// restrict usage of Davatar until it stops sending 3p requests
// see https://github.com/metaphor-xyz/davatar-helpers/issues/18
Expand Down
5 changes: 3 additions & 2 deletions src/custom/components/Identicon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ const Wrapper = styled.div<{ size?: number }>`

export interface IdenticonProps {
size?: number
account?: string
}

export default function Identicon({ size }: IdenticonProps) {
export default function Identicon({ account, size }: IdenticonProps) {
return (
<Wrapper size={size}>
<IdenticonMod size={size} />
<IdenticonMod size={size} account={account} />
</Wrapper>
)
}
7 changes: 2 additions & 5 deletions src/custom/pages/Claim/ClaimNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { TopNav, ClaimAccount, ClaimAccountButtons } from './styled'
import { ClaimCommonTypes } from './types'
import { useClaimDispatchers, useClaimState } from 'state/claim/hooks'
import { ClaimStatus } from 'state/claim/actions'

// should be updated
const DUMMY_IDENTICON =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAAA4ZJRE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82sQAWkMagJvDiR8ZQAApAAUIGzALMAgI+a5kFpPSZBeSPG/UAeoA0Bs0CzAISQDXYQpCFoMSQzaD4gxIWwALSCKzBV7eAv6T9ww6D8p2HAAAAAElFTkSuQmCC'
import Identicon from 'components/Identicon'

type ClaimNavProps = Pick<ClaimCommonTypes, 'account' | 'handleChangeAccount'>

Expand All @@ -24,7 +21,7 @@ export default function ClaimNav({ account, handleChangeAccount }: ClaimNavProps
<TopNav>
<ClaimAccount>
<div>
<img src={DUMMY_IDENTICON} alt={activeClaimAccount} />
<Identicon account={activeClaimAccount} size={46} />
<p>{activeClaimAccountENS ? activeClaimAccountENS : shortenAddress(activeClaimAccount)}</p>
</div>

Expand Down

0 comments on commit 4c41c57

Please sign in to comment.