-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Failed tokens goto dashboard action (#5521)
# Motivation To improve the failed imported tokens UI (because we don't display the whole failed ledger canister ID) we add a button to check the ledger canister on the dashboard. # Changes - Extended current token table action buttons to support `UserTokenFailed`, to unify the action types. - Added new `GoToDashboardButton` action button to the failed token rows. # Tests - A unit test added. - Tested locally <img width="794" alt="image" src="https://github.com/user-attachments/assets/7d4c63e2-8e84-427c-a79d-b713b6898c7e"> # Todos - [ ] Add entry to changelog (if necessary). Not necessary.
- Loading branch information
1 parent
44a12b6
commit 4534945
Showing
9 changed files
with
97 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
frontend/src/lib/components/tokens/TokensTable/actions/GoToDashboardButton.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script lang="ts"> | ||
import type { UserTokenData, UserTokenFailed } from "$lib/types/tokens-page"; | ||
import type { Principal } from "@dfinity/principal"; | ||
import LinkToDashboardCanister from "$lib/components/tokens/LinkToDashboardCanister.svelte"; | ||
export let userToken: UserTokenData | UserTokenFailed; | ||
let canisterId: Principal; | ||
$: canisterId = userToken.universeId; | ||
</script> | ||
|
||
<LinkToDashboardCanister {canisterId} /> |
4 changes: 2 additions & 2 deletions
4
frontend/src/lib/components/tokens/TokensTable/actions/GoToDetailIcon.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 15 additions & 11 deletions
26
frontend/src/lib/components/tokens/TokensTable/actions/ReceiveButton.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
<script lang="ts"> | ||
import { ActionType } from "$lib/types/actions"; | ||
import type { UserTokenData } from "$lib/types/tokens-page"; | ||
import type { UserTokenData, UserTokenFailed } from "$lib/types/tokens-page"; | ||
import { IconQRCodeScanner } from "@dfinity/gix-components"; | ||
import { createEventDispatcher } from "svelte"; | ||
import { isUserTokenData } from "$lib/utils/user-token.utils"; | ||
export let userToken: UserTokenData; | ||
// The UserTokenFailed type was added to unify the action types. However, this action only works with UserTokenData. | ||
export let userToken: UserTokenData | UserTokenFailed; | ||
const dispatcher = createEventDispatcher(); | ||
</script> | ||
|
||
<button | ||
class="icon-only" | ||
data-tid="receive-button-component" | ||
on:click|preventDefault|stopPropagation={() => { | ||
dispatcher("nnsAction", { type: ActionType.Receive, data: userToken }); | ||
}} | ||
> | ||
<IconQRCodeScanner /> | ||
</button> | ||
{#if isUserTokenData(userToken)} | ||
<button | ||
class="icon-only" | ||
data-tid="receive-button-component" | ||
on:click|preventDefault|stopPropagation={() => { | ||
dispatcher("nnsAction", { type: ActionType.Receive, data: userToken }); | ||
}} | ||
> | ||
<IconQRCodeScanner /> | ||
</button> | ||
{/if} |
26 changes: 15 additions & 11 deletions
26
frontend/src/lib/components/tokens/TokensTable/actions/SendButton.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
<script lang="ts"> | ||
import { ActionType } from "$lib/types/actions"; | ||
import type { UserTokenData } from "$lib/types/tokens-page"; | ||
import type { UserTokenData, UserTokenFailed } from "$lib/types/tokens-page"; | ||
import { IconUp } from "@dfinity/gix-components"; | ||
import { createEventDispatcher } from "svelte"; | ||
import { isUserTokenData } from "$lib/utils/user-token.utils"; | ||
export let userToken: UserTokenData; | ||
// The UserTokenFailed type was added to unify the action types. Works only with UserTokenData. | ||
export let userToken: UserTokenData | UserTokenFailed; | ||
const dispatcher = createEventDispatcher(); | ||
</script> | ||
|
||
<button | ||
class="icon-only" | ||
data-tid="send-button-component" | ||
on:click|stopPropagation|preventDefault={() => { | ||
dispatcher("nnsAction", { type: ActionType.Send, data: userToken }); | ||
}} | ||
> | ||
<IconUp /> | ||
</button> | ||
{#if isUserTokenData(userToken)} | ||
<button | ||
class="icon-only" | ||
data-tid="send-button-component" | ||
on:click|stopPropagation|preventDefault={() => { | ||
dispatcher("nnsAction", { type: ActionType.Send, data: userToken }); | ||
}} | ||
> | ||
<IconUp /> | ||
</button> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters