-
Notifications
You must be signed in to change notification settings - Fork 3
[READY] Disable submit button when the quote is outdated #613
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
Changes from all commits
afc999e
bf1e8fa
6471656
700e879
f38ff31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,7 @@ import { useInputAmount, useOnChainToken, useFiatToken } from '../../../stores/r | |||||
| import { RampFeeCollapse } from '../../RampFeeCollapse'; | ||||||
| import { RampSubmitButtons } from '../../RampSubmitButtons'; | ||||||
| import { useInitializeFailedMessage } from '../../../stores/rampStore'; | ||||||
| import { useQuoteLoading } from '../../../stores/ramp/useQuoteStore'; | ||||||
|
|
||||||
| export const Onramp = () => { | ||||||
| const { t } = useTranslation(); | ||||||
|
|
@@ -33,6 +34,7 @@ export const Onramp = () => { | |||||
| const inputAmount = useInputAmount(); | ||||||
| const onChainToken = useOnChainToken(); | ||||||
| const fiatToken = useFiatToken(); | ||||||
| const quoteLoading = useQuoteLoading(); | ||||||
|
|
||||||
| const debouncedInputAmount = useDebouncedValue(inputAmount, 1000); | ||||||
|
|
||||||
|
|
@@ -95,12 +97,13 @@ export const Onramp = () => { | |||||
| tokenSymbol={toToken.assetSymbol} | ||||||
| onClick={() => openTokenSelectModal('to')} | ||||||
| registerInput={form.register('outputAmount')} | ||||||
| loading={quoteLoading} | ||||||
| disabled={!toAmount} | ||||||
| readOnly={true} | ||||||
| id="outputAmount" | ||||||
| /> | ||||||
| ), | ||||||
| [toToken, form, toAmount, openTokenSelectModal], | ||||||
| [toToken.networkAssetIcon, toToken.assetSymbol, form, quoteLoading, toAmount, openTokenSelectModal], | ||||||
|
||||||
| [toToken.networkAssetIcon, toToken.assetSymbol, form, quoteLoading, toAmount, openTokenSelectModal], | |
| [toToken, form, quoteLoading, toAmount, openTokenSelectModal], |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,8 @@ import { useRampDirection } from '../../stores/rampDirectionStore'; | |||||||
| import { RampDirection } from '../RampToggle'; | ||||||||
| import { useTranslation } from 'react-i18next'; | ||||||||
| import { useWidgetMode } from '../../hooks/useWidgetMode'; | ||||||||
| import { useQuoteStore } from '../../stores/ramp/useQuoteStore'; | ||||||||
|
|
||||||||
|
|
||||||||
| interface RampSubmitButtonsProps { | ||||||||
| toAmount?: Big; | ||||||||
|
|
@@ -24,12 +26,16 @@ export const RampSubmitButtons: FC<RampSubmitButtonsProps> = ({ toAmount }) => { | |||||||
| const executionInput = useRampExecutionInput() | ||||||||
| const initializeFailedMessage = useInitializeFailedMessage(); | ||||||||
| const isRampSummaryDialogVisible = useRampSummaryVisible(); | ||||||||
| const inputAmount = useInputAmount(); | ||||||||
| const fiatToken = useFiatToken(); | ||||||||
| const onChainToken = useOnChainToken(); | ||||||||
| const rampDirection = useRampDirection(); | ||||||||
| const isWidgetMode = useWidgetMode(); | ||||||||
|
|
||||||||
|
|
||||||||
| const inputAmount = useInputAmount(); | ||||||||
| const { quote } = useQuoteStore(); | ||||||||
| const quoteInputAmount = quote?.inputAmount; | ||||||||
|
|
||||||||
| const handleCompareFeesClick = useCallback( | ||||||||
| (e: React.MouseEvent) => { | ||||||||
| e.preventDefault(); | ||||||||
|
|
@@ -55,8 +61,9 @@ export const RampSubmitButtons: FC<RampSubmitButtonsProps> = ({ toAmount }) => { | |||||||
| return t('components.swapSubmitButton.confirm'); | ||||||||
| }; | ||||||||
|
|
||||||||
|
||||||||
| // Use Big.js for equality comparison to ensure precise comparison of arbitrary-precision decimal numbers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double-check that the dependency array correctly reflects all necessary changes; explicitly listing properties like fiat.assetIcon and fiat.symbol should be intentional to avoid unwanted re-renders if related properties of 'toToken.fiat' change.