diff --git a/src/frontend/src/lib/components/manage/ManageTokens.svelte b/src/frontend/src/lib/components/manage/ManageTokens.svelte index bbb4736c98b..430bdfae0f3 100644 --- a/src/frontend/src/lib/components/manage/ManageTokens.svelte +++ b/src/frontend/src/lib/components/manage/ManageTokens.svelte @@ -1,38 +1,36 @@ -
- -
- -{#if nonNullish($selectedNetwork)} -

- {replacePlaceholders($i18n.tokens.manage.text.manage_for_network, { - $network: $selectedNetwork.name - })} -

-{/if} - {#if nonNullish(infoElement)} {@render infoElement()} {/if} -{#if noTokensMatch} - +{#if showNetworks} + (showNetworks = false)} /> {:else} -
-
- {#each tokens as token (`${token.network.id.description}-${token.id.description}`)} - - - - - - - {token.symbol} - - - - {#if icTokenIcrcCustomToken(token)} - - {:else if icTokenEthereumUserToken(token) || isTokenSplToggleable(token)} - - {:else if isBitcoinToken(token)} - - {:else if isSolanaToken(token)} - - {/if} - - - {/each} -
-
- - - - - dispatch('icClose')} /> - - + {#snippet tokenListItem(token)} + + + + + + + {token.symbol} + + + + {#if icTokenIcrcCustomToken(token)} + + {:else if icTokenEthereumUserToken(token) || isTokenSplToggleable(token)} + + {:else if isBitcoinToken(token)} + + {:else if isSolanaToken(token)} + + {/if} + + + {/snippet} + {#snippet toolbar()} + + + {/snippet} + {/if} diff --git a/src/frontend/src/lib/components/tokens/ModalTokensList.svelte b/src/frontend/src/lib/components/tokens/ModalTokensList.svelte index 58d16db1649..2b178650e20 100644 --- a/src/frontend/src/lib/components/tokens/ModalTokensList.svelte +++ b/src/frontend/src/lib/components/tokens/ModalTokensList.svelte @@ -68,15 +68,13 @@
{#if noTokensMatch} -

- {#if noResults} - {@render noResults()} - {:else} -

- {$i18n.core.text.no_results} -

- {/if} -

+ {#if noResults} + {@render noResults()} + {:else} +

+ {$i18n.core.text.no_results} +

+ {/if} {:else}
    {#each $filteredTokens as token (token.id)} diff --git a/src/frontend/src/lib/constants/test-ids.constants.ts b/src/frontend/src/lib/constants/test-ids.constants.ts index 118b55c8df6..dcb6d0acd16 100644 --- a/src/frontend/src/lib/constants/test-ids.constants.ts +++ b/src/frontend/src/lib/constants/test-ids.constants.ts @@ -9,6 +9,7 @@ export const LOGIN_BUTTON = 'login-button'; export const MAX_BUTTON = 'max-button'; export const LOADER_MODAL = 'loader-modal'; +export const BUTTON_MODAL_CLOSE = 'close-modal'; export const TOKEN_CARD = 'token-card'; export const TOKEN_GROUP = 'token-group'; @@ -118,7 +119,6 @@ export const SWAP_TOKENS_MODAL = 'swap-tokens-modal'; export const MANAGE_TOKENS_MODAL = 'manage-tokens-modal'; export const MANAGE_TOKENS_MODAL_BUTTON = 'manage-tokens-modal-button'; export const MANAGE_TOKENS_MODAL_SAVE = 'manage-tokens-modal-save'; -export const MANAGE_TOKENS_MODAL_CLOSE = 'manage-tokens-modal-close'; export const MANAGE_TOKENS_MODAL_TOKEN_TOGGLE = 'manage-tokens-modal-token-toggle'; export const NETWORKS_SWITCHER_SELECTOR = 'networks-switcher-selector'; diff --git a/src/frontend/src/lib/i18n/en.json b/src/frontend/src/lib/i18n/en.json index 09e898e5249..8749dbb4d6b 100644 --- a/src/frontend/src/lib/i18n/en.json +++ b/src/frontend/src/lib/i18n/en.json @@ -670,6 +670,7 @@ "manage_list": "Manage tokens", "list_settings": "List settings", "do_not_see_import": "Don’t see your token? Import", + "import_token": "Import token", "manage_for_network": "Managing tokens for $network", "network": "Network", "all_tokens_zero_balance": "All tokens have zero balance." diff --git a/src/frontend/src/lib/types/i18n.d.ts b/src/frontend/src/lib/types/i18n.d.ts index e5155a4a215..c4df83522b6 100644 --- a/src/frontend/src/lib/types/i18n.d.ts +++ b/src/frontend/src/lib/types/i18n.d.ts @@ -626,6 +626,7 @@ interface I18nTokens { manage_list: string; list_settings: string; do_not_see_import: string; + import_token: string; manage_for_network: string; network: string; all_tokens_zero_balance: string; diff --git a/src/frontend/src/tests/lib/components/transactions/Transactions.spec.ts b/src/frontend/src/tests/lib/components/transactions/Transactions.spec.ts index d9bf04a3a7c..ba0427cd5f1 100644 --- a/src/frontend/src/tests/lib/components/transactions/Transactions.spec.ts +++ b/src/frontend/src/tests/lib/components/transactions/Transactions.spec.ts @@ -2,7 +2,7 @@ import * as appNavigation from '$app/navigation'; import { ICP_NETWORK_SYMBOL } from '$env/networks/networks.icp.env'; import { ICP_TOKEN } from '$env/tokens/tokens.icp.env'; import Transactions from '$lib/components/transactions/Transactions.svelte'; -import { MANAGE_TOKENS_MODAL_CLOSE } from '$lib/constants/test-ids.constants'; +import { BUTTON_MODAL_CLOSE } from '$lib/constants/test-ids.constants'; import { modalStore } from '$lib/stores/modal.store'; import { mockPage } from '$tests/mocks/page.store.mock'; import { render, waitFor } from '@testing-library/svelte'; @@ -88,7 +88,7 @@ describe('Transactions', () => { expect(get(modalStore)?.type).toBe('manage-tokens'); const button: HTMLButtonElement | null = container.querySelector( - `button[data-tid='${MANAGE_TOKENS_MODAL_CLOSE}']` + `button[data-tid='${BUTTON_MODAL_CLOSE}']` ); button?.click(); @@ -110,7 +110,7 @@ describe('Transactions', () => { expect(get(modalStore)?.type).toBe('manage-tokens'); const button: HTMLButtonElement | null = container.querySelector( - `button[data-tid='${MANAGE_TOKENS_MODAL_CLOSE}']` + `button[data-tid='${BUTTON_MODAL_CLOSE}']` ); mockPage.mock({ token: ICP_TOKEN.name, network: ICP_NETWORK_SYMBOL });