From 117b60bb54aed4d526af147092d0f746a9e35b19 Mon Sep 17 00:00:00 2001 From: AlessandroBonomo Date: Tue, 19 Nov 2024 16:33:35 +0100 Subject: [PATCH 01/14] adds message box of type warning --- .../src/lib/components/transactions/AllTransactions.svelte | 4 ++++ src/frontend/src/lib/i18n/en.json | 3 +++ src/frontend/src/lib/types/i18n.d.ts | 1 + 3 files changed, 8 insertions(+) diff --git a/src/frontend/src/lib/components/transactions/AllTransactions.svelte b/src/frontend/src/lib/components/transactions/AllTransactions.svelte index 0471c859d7..72203cebf3 100644 --- a/src/frontend/src/lib/components/transactions/AllTransactions.svelte +++ b/src/frontend/src/lib/components/transactions/AllTransactions.svelte @@ -8,6 +8,10 @@
{$i18n.activity.text.title} + + {$i18n.activity.warning.incomplete_transaction_list} + + {$i18n.activity.info.btc_transactions} diff --git a/src/frontend/src/lib/i18n/en.json b/src/frontend/src/lib/i18n/en.json index 2b0c16f827..c49e7d4d67 100644 --- a/src/frontend/src/lib/i18n/en.json +++ b/src/frontend/src/lib/i18n/en.json @@ -807,6 +807,9 @@ }, "info": { "btc_transactions": "BTC transaction information is obtained from central third parties and should be independently verified." + }, + "warning": { + "incomplete_transaction_list": "Transaction list is incomplete because $BURN, $BOB don't have an index canister to provide transaction information." } } } diff --git a/src/frontend/src/lib/types/i18n.d.ts b/src/frontend/src/lib/types/i18n.d.ts index af85dd033a..e7819b3432 100644 --- a/src/frontend/src/lib/types/i18n.d.ts +++ b/src/frontend/src/lib/types/i18n.d.ts @@ -702,6 +702,7 @@ interface I18nLicense_agreement { interface I18nActivity { text: { title: string }; info: { btc_transactions: string }; + warning: { incomplete_transaction_list: string }; } interface I18n { From 62af14feb30155c5feaae3f2014b2c0dda4de716 Mon Sep 17 00:00:00 2001 From: AlessandroBonomo Date: Wed, 20 Nov 2024 09:56:20 +0100 Subject: [PATCH 02/14] displays warning to display which tokens do not have an index canister --- .../transactions/AllTransactions.svelte | 23 ++++++++++++++++--- src/frontend/src/lib/i18n/en.json | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/lib/components/transactions/AllTransactions.svelte b/src/frontend/src/lib/components/transactions/AllTransactions.svelte index 72203cebf3..89b5f57b83 100644 --- a/src/frontend/src/lib/components/transactions/AllTransactions.svelte +++ b/src/frontend/src/lib/components/transactions/AllTransactions.svelte @@ -3,14 +3,31 @@ import MessageBox from '$lib/components/ui/MessageBox.svelte'; import PageTitle from '$lib/components/ui/PageTitle.svelte'; import { i18n } from '$lib/stores/i18n.store'; + import { icTransactionsStore } from '$icp/stores/ic-transactions.store'; + import type { TokenUi } from '$lib/types/token'; + import { combinedDerivedSortedNetworkTokensUi } from '$lib/derived/network-tokens.derived'; + import { showZeroBalances } from '$lib/derived/settings.derived'; + import { sortedBtcTransactions } from '$btc/derived/btc-transactions.derived'; + import { sortedEthTransactions } from '$eth/derived/eth-transactions.derived'; + import { replacePlaceholders } from '$lib/utils/i18n.utils.js'; + + let tokensWithoutCanister: TokenUi[]; + $: tokensWithoutCanister = $combinedDerivedSortedNetworkTokensUi.filter( + ({ balance, usdBalance }) => Number(balance ?? 0n) || (usdBalance ?? 0) || $showZeroBalances + ).filter(token => $sortedEthTransactions?.[token.id] === null || $sortedBtcTransactions?.[token.id] === null || $icTransactionsStore?.[token.id] === null) + + let tokenList: string; + $: tokenList = tokensWithoutCanister.map(token => `$${token.symbol}`).join(', ');
{$i18n.activity.text.title} - - {$i18n.activity.warning.incomplete_transaction_list} - + {#if tokenList} + + {replacePlaceholders($i18n.activity.warning.incomplete_transaction_list, {'$token_list': tokenList})} + + {/if} {$i18n.activity.info.btc_transactions} diff --git a/src/frontend/src/lib/i18n/en.json b/src/frontend/src/lib/i18n/en.json index c49e7d4d67..26897297f6 100644 --- a/src/frontend/src/lib/i18n/en.json +++ b/src/frontend/src/lib/i18n/en.json @@ -809,7 +809,7 @@ "btc_transactions": "BTC transaction information is obtained from central third parties and should be independently verified." }, "warning": { - "incomplete_transaction_list": "Transaction list is incomplete because $BURN, $BOB don't have an index canister to provide transaction information." + "incomplete_transaction_list": "Transaction list is incomplete because $token_list don't have an index canister to provide transaction information." } } } From 82241453f708d307794f9a92c77e4f0956b45926 Mon Sep 17 00:00:00 2001 From: AlessandroBonomo Date: Wed, 20 Nov 2024 09:57:34 +0100 Subject: [PATCH 03/14] reformat code --- .../transactions/AllTransactions.svelte | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/frontend/src/lib/components/transactions/AllTransactions.svelte b/src/frontend/src/lib/components/transactions/AllTransactions.svelte index 89b5f57b83..1ee3020f0e 100644 --- a/src/frontend/src/lib/components/transactions/AllTransactions.svelte +++ b/src/frontend/src/lib/components/transactions/AllTransactions.svelte @@ -1,23 +1,30 @@
@@ -25,7 +32,9 @@ {#if tokenList} - {replacePlaceholders($i18n.activity.warning.incomplete_transaction_list, {'$token_list': tokenList})} + {replacePlaceholders($i18n.activity.warning.incomplete_transaction_list, { + $token_list: tokenList + })} {/if} From 5e4fda089efc63dcc32e5c179672bf2ec059ae92 Mon Sep 17 00:00:00 2001 From: AlessandroBonomo Date: Wed, 20 Nov 2024 10:45:14 +0100 Subject: [PATCH 04/14] moves token load logic into network-tokens.derived.ts --- .../transactions/AllTransactions.svelte | 23 +++++-------------- .../src/lib/derived/network-tokens.derived.ts | 17 ++++++++++++++ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/frontend/src/lib/components/transactions/AllTransactions.svelte b/src/frontend/src/lib/components/transactions/AllTransactions.svelte index 1ee3020f0e..dab8085cda 100644 --- a/src/frontend/src/lib/components/transactions/AllTransactions.svelte +++ b/src/frontend/src/lib/components/transactions/AllTransactions.svelte @@ -1,27 +1,16 @@
From 9166dcf3a3dfe937115a9ca532e9bc95ee69cbd7 Mon Sep 17 00:00:00 2001 From: AlessandroBonomo Date: Wed, 20 Nov 2024 15:27:29 +0100 Subject: [PATCH 08/14] adds new hide info key --- src/frontend/src/lib/utils/info.utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/lib/utils/info.utils.ts b/src/frontend/src/lib/utils/info.utils.ts index f2a79f8893..5031afc4ac 100644 --- a/src/frontend/src/lib/utils/info.utils.ts +++ b/src/frontend/src/lib/utils/info.utils.ts @@ -4,7 +4,8 @@ export type HideInfoKey = | 'oisy_ic_hide_bitcoin_info' | 'oisy_ic_hide_ethereum_info' | 'oisy_ic_hide_erc20_info' - | 'oisy_ic_hide_bitcoin_activity'; + | 'oisy_ic_hide_bitcoin_activity' + | 'oisy_ic_hide_incomplete_transaction_list'; export const saveHideInfo = (key: HideInfoKey) => { try { From e305432e65767907d4bff62ab7f84d8b2b1de94c Mon Sep 17 00:00:00 2001 From: AlessandroBonomo Date: Fri, 22 Nov 2024 08:26:29 +0100 Subject: [PATCH 09/14] implements review feedback --- .../transactions/AllTransactions.svelte | 10 ++++++++-- .../src/lib/derived/network-tokens.derived.ts | 17 ----------------- src/frontend/src/lib/i18n/en.json | 2 +- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/frontend/src/lib/components/transactions/AllTransactions.svelte b/src/frontend/src/lib/components/transactions/AllTransactions.svelte index ca3f3f4305..ce8628829c 100644 --- a/src/frontend/src/lib/components/transactions/AllTransactions.svelte +++ b/src/frontend/src/lib/components/transactions/AllTransactions.svelte @@ -3,12 +3,18 @@ import AllTransactionsList from '$lib/components/transactions/AllTransactionsList.svelte'; import MessageBox from '$lib/components/ui/MessageBox.svelte'; import PageTitle from '$lib/components/ui/PageTitle.svelte'; - import { enabledNetworkTokensWithoutIndexCanister } from '$lib/derived/network-tokens.derived'; + import { enabledNetworkTokens } from '$lib/derived/network-tokens.derived'; import { i18n } from '$lib/stores/i18n.store'; import { replacePlaceholders } from '$lib/utils/i18n.utils.js'; + import { icTransactionsStore } from '$icp/stores/ic-transactions.store'; + import { ethTransactionsStore } from '$eth/stores/eth-transactions.store'; + import { btcTransactionsStore } from '$btc/stores/btc-transactions.store'; let enabledTokensWithoutCanister: Token[]; - $: enabledTokensWithoutCanister = $enabledNetworkTokensWithoutIndexCanister; + $: enabledTokensWithoutCanister = $enabledNetworkTokens.filter((token: Token) => + $btcTransactionsStore?.[token.id] === null || + $ethTransactionsStore?.[token.id] === null || + $icTransactionsStore?.[token.id] === null); let tokenList: string; $: tokenList = enabledTokensWithoutCanister.map((token) => `$${token.symbol}`).join(', '); diff --git a/src/frontend/src/lib/derived/network-tokens.derived.ts b/src/frontend/src/lib/derived/network-tokens.derived.ts index 2a89873509..ea0e63bcfb 100644 --- a/src/frontend/src/lib/derived/network-tokens.derived.ts +++ b/src/frontend/src/lib/derived/network-tokens.derived.ts @@ -1,6 +1,3 @@ -import { btcTransactionsStore } from '$btc/stores/btc-transactions.store'; -import { ethTransactionsStore } from '$eth/stores/eth-transactions.store'; -import { icTransactionsStore } from '$icp/stores/ic-transactions.store'; import { exchanges } from '$lib/derived/exchange.derived'; import { pseudoNetworkChainFusion, selectedNetwork } from '$lib/derived/network.derived'; import { enabledTokens, tokensToPin } from '$lib/derived/tokens.derived'; @@ -39,17 +36,3 @@ export const combinedDerivedSortedNetworkTokensUi: Readable = derived $exchanges }) ); - -/** - * All user-enabled tokens matching the selected network or chain fusion that do not have an index canister. - */ -export const enabledNetworkTokensWithoutIndexCanister: Readable = derived( - [enabledNetworkTokens, btcTransactionsStore, ethTransactionsStore, icTransactionsStore], - ([$enabledNetworkTokens, $btcTransactionsStore, $ethTransactionsStore, $icTransactionsStore]) => - $enabledNetworkTokens.filter( - (token: Token) => - $btcTransactionsStore?.[token.id] === null || - $ethTransactionsStore?.[token.id] === null || - $icTransactionsStore?.[token.id] === null - ) -); diff --git a/src/frontend/src/lib/i18n/en.json b/src/frontend/src/lib/i18n/en.json index 09a37a2f00..47e2709de5 100644 --- a/src/frontend/src/lib/i18n/en.json +++ b/src/frontend/src/lib/i18n/en.json @@ -805,7 +805,7 @@ "btc_transactions": "BTC transaction information is obtained from central third parties and should be independently verified." }, "warning": { - "incomplete_transaction_list": "Transaction list is incomplete because $token_list don't have an index canister to provide transaction information." + "incomplete_transaction_list": "Transaction list is incomplete because $token_list don't have an Index canister to provide transaction information." } } } From 56c1d01e2769ca9e56f5a790a06193645a2a7a76 Mon Sep 17 00:00:00 2001 From: AlessandroBonomo Date: Fri, 22 Nov 2024 08:29:23 +0100 Subject: [PATCH 10/14] reformat code --- .../transactions/AllTransactions.svelte | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/frontend/src/lib/components/transactions/AllTransactions.svelte b/src/frontend/src/lib/components/transactions/AllTransactions.svelte index ce8628829c..bd7a94967a 100644 --- a/src/frontend/src/lib/components/transactions/AllTransactions.svelte +++ b/src/frontend/src/lib/components/transactions/AllTransactions.svelte @@ -1,20 +1,22 @@