From 297183366b06e739473a37aec560e01f0fbb5f54 Mon Sep 17 00:00:00 2001 From: Florian Bouron <bouron.florian@yahoo.fr> Date: Sun, 24 Nov 2024 16:58:47 +0100 Subject: [PATCH] Extract number count --- .../ImportSecretNumbers/ImportSecretNumbers.tsx | 6 +++--- .../ImportSecretNumbers/SecretNumbers/SecretNumbers.tsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/extension/src/components/pages/AddNewWallet/ImportNewWallet/ImportSecretNumbers/ImportSecretNumbers.tsx b/packages/extension/src/components/pages/AddNewWallet/ImportNewWallet/ImportSecretNumbers/ImportSecretNumbers.tsx index 4d4764dad..b5e2db590 100644 --- a/packages/extension/src/components/pages/AddNewWallet/ImportNewWallet/ImportSecretNumbers/ImportSecretNumbers.tsx +++ b/packages/extension/src/components/pages/AddNewWallet/ImportNewWallet/ImportSecretNumbers/ImportSecretNumbers.tsx @@ -10,8 +10,6 @@ import { PageWithStepper } from '../../../../templates'; import { ECDSA } from 'xrpl'; import { SecretNumberInput } from '../../../../atoms'; -const schemaInput = new RegExp(/^[0-9]{6}$/); - type InputErrors = { numbersA: string; numbersB: string; @@ -24,6 +22,8 @@ type InputErrors = { }; const DIGIT_ERROR = 'You need 6 digits'; +const NUMBERS_COUNT = 8; +const schemaInput = new RegExp(/^[0-9]{6}$/); export interface ImportSecretNumbersProps { activeStep: number; @@ -113,7 +113,7 @@ export const ImportSecretNumbers: FC<ImportSecretNumbersProps> = ({ Please enter your secret numbers in order to load your wallet to GemWallet. </Typography> <Grid container rowSpacing={0} columnSpacing={{ xs: 1, sm: 2, md: 3 }}> - {Array.from({ length: 8 }, (_, i) => { + {Array.from({ length: NUMBERS_COUNT }, (_, i) => { const id = `numbers${String.fromCharCode(65 + i)}` as keyof InputErrors; return ( <SecretNumberInput diff --git a/packages/extension/src/components/pages/ImportSecretNumbers/SecretNumbers/SecretNumbers.tsx b/packages/extension/src/components/pages/ImportSecretNumbers/SecretNumbers/SecretNumbers.tsx index ee7b5214c..0dfe15d11 100644 --- a/packages/extension/src/components/pages/ImportSecretNumbers/SecretNumbers/SecretNumbers.tsx +++ b/packages/extension/src/components/pages/ImportSecretNumbers/SecretNumbers/SecretNumbers.tsx @@ -9,8 +9,6 @@ import { PageWithStepper } from '../../../templates'; import { ECDSA } from 'xrpl'; import { SecretNumberInput } from '../../../atoms'; -const schemaInput = new RegExp(/^[0-9]{6}$/); - type InputErrors = { numbersA: string; numbersB: string; @@ -23,6 +21,8 @@ type InputErrors = { }; const DIGIT_ERROR = 'You need 6 digits'; +const NUMBERS_COUNT = 8; +const schemaInput = new RegExp(/^[0-9]{6}$/); export interface SecretNumbersProps { activeStep: number; @@ -101,7 +101,7 @@ export const SecretNumbers: FC<SecretNumbersProps> = ({ activeStep, steps, onBac Please enter your secret numbers in order to load your wallet to GemWallet. </Typography> <Grid container rowSpacing={0} columnSpacing={{ xs: 1, sm: 2, md: 3 }}> - {Array.from({ length: 8 }, (_, i) => { + {Array.from({ length: NUMBERS_COUNT }, (_, i) => { const id = `numbers${String.fromCharCode(65 + i)}` as keyof InputErrors; return ( <SecretNumberInput