diff --git a/src/components/Forms/TokenAmountForm.tsx b/src/components/Forms/TokenAmountForm.tsx index 4b5e24dbe..bcc8a9404 100644 --- a/src/components/Forms/TokenAmountForm.tsx +++ b/src/components/Forms/TokenAmountForm.tsx @@ -25,7 +25,6 @@ export type TokenAmountFormBaseProps = { isDisabled?: boolean shouldValidateForm?: boolean shouldDisplayMaxAmountInLabel?: boolean - shouldDisableButton?: boolean token?: { decimals: number; symbol: string } placeholder?: string minTokenAmount?: string | number @@ -44,7 +43,6 @@ export const TokenAmountFormBase: FC< isDisabled = false, shouldValidateForm = true, shouldDisplayMaxAmountInLabel = false, - shouldDisableButton = true, placeholder, submitButtonVariant = "solid", ...formikProps @@ -81,7 +79,7 @@ export const TokenAmountFormBase: FC< mt="6" submitText={submitButtonText} variant={submitButtonVariant} - isDisabled={shouldDisableButton && isDisabled} + isDisabled={isDisabled} /> ) diff --git a/src/components/StakingApplicationForms/index.tsx b/src/components/StakingApplicationForms/index.tsx index 0e933f610..0b45eebbe 100644 --- a/src/components/StakingApplicationForms/index.tsx +++ b/src/components/StakingApplicationForms/index.tsx @@ -4,7 +4,7 @@ import { FormikErrors, FormikProps, withFormik } from "formik" import { FC, Ref, useEffect, useState } from "react" import { formatTokenAmount } from "../../utils/formatAmount" import { - defaultStakingLessThanMessage, + defaultLessThanMessage, defaultAmountValidationOptions, DEFAULT_MIN_VALUE, getErrorsObj, @@ -150,7 +150,7 @@ const deauthorizationValidation = ( { ...defaultAmountValidationOptions, lessThanValidationMessage(amount) { - return `${defaultStakingLessThanMessage( + return `${defaultLessThanMessage( amount )} or equal to ${formatTokenAmount(authorizedAmount.toString())} T` }, diff --git a/src/components/SubmitTxButton.tsx b/src/components/SubmitTxButton.tsx index 5214d511f..2d0c5e558 100644 --- a/src/components/SubmitTxButton.tsx +++ b/src/components/SubmitTxButton.tsx @@ -32,6 +32,7 @@ const SubmitTxButton: FC = ({ onClick={() => openModal(ModalType.SelectWallet)} {...buttonProps} type="button" + isDisabled={false} > Connect Wallet diff --git a/src/pages/Staking/NewStakeCard.tsx b/src/pages/Staking/NewStakeCard.tsx index ed6ea8402..41079048d 100644 --- a/src/pages/Staking/NewStakeCard.tsx +++ b/src/pages/Staking/NewStakeCard.tsx @@ -13,7 +13,7 @@ const NewStakeCard: FC> = () => { const { openModal } = useModal() const tBalance = useTokenBalance(Token.T) const { minStakeAmount, isLoading, hasError } = useMinStakeAmount() - const { active: isWalletConnected } = useWeb3React() + const { active } = useWeb3React() const openStakingModal = async (stakeAmount: string) => { openModal(ModalType.StakingChecklist, { stakeAmount }) @@ -41,8 +41,7 @@ const NewStakeCard: FC> = () => { maxTokenAmount={tBalance} placeholder={placeholder} minTokenAmount={minStakeAmount} - shouldDisableButton={false} - isDisabled={!isWalletConnected} + isDisabled={!active} /> diff --git a/src/utils/forms.ts b/src/utils/forms.ts index ae1d395b5..c607616ed 100644 --- a/src/utils/forms.ts +++ b/src/utils/forms.ts @@ -19,21 +19,25 @@ type AmountValidationOptions = { } export const DEFAULT_MIN_VALUE = WeiPerEther.toString() -export const defaultStakingLessThanMessage: (maxAmount: string) => string = ( +export const defaultLessThanMessage: (maxAmount: string) => string = ( maxAmount ) => { - return `The maximum stake amount is ${formatTokenAmount(maxAmount)}.` + return `The value should be less than or equal ${formatTokenAmount( + maxAmount + )}` } -export const defaultStakingGreaterThanMessage: (minAmount: string) => string = ( +export const defaultGreaterThanMessage: (minAmount: string) => string = ( minAmount ) => { - return `The minimum stake amount is ${formatTokenAmount(minAmount)}.` + return `The value should be greater than or equal ${formatTokenAmount( + minAmount + )}` } export const defaultAmountValidationOptions: AmountValidationOptions = { - greaterThanValidationMessage: defaultStakingGreaterThanMessage, - lessThanValidationMessage: defaultStakingLessThanMessage, - requiredMessage: "The stake amount is required.", + greaterThanValidationMessage: defaultGreaterThanMessage, + lessThanValidationMessage: defaultLessThanMessage, + requiredMessage: "Required.", insufficientBalanceMessage: "Your wallet balance is insufficient.", }