Skip to content

Commit

Permalink
chore: Refactor RaysCountSmall component to handle userAddress condit…
Browse files Browse the repository at this point in the history
…ionally and display if user isnt connected
  • Loading branch information
marcinciarka committed Jul 16, 2024
1 parent f63ebd0 commit 1a497e6
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,30 @@ export const RaysCountSmall = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [userAddress])

if (!userAddress) {
return null
}

return (
<Link
href={{
pathname: '/',
query: { userAddress },
}}
href={
userAddress
? {
pathname: '/',
query: { userAddress },
}
: '/'
}
style={{ textDecoration: 'none' }}
suppressHydrationWarning
>
<div className={raysCountSmallStyles.raysCountWrapper}>
<Icon iconName="rays" size={24} />
<Text variant="p4semi" suppressHydrationWarning>
{loadingRaysCount || raysCount === null ? (
{loadingRaysCount ? (
<SkeletonLine height={15} width={60} />
) : (
<>{formatter(new BigNumber(raysCount)).split('.')[0]} Rays</>
<>
{raysCount
? `${formatter(new BigNumber(raysCount)).split('.')[0]} Rays`
: 'Get $RAYS'}
</>
)}
</Text>
</div>
Expand Down

0 comments on commit 1a497e6

Please sign in to comment.