From 0b4e528fec659c4e0489735fdc6a0fa6f3a17eb1 Mon Sep 17 00:00:00 2001 From: pedromcunha Date: Mon, 25 Nov 2024 17:47:20 -0500 Subject: [PATCH] Fix bugs with wallet connection ux --- .../components/common/MultiWalletDropdown.tsx | 2 +- .../ui/src/components/widgets/SwapButton.tsx | 26 ++++++----- .../components/widgets/SwapWidget/index.tsx | 45 +++++++++---------- .../components/widgets/SwapWidgetRenderer.tsx | 20 ++++++--- 4 files changed, 50 insertions(+), 43 deletions(-) diff --git a/packages/ui/src/components/common/MultiWalletDropdown.tsx b/packages/ui/src/components/common/MultiWalletDropdown.tsx index 464de861..6aefa899 100644 --- a/packages/ui/src/components/common/MultiWalletDropdown.tsx +++ b/packages/ui/src/components/common/MultiWalletDropdown.tsx @@ -15,7 +15,7 @@ import { ProviderOptionsContext } from '../../providers/RelayKitProvider.js' type MultiWalletDropdownProps = { context: 'origin' | 'destination' wallets: LinkedWallet[] - selectedWalletAddress: string + selectedWalletAddress?: string chain?: RelayChain onSelect: (wallet: LinkedWallet) => void onLinkNewWallet: () => void diff --git a/packages/ui/src/components/widgets/SwapButton.tsx b/packages/ui/src/components/widgets/SwapButton.tsx index 06136a17..f21d5268 100644 --- a/packages/ui/src/components/widgets/SwapButton.tsx +++ b/packages/ui/src/components/widgets/SwapButton.tsx @@ -6,6 +6,7 @@ import { EventNames } from '../../constants/events.js' type SwapButtonProps = { transactionModalOpen: boolean + depositAddressModalOpen: boolean onConnectWallet?: () => void onAnalyticEvent?: (eventName: string, data?: any) => void onClick: () => void @@ -28,6 +29,7 @@ type SwapButtonProps = { const SwapButton: FC = ({ transactionModalOpen, + depositAddressModalOpen, isValidFromAddress, isValidToAddress, context, @@ -48,21 +50,25 @@ const SwapButton: FC = ({ const isMounted = useMounted() if (isMounted && (address || !fromChainWalletVMSupported)) { + const invalidAmount = + !price || + Number(debouncedInputAmountValue) === 0 || + Number(debouncedOutputAmountValue) === 0 + return (