-
Notifications
You must be signed in to change notification settings - Fork 20
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
style(frontend): fixes display of token balances #3234
base: main
Are you sure you want to change the base?
Changes from 4 commits
dcc4467
2a2dd2c
9cad2b9
7a784b3
d98cfd7
219d74a
69df53e
6ac9317
922e314
96b5b2c
9a984ed
aa5d2de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
<script lang="ts"> | ||
import { nonNullish } from '@dfinity/utils'; | ||
import TokenBalanceSkeleton from '$lib/components/tokens/TokenBalanceSkeleton.svelte'; | ||
import { ZERO } from '$lib/constants/app.constants'; | ||
import { TOKEN_BALANCE } from '$lib/constants/test-ids.constants'; | ||
import type { CardData } from '$lib/types/token-card'; | ||
import { formatToken } from '$lib/utils/format.utils'; | ||
|
@@ -17,10 +16,7 @@ | |
unitName: data.decimals | ||
})} | ||
{:else} | ||
{formatToken({ | ||
value: ZERO, | ||
unitName: data.decimals | ||
}).replace('0', '-')} | ||
<span>n/a</span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
{/if} | ||
</output> | ||
</TokenBalanceSkeleton> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,17 +5,15 @@ | |
export let balance: TokenFinancialData['balance']; | ||
export let usdBalance: TokenFinancialData['usdBalance']; | ||
export let nullishBalanceMessage = '-'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why a prop? I think you can use directly inside the component since that is its usage There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to be a prop because by default, this property will display There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am still not convinced about this, i would prefer to default is as |
||
</script> | ||
|
||
<output class="break-all"> | ||
{#if nonNullish(balance) && nonNullish(usdBalance)} | ||
{formatUSD({ value: usdBalance })} | ||
{:else if isNullish(balance)} | ||
<span class:animate-pulse={isNullish(balance)}>{nullishBalanceMessage}</span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you don't need the condition here anymore, right? it will always be true There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No this is still needed. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but |
||
{:else} | ||
<span class:animate-pulse={isNullish(balance)} | ||
>{formatUSD({ | ||
value: 0, | ||
options: { minFraction: 0, maxFraction: 0 } | ||
}).replace('0', '-')} | ||
</span> | ||
<span class:animate-pulse={isNullish(balance)}>n/a</span> | ||
{/if} | ||
</output> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i18n
?