diff --git a/src/components/common/approval/ApproveToken.tsx b/src/components/common/approval/ApproveToken.tsx index 88410f6f5..e1852e136 100644 --- a/src/components/common/approval/ApproveToken.tsx +++ b/src/components/common/approval/ApproveToken.tsx @@ -1,4 +1,4 @@ -import { FC, useState } from 'react'; +import { FC, FormEvent, useId, useState } from 'react'; import { useSetUserApproval } from 'libs/queries/chain/approval'; import { Button } from 'components/common/button'; import { Switch } from 'components/common/switch'; @@ -32,6 +32,7 @@ export const ApproveToken: FC = ({ eventData, context, }) => { + const inputId = useId(); const { dispatchNotification } = useNotifications(); const { user } = useWeb3(); const { getTokenById } = useTokens(); @@ -42,7 +43,8 @@ export const ApproveToken: FC = ({ const [txBusy, setTxBusy] = useState(false); const [txSuccess, setTxSuccess] = useState(false); - const onApprove = async () => { + const onApprove = async (e: FormEvent) => { + e.preventDefault(); if (!data || !token) { return console.error('No data loaded'); } @@ -166,46 +168,47 @@ export const ApproveToken: FC = ({ return ( <>
-
-
- -
{token.symbol}
-
+
+ +

{token.symbol}

{data.approvalRequired ? ( txBusy ? (
Waiting for Confirmation
) : ( -
-
-
-
- Unlimited -
- -
+
+
+ +
-
+ ) ) : ( diff --git a/src/components/common/switch/index.tsx b/src/components/common/switch/index.tsx index ebb458195..15cdd6162 100644 --- a/src/components/common/switch/index.tsx +++ b/src/components/common/switch/index.tsx @@ -21,22 +21,36 @@ export const Switch: FC = ({ className, isOn, setIsOn, + id, ...props }) => { return ( -
setIsOn(!isOn)} - {...props} - > - -
+ <> +
+ setIsOn(e.target.checked)} + /> + +
+ ); }; diff --git a/src/components/strategies/edit/EditStrategyAllocatedBudget.tsx b/src/components/strategies/edit/EditStrategyAllocatedBudget.tsx index 4d7a562a0..8d15b90fa 100644 --- a/src/components/strategies/edit/EditStrategyAllocatedBudget.tsx +++ b/src/components/strategies/edit/EditStrategyAllocatedBudget.tsx @@ -1,4 +1,4 @@ -import { FC, ReactNode } from 'react'; +import { FC, ReactNode, useId } from 'react'; import { MarginalPriceOptions } from '@bancor/carbon-sdk/strategy-management'; import { Token } from 'libs/tokens'; import { Tooltip } from 'components/common/tooltip/Tooltip'; @@ -74,12 +74,15 @@ interface BudgetDistributionProps { onChange: (marginalPrice: MarginalPriceOptions) => void; } export const EditBudgetDistribution: FC = (props) => { + const id = useId(); const { order, onChange } = props; const checked = order.marginalPrice !== MarginalPriceOptions.maintain; return (

- Distribute Across Entire Range + = (props) => { />