From fac2869757d6f7168b0878f9654b5a1514560540 Mon Sep 17 00:00:00 2001 From: Korbinian Kasberger Date: Tue, 19 Sep 2023 20:29:29 +0200 Subject: [PATCH 1/5] add dialog --- .../Transactions/InsufficientFunds.svelte | 68 +++++++++++++++++++ .../src/components/Transactions/Status.svelte | 7 +- packages/bridge-ui-v2/src/i18n/en.json | 8 ++- 3 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 packages/bridge-ui-v2/src/components/Transactions/InsufficientFunds.svelte diff --git a/packages/bridge-ui-v2/src/components/Transactions/InsufficientFunds.svelte b/packages/bridge-ui-v2/src/components/Transactions/InsufficientFunds.svelte new file mode 100644 index 00000000000..1e401ddced2 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Transactions/InsufficientFunds.svelte @@ -0,0 +1,68 @@ + + + + + diff --git a/packages/bridge-ui-v2/src/components/Transactions/Status.svelte b/packages/bridge-ui-v2/src/components/Transactions/Status.svelte index fa60111f37d..26a19f1b9f1 100644 --- a/packages/bridge-ui-v2/src/components/Transactions/Status.svelte +++ b/packages/bridge-ui-v2/src/components/Transactions/Status.svelte @@ -30,6 +30,7 @@ import { account } from '$stores/account'; import { network } from '$stores/network'; import { pendingTransactions } from '$stores/pendingTransactions'; + import InsufficientFunds from './InsufficientFunds.svelte'; const log = getLogger('components:Status'); @@ -41,6 +42,8 @@ let processable = false; // bridge tx state to be processed: claimed/retried/released let bridgeTxStatus: Maybe; + let modalOpen = false; + // TODO: enum? let loading: 'claiming' | 'releasing' | false = false; @@ -136,7 +139,7 @@ warningToast($t('transactions.actions.claim.rejected')); break; case err instanceof InsufficientBalanceError: - errorToast($t('transactions.errors.insufficient_balance')); + modalOpen = true; break; case err instanceof InvalidProofError: errorToast($t('TODO: InvalidProofError')); @@ -289,3 +292,5 @@ {$t('transactions.status.error.name')} {/if} + + diff --git a/packages/bridge-ui-v2/src/i18n/en.json b/packages/bridge-ui-v2/src/i18n/en.json index e3988dc954a..d0c0b96b5e5 100644 --- a/packages/bridge-ui-v2/src/i18n/en.json +++ b/packages/bridge-ui-v2/src/i18n/en.json @@ -141,7 +141,11 @@ "claim": { "tx": "Transaction sent to claim {token} tokens. Click here to see it in the explorer.", "success": "Transaction completed! Your funds have been successfully claimed on {network}.", - "rejected": "Request to claim rejected." + "rejected": "Request to claim rejected.", + "dialog": { + "title": "Please wait", + "description": "Insufficient balance to claim yourself. Please wait for the relayer to claim for you automatically. Refer to our guide for more information." + } }, "release": { "tx": "Transaction sent to release {token} tokens. Click here to see it in the explorer.", @@ -150,7 +154,7 @@ } }, "errors": { - "insufficient_balance": "Insufficient balance to claim. Please add some ETH to your wallet.", + "insufficient_balance": "Insufficient balance to claim yourself. Please wait for the relayer to claim for you automatically. Refer to our guide for more information.", "relayer_offline": "Relayer did not respond. Your transactions may only be loaded partially." } }, From 984ee896d905a2235718944b1c12b6d3367430d8 Mon Sep 17 00:00:00 2001 From: Korbinian Kasberger Date: Tue, 19 Sep 2023 20:57:26 +0200 Subject: [PATCH 2/5] add link --- .../Transactions/InsufficientFunds.svelte | 20 ++++++++++--------- packages/bridge-ui-v2/src/i18n/en.json | 3 ++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/bridge-ui-v2/src/components/Transactions/InsufficientFunds.svelte b/packages/bridge-ui-v2/src/components/Transactions/InsufficientFunds.svelte index 1e401ddced2..f19a30ba294 100644 --- a/packages/bridge-ui-v2/src/components/Transactions/InsufficientFunds.svelte +++ b/packages/bridge-ui-v2/src/components/Transactions/InsufficientFunds.svelte @@ -7,9 +7,10 @@ import { PUBLIC_GUIDE_URL } from '$env/static/public'; import { uid } from '$libs/util/uid'; - let dialogId = `dialog-${uid()}`; export let modalOpen = false; + let dialogId = `dialog-${uid()}`; + function closeModal() { removeEscKeyListener(); modalOpen = false; @@ -48,14 +49,15 @@

{$t('transactions.actions.claim.dialog.title')}

-

- {@html $t('transactions.actions.claim.dialog.description', { - values: { - classes: 'link', - url: PUBLIC_GUIDE_URL, - }, - })} -

+
+
+ {$t('transactions.actions.claim.dialog.description')} +
+ + {$t('transactions.actions.claim.dialog.link')} + +
+
- +
  • diff --git a/packages/bridge-ui-v2/src/components/Transactions/Status.svelte b/packages/bridge-ui-v2/src/components/Transactions/Status.svelte index 8b5e370c9c7..5b1425ad826 100644 --- a/packages/bridge-ui-v2/src/components/Transactions/Status.svelte +++ b/packages/bridge-ui-v2/src/components/Transactions/Status.svelte @@ -1,6 +1,6 @@ @@ -65,7 +89,11 @@ {/if}
    - + +
    + + + + + diff --git a/packages/bridge-ui-v2/src/components/Transactions/Transactions.svelte b/packages/bridge-ui-v2/src/components/Transactions/Transactions.svelte index 6f91ca3a9fb..b3b121a508b 100644 --- a/packages/bridge-ui-v2/src/components/Transactions/Transactions.svelte +++ b/packages/bridge-ui-v2/src/components/Transactions/Transactions.svelte @@ -15,7 +15,6 @@ import { account, network } from '$stores'; import type { Account } from '$stores/account'; - import MobileDetailsDialog from './MobileDetailsDialog.svelte'; import StatusInfoDialog from './StatusInfoDialog.svelte'; import Transaction from './Transaction.svelte'; @@ -31,11 +30,8 @@ let loadingTxs = false; - let detailsOpen = false; let isDesktopOrLarger: boolean; - let selectedItem: BridgeTransaction | null = null; - const handlePageChange = (detail: number) => { isBlurred = true; setTimeout(() => { @@ -67,16 +63,6 @@ } }; - const closeDetails = () => { - detailsOpen = false; - selectedItem = null; - }; - - const openDetails = (tx: BridgeTransaction) => { - detailsOpen = true; - selectedItem = tx; - }; - const updateTransactions = async (address: Address) => { const { mergedTransactions, outdatedLocalTransactions, error } = await fetchTransactions(address); transactions = mergedTransactions; @@ -136,7 +122,7 @@ class="flex flex-col items-center" style={isBlurred ? `filter: blur(5px); transition: filter ${transitionTime / 1000}s ease-in-out` : ''}> {#each transactionsToShow as item (item.hash)} - openDetails(item)} /> +
    {/each}
    @@ -156,8 +142,6 @@ - - diff --git a/packages/bridge-ui-v2/src/i18n/en.json b/packages/bridge-ui-v2/src/i18n/en.json index a5943f0201f..0c569706904 100644 --- a/packages/bridge-ui-v2/src/i18n/en.json +++ b/packages/bridge-ui-v2/src/i18n/en.json @@ -102,9 +102,9 @@ "release": "Release" }, "status": { - "initiated": { - "name": "Initiated", - "description": "Transaction initiated" + "processing": { + "name": "Processing", + "description": "Transaction is processing. Depending on the pending blocks to be verified this can take up to several minutes." }, "pending": { "name": "Pending", From 7fba83d8fcbebaa4ac5c6e84a237451477ec2234 Mon Sep 17 00:00:00 2001 From: Korbinian Kasberger Date: Wed, 20 Sep 2023 12:44:39 +0200 Subject: [PATCH 5/5] cleanup --- .../src/components/Transactions/Transaction.svelte | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/bridge-ui-v2/src/components/Transactions/Transaction.svelte b/packages/bridge-ui-v2/src/components/Transactions/Transaction.svelte index 9e316003b16..18c0fc15209 100644 --- a/packages/bridge-ui-v2/src/components/Transactions/Transaction.svelte +++ b/packages/bridge-ui-v2/src/components/Transactions/Transaction.svelte @@ -21,16 +21,12 @@ let isDesktopOrLarger = false; const handleClick = () => { - if (item?.status === MessageStatus.DONE) { - openDetails(); - } + openDetails(); dispatch('click'); }; const handlePress = () => { - if (item?.status === MessageStatus.DONE) { - openDetails(); - } + openDetails(); dispatch('press'); }; @@ -39,7 +35,9 @@ }; const openDetails = () => { - detailsOpen = true; + if (item?.status === MessageStatus.DONE && !isDesktopOrLarger) { + detailsOpen = true; + } }; const handleInsufficientFunds = () => {