From dc96a374036627f3adbf3b1d6e31121b5960dd7d Mon Sep 17 00:00:00 2001 From: Jaco Date: Fri, 20 Jan 2023 07:44:16 +0200 Subject: [PATCH] Small batch submit adjustments (#8850) --- packages/react-components/src/Table/Body.tsx | 8 ++--- packages/react-components/src/Table/index.tsx | 30 +++++----------- packages/react-signer/src/TxSigned.tsx | 35 ++++++++++--------- 3 files changed, 29 insertions(+), 44 deletions(-) diff --git a/packages/react-components/src/Table/Body.tsx b/packages/react-components/src/Table/Body.tsx index 036681855f..8879e36b00 100644 --- a/packages/react-components/src/Table/Body.tsx +++ b/packages/react-components/src/Table/Body.tsx @@ -31,11 +31,9 @@ function Body ({ children, className = '', empty, emptySpinner, isEmpty, noBodyT ) - : ( - noBodyTag - ? <>{children} - : {children} - ); + : noBodyTag + ? <>{children} + : {children}; } export default React.memo(Body); diff --git a/packages/react-components/src/Table/index.tsx b/packages/react-components/src/Table/index.tsx index e3cc4fd8a4..f3fad39a11 100644 --- a/packages/react-components/src/Table/index.tsx +++ b/packages/react-components/src/Table/index.tsx @@ -29,24 +29,6 @@ interface Props { noBodyTag?: boolean; } -interface ColumnProps { - children: React.ReactNode[]; - className?: string; - numColumns: number; -} - -function Split ({ children, className = '', numColumns }: ColumnProps): React.ReactElement { - return ( -
- - - {children} - -
-
- ); -} - function TableBase ({ children, className = '', empty, emptySpinner, filter, footer, header, headerChildren, isFixed, isInline, isSplit, legend, maxColumns, noBodyTag }: Props): React.ReactElement { const numColumns = useWindowColumns(maxColumns); const isArray = Array.isArray(children); @@ -71,12 +53,16 @@ function TableBase ({ children, className = '', empty, emptySpinner, filter, foo
{(numColumns === 2 ? [0, 1] : [0, 1, 2]).map((column) => ( - - {children.filter((_, i) => (i % numColumns) === column)} - + + + {children.filter((_, i) => (i % numColumns) === column)} + +
+
))} diff --git a/packages/react-signer/src/TxSigned.tsx b/packages/react-signer/src/TxSigned.tsx index c296bc63cd..b4520ce127 100644 --- a/packages/react-signer/src/TxSigned.tsx +++ b/packages/react-signer/src/TxSigned.tsx @@ -348,9 +348,10 @@ function TxSigned ({ className, currentItem, isQueueSubmit, queueSize, requestAd [_onSend, _onSendPayload, _onSign, _unlock, currentItem, isSubmit, queueSetTxStatus, senderInfo] ); - const isAutoCapable = senderInfo.signAddress && (queueSize > 1) && isSubmit && !isBusy && !(flags.isHardware || flags.isMultisig || flags.isProxied || flags.isQr || flags.isUnlockable) && !isRenderError; + const isAutoCapable = senderInfo.signAddress && (queueSize > 1) && isSubmit && !(flags.isHardware || flags.isMultisig || flags.isProxied || flags.isQr || flags.isUnlockable) && !isRenderError; - if (isAutoCapable && initialIsQueueSubmit) { + if (!isBusy && isAutoCapable && initialIsQueueSubmit) { + setBusy(true); setTimeout(_doStart, 1000); return null; @@ -443,8 +444,8 @@ function TxSigned ({ className, currentItem, isQueueSubmit, queueSize, requestAd onClick={_doStart} tabIndex={2} /> - {!isBusy && ( -
+
+ {!isBusy && ( - {isAutoCapable && ( - ('Submit {{queueSize}} items', { replace: { queueSize } }) - : t('Submit individual') - } - onChange={setIsQueueSubmit} - value={isQueueSubmit} - /> - )} -
- )} + )} + {isAutoCapable && ( + ('Submit {{queueSize}} items', { replace: { queueSize } }) + : t('Submit individual') + } + onChange={setIsQueueSubmit} + value={isQueueSubmit} + /> + )} +
);