Skip to content

Commit

Permalink
Merge pull request #499 from reservoirprotocol/pedro/grwth-4315-missi…
Browse files Browse the repository at this point in the history
…ng-wallet-icon-image-on-explorer-and-redstone-market

Fix avatar loading issues
  • Loading branch information
pedromcunha authored Apr 17, 2024
2 parents fea07d2 + bf64012 commit ba03b1c
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 11 deletions.
32 changes: 27 additions & 5 deletions components/navbar/AccountSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import CopyText from 'components/common/CopyText'
import Link from 'next/link'
import Wallet from './Wallet'
import { useRouter } from 'next/router'
import { AvatarFallback } from '@radix-ui/react-avatar'

export const AccountSidebar: FC = () => {
const { address } = useAccount()
Expand All @@ -49,7 +50,16 @@ export const AccountSidebar: FC = () => {
color="gray3"
>
{ensAvatar ? (
<Avatar size="medium" src={ensAvatar} />
<Avatar
size="medium"
src={ensAvatar}
fallback={
<Jazzicon
diameter={44}
seed={jsNumberForAddress(address as string)}
/>
}
/>
) : (
<Jazzicon diameter={44} seed={jsNumberForAddress(address as string)} />
)}
Expand Down Expand Up @@ -169,7 +179,10 @@ export const AccountSidebar: FC = () => {
</CopyText>
</Flex>
<Grid css={{ gridTemplateColumns: '1fr 1fr', mt: 32 }}>
<Link href={`/portfolio/${address || ''}?tab=items`} replace={true}>
<Link
href={`/portfolio/${address || ''}?tab=items`}
replace={true}
>
<Flex
align="center"
css={{
Expand All @@ -183,7 +196,10 @@ export const AccountSidebar: FC = () => {
<Text style="body1">My Items</Text>
</Flex>
</Link>
<Link href={`/portfolio/${address || ''}?tab=listings`} replace={true}>
<Link
href={`/portfolio/${address || ''}?tab=listings`}
replace={true}
>
<Flex
align="center"
css={{
Expand All @@ -197,7 +213,10 @@ export const AccountSidebar: FC = () => {
<Text style="body1">Listings</Text>
</Flex>
</Link>
<Link href={`/portfolio/${address || ''}?tab=offers`} replace={true}>
<Link
href={`/portfolio/${address || ''}?tab=offers`}
replace={true}
>
<Flex
align="center"
css={{
Expand All @@ -211,7 +230,10 @@ export const AccountSidebar: FC = () => {
<Text style="body1">Offers Made</Text>
</Flex>
</Link>
<Link href={`/portfolio/${address || ''}?tab=activity`} replace={true}>
<Link
href={`/portfolio/${address || ''}?tab=activity`}
replace={true}
>
<Flex
align="center"
css={{
Expand Down
12 changes: 10 additions & 2 deletions components/navbar/HamburgerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,16 @@ const HamburgerMenu = () => {
>
<Flex css={{ alignItems: 'center' }}>
{ensAvatar ? (
<Avatar size="medium" src={ensAvatar} />
<Avatar
size="medium"
src={ensAvatar}
fallback={
<Jazzicon
diameter={36}
seed={jsNumberForAddress(address as string)}
/>
}
/>
) : (
<Jazzicon
diameter={36}
Expand Down Expand Up @@ -162,7 +171,6 @@ const HamburgerMenu = () => {
</Text>
</Link>


<Anchor
href="https://docs.reservoir.tools/docs"
target="_blank"
Expand Down
3 changes: 2 additions & 1 deletion components/primitives/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ComponentProps,
ElementRef,
forwardRef,
ReactElement,
} from 'react'

type AvatarRootProps = ComponentProps<typeof AvatarRoot>
Expand Down Expand Up @@ -72,7 +73,7 @@ const AvatarFallback = styled(AvatarPrimitive.Fallback, {
export const Avatar = forwardRef<
ElementRef<typeof AvatarImage>,
ComponentPropsWithoutRef<typeof AvatarImage> & {
fallback?: string
fallback?: ReactElement
size?: AvatarRootProps['size']
corners?: AvatarRootProps['corners']
}
Expand Down
15 changes: 12 additions & 3 deletions pages/portfolio/[[...address]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const IndexPage: NextPage = () => {
const [tokenFiltersOpen, setTokenFiltersOpen] = useState(false)
const [hideSpam, setHideSpam] = useState<boolean>(true)
const [filterCollection, setFilterCollection] = useState<string | undefined>(
undefined
undefined,
)
const [sortByType, setSortByType] =
useState<PortfolioSortingOption>('acquiredAt')
Expand Down Expand Up @@ -115,7 +115,7 @@ const IndexPage: NextPage = () => {
tokenId: item.token?.tokenId as string,
collectionId: item.token?.collection?.id as string,
})),
[selectedItems]
[selectedItems],
)

const tokenTableRef = useRef<TokenTableRef>(null)
Expand Down Expand Up @@ -212,7 +212,16 @@ const IndexPage: NextPage = () => {
>
<Flex align="center">
{ensAvatar ? (
<Avatar size="xxl" src={ensAvatar} />
<Avatar
size="xxl"
src={ensAvatar}
fallback={
<Jazzicon
diameter={64}
seed={jsNumberForAddress(address as string)}
/>
}
/>
) : (
<Jazzicon
diameter={64}
Expand Down

0 comments on commit ba03b1c

Please sign in to comment.