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

fix(bridge-ui-v2): update InsufficientFunds dialog in mobile view #14753

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
</div>
</h4>
<div class="f-items-center space-x-1">
<Status bridgeTx={selectedItem} />
<Status bridgeTx={selectedItem} isFromMobileDetailsDialog={true}/>
</div>
</li>
<li class="f-between-center">
Expand Down
10 changes: 9 additions & 1 deletion packages/bridge-ui-v2/src/components/Transactions/Status.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import { parseEther, UserRejectedRequestError } from 'viem';

import { chainConfig } from '$chainConfig';
import { DesktopOrLarger } from '$components/DesktopOrLarger';
import {
errorToast,
infoToast,
Expand Down Expand Up @@ -36,13 +37,16 @@
const log = getLogger('components:Status');

export let bridgeTx: BridgeTransaction;
export let isFromMobileDetailsDialog: boolean;

let polling: ReturnType<typeof startPolling>;

// UI state
let processable = false; // bridge tx state to be processed: claimed/retried/released
let bridgeTxStatus: Maybe<MessageStatus>;

let isDesktopOrLarger = false;

let modalOpen = false;

// TODO: enum?
Expand Down Expand Up @@ -140,7 +144,9 @@
warningToast($t('transactions.actions.claim.rejected'));
break;
case err instanceof InsufficientBalanceError:
modalOpen = true;
if (isDesktopOrLarger || isFromMobileDetailsDialog) {
modalOpen = true;
}
break;
case err instanceof InvalidProofError:
errorToast($t('TODO: InvalidProofError'));
Expand Down Expand Up @@ -295,3 +301,5 @@
</div>

<InsufficientFunds bind:modalOpen />

<DesktopOrLarger bind:is={isDesktopOrLarger} />
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
{/if}

<div class="sm:w-1/4 md:w-1/5 py-2 flex flex-col justify-center">
<Status bridgeTx={item} />
<Status bridgeTx={item} isFromMobileDetailsDialog={false}/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A component should be agnostic to where it is used, so if you pass properties they should not be required to be set to false like this. You can do that logic inside the component itself.

Generally, we need to rework the way we claim on mobile, it opens the dialog and then instantly tries to claim. That is not how it should work.
Maybe just close this PR, as this is a hacky workaround instead of a proper fix for the underlying problem. I will work on it.

</div>
<div class="hidden md:flex w-1/5 py-2 flex flex-col justify-center">
<a
Expand Down