From 2bee2bd6ee9542c3736acc1a56e0b324f6af8666 Mon Sep 17 00:00:00 2001 From: babamovandrej Date: Wed, 8 Jan 2025 16:46:50 +0100 Subject: [PATCH] Fix deposit button state in swap input card --- .../pool/PoolCard/SwapButton/SwapButton.tsx | 12 ++++++++++-- src/components/pool/PoolCard/SwapButton/types.ts | 1 + src/components/pool/PoolCard/SwapInput/SwapInput.tsx | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/pool/PoolCard/SwapButton/SwapButton.tsx b/src/components/pool/PoolCard/SwapButton/SwapButton.tsx index 071b95c2..aa00663c 100644 --- a/src/components/pool/PoolCard/SwapButton/SwapButton.tsx +++ b/src/components/pool/PoolCard/SwapButton/SwapButton.tsx @@ -3,14 +3,22 @@ import { useAppKit } from '@reown/appkit/react' import { useAccount } from 'wagmi' import { Button } from '../../../buttons/Button/Button' -export const SwapButton = ({ error, onClick, isLoading, isDeposit }: SwapButtonProps) => { +export const SwapButton = ({ onClick, isLoading, isDeposit, isDepositDisabled }: SwapButtonProps) => { const { isConnected } = useAccount() const { open } = useAppKit() const actionText: string = isDeposit ? 'Request Deposit' : 'Request Withdrawal' + const isDisabled: boolean = (isDeposit && isDepositDisabled) || !isConnected return ( - ) diff --git a/src/components/pool/PoolCard/SwapButton/types.ts b/src/components/pool/PoolCard/SwapButton/types.ts index db31daad..d9cc8b8c 100644 --- a/src/components/pool/PoolCard/SwapButton/types.ts +++ b/src/components/pool/PoolCard/SwapButton/types.ts @@ -3,6 +3,7 @@ import { type ErrorType } from './constants' export interface SwapButtonProps { isLoading: boolean + isDepositDisabled: boolean error: ErrorType | null onClick: (e: React.MouseEvent) => void isDeposit: boolean diff --git a/src/components/pool/PoolCard/SwapInput/SwapInput.tsx b/src/components/pool/PoolCard/SwapInput/SwapInput.tsx index 45e713d8..99cd55cc 100644 --- a/src/components/pool/PoolCard/SwapInput/SwapInput.tsx +++ b/src/components/pool/PoolCard/SwapInput/SwapInput.tsx @@ -72,6 +72,7 @@ export const SwapInput = ({ swapState, swapDispatch, onClose }: SwapInputProps)