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

WiP: Imported tokens form #5256

Draft
wants to merge 172 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
40488ec
New const MAX_IMPORTED_TOKENS
mstrasinskis Jul 28, 2024
c79717e
New imported tokens services
mstrasinskis Jul 28, 2024
da6ad8f
Comments
mstrasinskis Jul 28, 2024
503c294
refactro: addImportedToken
mstrasinskis Jul 28, 2024
ef1593b
Test loadImportedTokens
mstrasinskis Jul 28, 2024
015346f
refactor: error messages
mstrasinskis Jul 28, 2024
3d49dee
refactor: testError
mstrasinskis Jul 28, 2024
1e36698
Test addImportedToken
mstrasinskis Jul 28, 2024
09e3c30
refactor: split addImportedToken
mstrasinskis Jul 28, 2024
2740b47
New removeImportedToken service
mstrasinskis Jul 28, 2024
91c476d
refactor: error/success messages
mstrasinskis Jul 28, 2024
c913361
test success toast
mstrasinskis Jul 28, 2024
c679bde
Test removeImportedToken
mstrasinskis Jul 28, 2024
ed0ea9d
Merge branch 'main' into mstr/imported-tokens-services
mstrasinskis Jul 28, 2024
9af3859
Fix typo
mstrasinskis Jul 28, 2024
2fa54de
Comments
mstrasinskis Jul 28, 2024
7a390f4
Merge branch 'mstr/imported-tokens-services' of https://github.com/df…
mstrasinskis Jul 28, 2024
70cece1
Todo added
mstrasinskis Jul 29, 2024
a3bc1da
Add ImportTokenWarning
mstrasinskis Jul 18, 2024
0b30654
Prop "required" for PrincipalInput
mstrasinskis Jul 18, 2024
c97d4e3
New labels
mstrasinskis Jul 18, 2024
57dce25
ImportTokenForm component base
mstrasinskis Jul 18, 2024
f8fa6c5
Dispatch nnsSubmit from ImportTokenForm
mstrasinskis Jul 18, 2024
a0c299f
New ImportTokenModal component with basic validation
mstrasinskis Jul 18, 2024
ca474b3
Add `import-token-validation` busy initiator type
mstrasinskis Jul 18, 2024
fdf850e
Busy screen text
mstrasinskis Jul 18, 2024
aa4e143
Add LinkIcon component
mstrasinskis Jul 18, 2024
594c776
Add ImportTokenCanisterId component
mstrasinskis Jul 18, 2024
f1064ea
Add ImportTokenReview component
mstrasinskis Jul 18, 2024
58941d8
Change index_label_optional label
mstrasinskis Jul 18, 2024
0cab007
Display ImportTokenReview in modal
mstrasinskis Jul 18, 2024
0d857d2
Show modal on import token click
mstrasinskis Jul 18, 2024
dc327ea
Load imported tokens on app init
mstrasinskis Jul 29, 2024
5bdbc4c
Add fetchIcrcToken service
mstrasinskis Jul 18, 2024
56d9f4a
cleanup: remove step 3
mstrasinskis Jul 29, 2024
5f7e87d
Merge branch 'main' into mstr/imported-tokens-form
mstrasinskis Jul 29, 2024
19ac08e
Add missing imported tokens api types
mstrasinskis Jul 29, 2024
9fd1e63
clean: imports
mstrasinskis Jul 29, 2024
73c9a29
Load imported tokens on dapp init
mstrasinskis Jul 29, 2024
58a3665
cleanup: remove step 3 config
mstrasinskis Jul 29, 2024
de2e2e8
feat: adding imported token on confirm
mstrasinskis Jul 29, 2024
fb7ffeb
refactor: use a single link_to_canister
mstrasinskis Jul 29, 2024
7c7a7eb
Remove where_to_find_href
mstrasinskis Jul 29, 2024
29415bf
Comments
mstrasinskis Jul 29, 2024
eff83c3
Remove unused labels
mstrasinskis Jul 29, 2024
be035e9
refactro: rename fetchIcrcTokenMetaData
mstrasinskis Jul 29, 2024
e306495
cleanup: imports
mstrasinskis Jul 29, 2024
2146d13
Add more testIds
mstrasinskis Jul 30, 2024
6d1273b
Merge branch 'main' into mstr/imported-tokens-form
mstrasinskis Jul 31, 2024
460bd3e
feat: propagate more props from PrincipalInput
mstrasinskis Jul 31, 2024
09ccd99
New component ImportTokenForm
mstrasinskis Jul 31, 2024
f793680
Update labels
mstrasinskis Jul 31, 2024
5e3f2eb
New busy store initiator
mstrasinskis Jul 31, 2024
77d3b20
feat: fetchIcrcTokenMetaData service
mstrasinskis Jul 31, 2024
73e8970
New component ImportTokenReview
mstrasinskis Jul 31, 2024
e988727
New component ImportTokenModal
mstrasinskis Jul 31, 2024
ffecb60
feat: display the modal on import token click
mstrasinskis Jul 31, 2024
4a703e4
Remove unused labels
mstrasinskis Jul 31, 2024
020fbfd
Update labels
mstrasinskis Jul 31, 2024
97e1b2f
test: fetchIcrcTokenMetaData service
mstrasinskis Jul 31, 2024
f2eb3cf
test: ImportTokenForm
mstrasinskis Jul 31, 2024
fce3f17
test: add testId prop to ImportTokenCanisterId
mstrasinskis Jul 31, 2024
85857db
test: add testId prop to ImportTokenCanisterId
mstrasinskis Jul 31, 2024
2cd4ee9
cleanup: remove redundant fn
mstrasinskis Jul 31, 2024
d1a7511
test: ImportTokenReview.spec
mstrasinskis Jul 31, 2024
466b863
test: ImportTokenModal
mstrasinskis Jul 31, 2024
8089ff1
test: error and fallback handling
mstrasinskis Jul 31, 2024
0fe010a
test: should open import token modal
mstrasinskis Jul 31, 2024
033ec97
test: should stay on step1 when error
mstrasinskis Jul 31, 2024
4439154
Comment
mstrasinskis Jul 31, 2024
ca77365
Restore missing labels
mstrasinskis Jul 31, 2024
bdccf5e
Merge branch 'mstr/imported-tokens-modal-1' into mstr/imported-tokens…
mstrasinskis Aug 1, 2024
e3b3407
Fix labels
mstrasinskis Aug 1, 2024
2276bf7
Fix labels
mstrasinskis Aug 1, 2024
3017df1
feat: save imported token after user confirmation
mstrasinskis Aug 1, 2024
1d23c65
feat: make indexCanisterId optional for IcrcCanistersStore
mstrasinskis Aug 1, 2024
fa0c66a
feat: Add imported tokens to the icrcCanistersStore
mstrasinskis Aug 1, 2024
20dd1cf
Fix importing label
mstrasinskis Aug 1, 2024
0b15e4b
feat: navigate to imported token after saving
mstrasinskis Aug 1, 2024
f318528
feat: table sort with imported tokens support
mstrasinskis Aug 1, 2024
cd0aba6
feat: display imported token tag
mstrasinskis Aug 1, 2024
18708f0
feat: isImportedToken util
mstrasinskis Aug 1, 2024
84628e2
refactor: use isImportedToken for tag
mstrasinskis Aug 1, 2024
552588e
feat: display imported token tag on wallet page
mstrasinskis Aug 1, 2024
81cf849
cleanup: remove redundant named slot
mstrasinskis Aug 1, 2024
09d4887
Revert "cleanup: remove redundant named slot"
mstrasinskis Aug 1, 2024
e6a769d
Revert "feat: display imported token tag on wallet page"
mstrasinskis Aug 1, 2024
dfb9e8a
feat: display tag in the wallet page header
mstrasinskis Aug 1, 2024
07fa9be
feat: remove imported token (basic version, separate button)
mstrasinskis Aug 1, 2024
1f57673
chore: formatting
mstrasinskis Aug 1, 2024
9d6ca11
fix: update i18n types
mstrasinskis Aug 1, 2024
4654cc0
test: fix compareTokensByImportance arguments
mstrasinskis Aug 1, 2024
234b0d4
test: adjust "should not show errors if loading accounts fails" test
mstrasinskis Aug 1, 2024
03a0b69
chore: remove log
mstrasinskis Aug 1, 2024
0179f68
! ENABLE ENABLE_IMPORT_TOKEN FLAG !
mstrasinskis Aug 1, 2024
9164fcf
Temporary suppress load imported tokens error toast
mstrasinskis Aug 1, 2024
ada4b18
Temporary suppress load imported tokens error toast
mstrasinskis Aug 1, 2024
19515ae
Temporary suppress load imported tokens error toast
mstrasinskis Aug 1, 2024
ac5947d
Revert "Temporary suppress load imported tokens error toast"
mstrasinskis Aug 4, 2024
c23a67c
Revert "Temporary suppress load imported tokens error toast"
mstrasinskis Aug 4, 2024
ce4a311
Revert "Temporary suppress load imported tokens error toast"
mstrasinskis Aug 4, 2024
4c3ba34
Revert "! ENABLE ENABLE_IMPORT_TOKEN FLAG !"
mstrasinskis Aug 4, 2024
d496799
feat: compareTokensByImportance comparator
mstrasinskis Aug 5, 2024
5c58c17
refactor: tokenWithBalance mock function to have id
mstrasinskis Aug 5, 2024
eb50ce1
test: compareTokensWithBalanceOrImportedFirst
mstrasinskis Aug 5, 2024
ee63a31
Remove compareTokensWithBalanceFirst
mstrasinskis Aug 5, 2024
ae8918a
feat: handle import token error
mstrasinskis Aug 6, 2024
201ab7a
test: createTokenWithBalance util
mstrasinskis Aug 6, 2024
7b2714b
test: should display imported tokens after important with balance
mstrasinskis Aug 6, 2024
f52928f
refactor: don't export createTokenWithBalance
mstrasinskis Aug 6, 2024
06e5be2
Expose testId and require props for PrincipaInput component
mstrasinskis Aug 8, 2024
37106ed
Update labels
mstrasinskis Aug 8, 2024
ac57c9c
New ImportTokenForm component
mstrasinskis Aug 8, 2024
de7ed16
New ImportTokenModal component
mstrasinskis Aug 8, 2024
245d914
feat: show modal on "Import token" button click
mstrasinskis Aug 8, 2024
3626af1
Change form test id
mstrasinskis Aug 8, 2024
11b2456
Move the import label
mstrasinskis Aug 8, 2024
0342a7d
test: ImportTokenForm
mstrasinskis Aug 8, 2024
4999d60
test: ImportTokenModal
mstrasinskis Aug 8, 2024
2f08c99
test: open import token modal
mstrasinskis Aug 8, 2024
a4a01be
Remove redundant label
mstrasinskis Aug 8, 2024
737fae4
refactor: rename disable
mstrasinskis Aug 9, 2024
61f00fe
Formatting
mstrasinskis Aug 9, 2024
b6b56db
upgrade ic-js
mstrasinskis Aug 9, 2024
31d7bd0
Index/Ledger canister IDs validation (getLedgerId)
mstrasinskis Aug 9, 2024
81d51fb
npm upgrade:gix to local
mstrasinskis Aug 11, 2024
aac6604
New LinkToDashboard component
mstrasinskis Aug 12, 2024
fc7b223
Add slot actions to WalletPageHeader
mstrasinskis Aug 12, 2024
e347217
Display link to dashboard popover on nns wallet page
mstrasinskis Aug 12, 2024
8a06ea9
Display link to dashboard popover on icrc wallet page
mstrasinskis Aug 12, 2024
d0bef16
Formatting
mstrasinskis Aug 12, 2024
c283cb7
Use LinkToDashboard instead of LinkIcon in ImportTokenCanisterId comp…
mstrasinskis Aug 12, 2024
ffb2312
Merge branch 'mstr/imported-tokens-modal' into mstr/imported-tokens-form
mstrasinskis Aug 13, 2024
6f092a4
reset package lock
mstrasinskis Aug 13, 2024
75cfd53
cleanup
mstrasinskis Aug 13, 2024
a49f1b2
Merge branch 'main' into mstr/imported-tokens-form
mstrasinskis Aug 13, 2024
3e5f876
cleanup
mstrasinskis Aug 13, 2024
ffb6bfa
New const IMPORTANT_CK_TOKEN_IDS
mstrasinskis Aug 14, 2024
9ce3fe6
Import token validation before review
mstrasinskis Aug 14, 2024
ad478a6
Do not show import buttons before the imported tokens are loaded
mstrasinskis Aug 14, 2024
c8917a5
Squashed commit of the following:
mstrasinskis Aug 14, 2024
4af138a
Squashed commit of the following:
mstrasinskis Aug 14, 2024
3ad601f
Restore missing label
mstrasinskis Aug 14, 2024
59f91a3
Merge remote-tracking branch 'origin/main' into mstr/imported-tokens-…
mstrasinskis Aug 15, 2024
eb4b947
Safari table fix - Squashed commit of the following:
mstrasinskis Aug 15, 2024
17da1cd
Formatting
mstrasinskis Aug 16, 2024
05f6380
cleanup: remove unused vars
mstrasinskis Aug 16, 2024
723dbc5
Add remove button to the more popup
mstrasinskis Aug 16, 2024
ae1ed05
style: "more" popup buttons
mstrasinskis Aug 16, 2024
fb9907d
style: Import button redesign
mstrasinskis Aug 16, 2024
8ac4efe
cleanup
mstrasinskis Aug 16, 2024
ced1d8b
feat: remove imported token confirmation dialog (ImportTokenRemoveCon…
mstrasinskis Aug 16, 2024
10cf9ce
Formatting
mstrasinskis Aug 16, 2024
7e1cf6b
Fix type warnings
mstrasinskis Aug 16, 2024
f9011dd
Fix type warnings
mstrasinskis Aug 16, 2024
9efce2c
Remove redundant lables
mstrasinskis Aug 16, 2024
87042ae
Merge branch 'main' into mstr/imported-tokens-form
mstrasinskis Aug 20, 2024
9ddec40
Fix loading imported tokens before the NNS account was created.
mstrasinskis Aug 21, 2024
246e65c
Revert "style: Import button redesign"
mstrasinskis Aug 21, 2024
037c598
Adjust ImportTokenCanisterId.spec to new sub components
mstrasinskis Aug 21, 2024
3923923
test: should not show import token button when they are not loaded
mstrasinskis Aug 21, 2024
87f9cd1
Fix outdated specs
mstrasinskis Aug 21, 2024
8d93ac9
Merge branch 'main' into mstr/imported-tokens-form
mstrasinskis Aug 22, 2024
6bba91d
Move IMPORTANT_CK_TOKEN_IDS to tokens constant
mstrasinskis Aug 22, 2024
82903ce
Replace isUniqueImportedToken with isImportedToken
mstrasinskis Aug 22, 2024
9c016de
test: isImportedToken
mstrasinskis Aug 22, 2024
43778c4
Merge branch 'main' into mstr/imported-tokens-form
mstrasinskis Aug 22, 2024
b31156b
style: update remove confirmation styles
mstrasinskis Aug 23, 2024
1b51c1c
Cleanup RemoveConfirmation component
mstrasinskis Aug 23, 2024
8d031bd
test: ImportTokenRemoveConfirmation
mstrasinskis Aug 23, 2024
45d5a8b
Squashed commit of the following:
mstrasinskis Aug 27, 2024
e54847f
Adjustments for refactored ImportTokenRemoveConfirmation
mstrasinskis Aug 27, 2024
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
8 changes: 4 additions & 4 deletions CHANGELOG-Sns_Aggregator.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ The SNS Aggregator is released through proposals in the Network Nervous System.
## Unreleased

### Added

- Include SNS nervous system parameters.
- Add common code snippets for developers to the "Documentation" chapter on the landing page.

### Changed
### Deprecated
### Removed
Expand All @@ -21,6 +17,10 @@ The SNS Aggregator is released through proposals in the Network Nervous System.

- Decoding quota of 10,000 in the `http_request` method.

## [Proposal 129614](https://dashboard.internetcomputer.org/proposal/129614)
### Added
- Include SNS nervous system parameters.
- Add common code snippets for developers to the "Documentation" chapter on the landing page.

## [Proposal 126006](https://nns.ic0.app/proposal/?u=qoctq-giaaa-aaaaa-aaaea-cai&proposal=126006)
### Changed
Expand Down
2 changes: 1 addition & 1 deletion dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
"DIDC_VERSION": "2024-05-14",
"POCKETIC_VERSION": "3.0.1",
"CARGO_SORT_VERSION": "1.0.9",
"SNSDEMO_RELEASE": "release-2024-08-14",
"SNSDEMO_RELEASE": "release-2024-08-21",
"IC_COMMIT_FOR_PROPOSALS": "release-2024-08-02_01-30-base",
"IC_COMMIT_FOR_SNS_AGGREGATOR": "release-2024-08-02_01-30-base"
},
Expand Down
216 changes: 170 additions & 46 deletions frontend/src/lib/components/accounts/IcrcWalletPage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,27 @@
hasAccounts,
} from "$lib/utils/accounts.utils";
import { replacePlaceholders } from "$lib/utils/i18n.utils";
import { Island, Spinner } from "@dfinity/gix-components";
import {
IconBin,
IconDots,
Island,
Popover,
Spinner,
Tag,
} from "@dfinity/gix-components";
import type { Principal } from "@dfinity/principal";
import { TokenAmountV2, isNullish, nonNullish } from "@dfinity/utils";
import type { Writable } from "svelte/store";
import { accountsPathStore } from "$lib/derived/paths.derived";
import { startBusy, stopBusy } from "$lib/stores/busy.store";
import { importedTokensStore } from "$lib/stores/imported-tokens.store";
import { removeImportedTokens } from "$lib/services/imported-tokens.services";
import TestIdWrapper from "$lib/components/common/TestIdWrapper.svelte";
import LinkToDashboardCanister from "$lib/components/common/LinkToDashboardCanister.svelte";
import { isImportedToken as checkImportedToken } from "$lib/utils/imported-tokens.utils";
import ImportTokenRemoveConfirmation from "$lib/components/accounts/ImportTokenRemoveConfirmation.svelte";
import type { Universe } from "$lib/types/universe";
import { selectableUniversesStore } from "$lib/derived/selectable-universes.derived";

export let testId: string;
export let accountIdentifier: string | undefined | null = undefined;
Expand Down Expand Up @@ -142,58 +159,150 @@
ledgerCanisterId,
isSignedIn: $authSignedInStore,
}))();

const remove = async () => {
if (isNullish(ledgerCanisterId)) return;

startBusy({
initiator: "import-token-removing",
labelKey: "import_token.removing",
});

const importedTokens = $importedTokensStore.importedTokens ?? [];
const { success } = await removeImportedTokens({
tokensToRemove: importedTokens.filter(
({ ledgerCanisterId: id }) => id.toText() === ledgerCanisterId?.toText()
),
importedTokens,
});

stopBusy("import-token-removing");

if (success) {
goto($accountsPathStore);
}
};

let moreButton: HTMLButtonElement | undefined;
let morePopupVisible = false;

let isImportedToken = false;
$: isImportedToken = checkImportedToken({
ledgerCanisterId,
importedTokens: $importedTokensStore.importedTokens,
});

let removeImportedTokenConfirmtionVisible = false;

let universe: Universe | undefined;
$: universe = $selectableUniversesStore.find(
({ canisterId }) => canisterId === ledgerCanisterId?.toText()
);
</script>

<Island {testId}>
<main class="legacy">
<section>
{#if loaded && nonNullish(ledgerCanisterId)}
{#if nonNullish($selectedAccountStore.account) && nonNullish(token)}
<IcrcBalancesObserver
{ledgerCanisterId}
accounts={[$selectedAccountStore.account]}
reload={reloadOnlyAccountFromStore}
/>
{/if}
<WalletPageHeader
universe={$selectedUniverseStore}
walletAddress={$selectedAccountStore.account?.identifier}
/>
<WalletPageHeading
accountName={$selectedAccountStore.account?.name ??
$i18n.accounts.main}
balance={nonNullish($selectedAccountStore.account) &&
nonNullish(token)
? TokenAmountV2.fromUlps({
amount: $selectedAccountStore.account.balanceUlps,
token,
})
: undefined}
>
<slot name="header-actions" />
<SignInGuard />
</WalletPageHeading>

{#if $$slots["info-card"]}
<div class="content-cell-island info-card">
<slot name="info-card" />
<TestIdWrapper {testId}>
<Island>
<main class="legacy">
<section>
{#if loaded && nonNullish(ledgerCanisterId)}
{#if nonNullish($selectedAccountStore.account) && nonNullish(token)}
<IcrcBalancesObserver
{ledgerCanisterId}
accounts={[$selectedAccountStore.account]}
reload={reloadOnlyAccountFromStore}
/>
{/if}
<WalletPageHeader
universe={$selectedUniverseStore}
walletAddress={$selectedAccountStore.account?.identifier}
>
<svelte:fragment slot="tags">
{#if isImportedToken}
<Tag testId="imported-token-tag"
>{$i18n.import_token.imported_token}</Tag
>
{/if}
</svelte:fragment>
<svelte:fragment slot="actions">
{#if nonNullish(ledgerCanisterId)}
<button
bind:this={moreButton}
class="icon-only"
data-tid="more-button"
on:click={() => (morePopupVisible = true)}
>
<IconDots />
</button>
{/if}
</svelte:fragment>
</WalletPageHeader>
<WalletPageHeading
accountName={$selectedAccountStore.account?.name ??
$i18n.accounts.main}
balance={nonNullish($selectedAccountStore.account) &&
nonNullish(token)
? TokenAmountV2.fromUlps({
amount: $selectedAccountStore.account.balanceUlps,
token,
})
: undefined}
>
<slot name="header-actions" />
<SignInGuard />
</WalletPageHeading>

{#if $$slots["info-card"]}
<div class="content-cell-island info-card">
<slot name="info-card" />
</div>
{/if}

<Separator spacing="none" />

<!-- Transactions and the explanation go together. -->
<div>
<slot name="page-content" />
</div>
{:else}
<Spinner />
{/if}
</section>
</main>

<Separator spacing="none" />
<slot name="footer-actions" />
</Island>

<!-- Transactions and the explanation go together. -->
<div>
<slot name="page-content" />
</div>
{:else}
<Spinner />
{/if}
</section>
</main>
{#if nonNullish(ledgerCanisterId)}
<Popover
bind:visible={morePopupVisible}
anchor={moreButton}
direction="rtl"
invisibleBackdrop
>
<div class="popover-content">
<LinkToDashboardCanister canisterId={ledgerCanisterId} />
{#if isImportedToken && nonNullish(universe)}
<button
class="remove-button button ghost with-icon"
data-tid="remove-imported-token-button"
on:click={() => (removeImportedTokenConfirmtionVisible = true)}
>
<IconBin />
{$i18n.core.remove}
</button>
{/if}
</div>
</Popover>
{/if}

<slot name="footer-actions" />
</Island>
{#if removeImportedTokenConfirmtionVisible && nonNullish(universe)}
<ImportTokenRemoveConfirmation
{universe}
on:nnsClose={() => (removeImportedTokenConfirmtionVisible = false)}
on:nnsConfirm={remove}
/>
{/if}
</TestIdWrapper>

<style lang="scss">
section {
Expand All @@ -205,4 +314,19 @@
.info-card {
background-color: var(--island-card-background);
}

.popover-content {
display: flex;
flex-direction: column;
gap: var(--padding-2x);
}

.remove-button {
padding: 0;
color: var(--negative-emphasis);

&:hover {
color: var(--negative-emphasis);
}
}
</style>
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
<script lang="ts">
import { Copy } from "@dfinity/gix-components";
import { nonNullish } from "@dfinity/utils";
import LinkIcon from "$lib/components/common/LinkIcon.svelte";
import LinkToDashboardCanister from "$lib/components/common/LinkToDashboardCanister.svelte";
import type { Principal } from "@dfinity/principal";

export let label: string;
export let canisterId: string | undefined = undefined;
export let canisterLinkHref: string | undefined = undefined;
export let testId: string = "import-token-canister-id-component";
export let canisterId: Principal | undefined = undefined;
export let canisterIdFallback: string | undefined = undefined;
</script>

<div class="container" data-tid="import-token-canister-id-component">
<div class="container" data-tid={testId}>
<span data-tid="label">{label}</span>
<div class="canister-id">
{#if nonNullish(canisterId)}
<span class="value description" data-tid="canister-id">{canisterId}</span>
<Copy value={canisterId} />
{#if nonNullish(canisterLinkHref)}
<LinkIcon href={canisterLinkHref} />
{/if}
<Copy value={canisterId.toText()} />
<LinkToDashboardCanister noLabel {canisterId} />
{:else if nonNullish(canisterIdFallback)}
<span class="fallback description" data-tid="canister-id-fallback"
>{canisterIdFallback}</span
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<script lang="ts">
import { i18n } from "$lib/stores/i18n";
import UniversePageSummary from "$lib/components/universe/UniversePageSummary.svelte";
import type { Universe } from "$lib/types/universe";
import { nonNullish } from "@dfinity/utils";
import ConfirmationModal from "$lib/modals/common/ConfirmationModal.svelte";
import { Tag } from "@dfinity/gix-components";

export let universe: Universe | undefined;
</script>

<ConfirmationModal
testId="import-token-remove-confirmation-component"
on:nnsClose
on:nnsConfirm
yesLabel={$i18n.core.remove}
>
<div class="content">
<h4>{$i18n.import_token.remove_confirmation_description_1}</h4>
<div class="headline">
{#if nonNullish(universe)}<UniversePageSummary {universe} />{/if}
<Tag>{$i18n.import_token.imported_token}</Tag>
</div>
<p class="description text_small">
{$i18n.import_token.remove_confirmation_description_2}
</p>
</div>
</ConfirmationModal>

<style lang="scss">
.content {
display: flex;
flex-direction: column;
gap: var(--padding-2x);
}

.headline {
display: flex;
gap: var(--padding-0_5x);
}
</style>
Loading
Loading