From a6f9d78f560471e09bce9904312688cc982270b9 Mon Sep 17 00:00:00 2001 From: katspaugh Date: Wed, 26 Jul 2023 13:02:10 +0200 Subject: [PATCH] Disable batch button for multisends --- src/components/tx/ExecuteCheckbox/index.tsx | 41 ++++++++----------- .../tx/SignOrExecuteForm/BatchButton.tsx | 30 ++++++++++---- .../tx/SignOrExecuteForm/SignForm.tsx | 9 +++- src/components/tx/SignOrExecuteForm/index.tsx | 4 +- 4 files changed, 49 insertions(+), 35 deletions(-) diff --git a/src/components/tx/ExecuteCheckbox/index.tsx b/src/components/tx/ExecuteCheckbox/index.tsx index b8b59250e2..43e1ad6720 100644 --- a/src/components/tx/ExecuteCheckbox/index.tsx +++ b/src/components/tx/ExecuteCheckbox/index.tsx @@ -1,5 +1,5 @@ import type { ChangeEvent, ReactElement } from 'react' -import { FormControlLabel, RadioGroup, Radio } from '@mui/material' +import { FormControlLabel, RadioGroup, Radio, Typography } from '@mui/material' import { trackEvent, MODALS_EVENTS } from '@/services/analytics' import { useAppDispatch, useAppSelector } from '@/store' import { selectSettings, setTransactionExecution } from '@/store/settingsSlice' @@ -18,28 +18,23 @@ const ExecuteCheckbox = ({ onChange }: { onChange: (checked: boolean) => void }) } return ( - - - Yes, execute - - } - control={} - className={css.radio} - /> - - No, only sign - - } - control={} - className={css.radio} - /> - + <> + Would you like to execute the transaction immediately? + + + + Yes, execute + + } + control={} + className={css.radio} + /> + No, later} control={} className={css.radio} /> + + ) } diff --git a/src/components/tx/SignOrExecuteForm/BatchButton.tsx b/src/components/tx/SignOrExecuteForm/BatchButton.tsx index 21fa5b2c0c..fee213c794 100644 --- a/src/components/tx/SignOrExecuteForm/BatchButton.tsx +++ b/src/components/tx/SignOrExecuteForm/BatchButton.tsx @@ -1,19 +1,31 @@ import { type SyntheticEvent } from 'react' -import { Box, Button, SvgIcon } from '@mui/material' +import { Box, Button, SvgIcon, Tooltip } from '@mui/material' import PlusIcon from '@/public/images/common/plus.svg' import Track from '@/components/common/Track' import { BATCH_EVENTS } from '@/services/analytics' -const BatchButton = ({ onClick, disabled }: { onClick: (e: SyntheticEvent) => void; disabled?: boolean }) => ( +const BatchButton = ({ + onClick, + disabled, + tooltip, +}: { + onClick: (e: SyntheticEvent) => void + disabled?: boolean + tooltip?: string +}) => ( <> - - - - + + + + + + + + {' '} or diff --git a/src/components/tx/SignOrExecuteForm/SignForm.tsx b/src/components/tx/SignOrExecuteForm/SignForm.tsx index 249e453f6f..34686bc4c9 100644 --- a/src/components/tx/SignOrExecuteForm/SignForm.tsx +++ b/src/components/tx/SignOrExecuteForm/SignForm.tsx @@ -22,6 +22,7 @@ const SignForm = ({ disableSubmit = false, origin, isBatch, + isMultisend, }: SignOrExecuteProps & { safeTx?: SafeTransaction }): ReactElement => { @@ -86,7 +87,13 @@ const SignForm = ({ {/* Batch button */} - {isCreation && !isBatch && } + {isCreation && !isBatch && ( + + )} {/* Submit button */} diff --git a/src/components/tx/SignOrExecuteForm/index.tsx b/src/components/tx/SignOrExecuteForm/index.tsx index def22cee34..59f68fc0fd 100644 --- a/src/components/tx/SignOrExecuteForm/index.tsx +++ b/src/components/tx/SignOrExecuteForm/index.tsx @@ -26,6 +26,7 @@ export type SignOrExecuteProps = { isExecutable?: boolean isRejection?: boolean isBatch?: boolean + isMultisend?: boolean onlyExecute?: boolean disableSubmit?: boolean origin?: string @@ -39,7 +40,6 @@ const SignOrExecuteForm = (props: SignOrExecuteProps): ReactElement => { const isNewExecutableTx = useImmediatelyExecutable() && isCreation const isCorrectNonce = useValidateNonce(safeTx) const [decodedData, decodedDataError, decodedDataLoading] = useDecodeTx(safeTx) - const isBatch = props.isBatch || isMultisendTx(decodedData) // If checkbox is checked and the transaction is executable, execute it, otherwise sign it const canExecute = isCorrectNonce && (props.isExecutable || isNewExecutableTx) @@ -93,7 +93,7 @@ const SignOrExecuteForm = (props: SignOrExecuteProps): ReactElement => { {willExecute ? ( ) : ( - + )}