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(frontend): Add USD balance in Hero for token page #2976

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AntonioVentilii-DFINITY
Copy link
Collaborator

Motivation

We include the USD balance in the Hero, right below the token balance, when the user is in the transaction page.

Note that when the token has no USD price, we treat the USD balance in the same way, showing $- instead of zero.

Results

Screenshot 2024-10-17 at 16 47 46 Screenshot 2024-10-17 at 16 47 54 Screenshot 2024-10-17 at 16 48 03 Screenshot 2024-10-17 at 16 48 09 Screenshot 2024-10-17 at 16 48 15

@AntonioVentilii-DFINITY AntonioVentilii-DFINITY requested a review from a team as a code owner October 17, 2024 14:50
let usdBalance: number | undefined;
$: usdBalance = nonNullish($token)
? calculateTokenUsdBalance({
token: $token,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should pass the token as property? Easier to refactor when we move away from the global store?


{#if $erc20UserTokensInitialized && nonNullish(tokenSymbol)}
<span class="opacity-100">{$tokenSymbol}</span>
<span class="text-xl font-bold" class:opacity-50={usdBalance ?? 0 === 0}>
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about extracting this into a separate component? Like TokenUsdBalance or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants