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

fix(bridge-ui): truncate selected token name to 5 characters #16066

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import type { Token } from '$libs/token';
import { classNames } from '$libs/util/classNames';
import { noop } from '$libs/util/noop';
import { truncateString } from '$libs/util/truncateString';
import { account } from '$stores/account';

import AddCustomErc20 from './AddCustomERC20.svelte';
Expand Down Expand Up @@ -102,7 +103,7 @@
<i role="img" aria-label={ct.name}>
<Erc20 />
</i>
<span class="body-bold">{ct.symbol}</span>
<span class="body-bold">{truncateString(ct.symbol, 10)}</span>
</div>
</li>
{/each}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import { ETHToken, fetchBalance as getTokenBalance, type Token, TokenType } from '$libs/token';
import { getTokenAddresses } from '$libs/token/getTokenAddresses';
import { getLogger } from '$libs/util/logger';
import { truncateString } from '$libs/util/truncateString';
import { uid } from '$libs/util/uid';
import { type Account, account } from '$stores/account';
import { connectedSourceChain } from '$stores/network';
Expand Down Expand Up @@ -230,7 +231,7 @@
<svelte:component this={Erc20} size={20} />
</i>
{/if}
<span class={textClass}>{value.symbol}</span>
<span class={textClass}>{truncateString(value.symbol, 5)}</span>
</div>
{/if}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge-ui/src/libs/util/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function renderBalance(balance: Maybe<GetBalanceReturnType>) {
if (!balance) return '0.00';
// if (typeof balance === 'bigint') return balance.toString();
const maxlength = Number(balance.formatted) < 0.000001 ? balance.decimals : 6;
return `${truncateString(balance.formatted, maxlength, '')} ${balance.symbol}`;
return `${truncateString(balance.formatted, maxlength, '')} ${truncateString(balance.symbol, 5)}`;
}

export function renderEthBalance(balance: bigint, maxlength = 8): string {
Expand Down
Loading