From c2192fc86e181d1ea97a76f7687148061eeefe1e Mon Sep 17 00:00:00 2001 From: mannynotfound Date: Mon, 3 Oct 2022 10:04:18 -0700 Subject: [PATCH 1/3] update any instance of address validation to use InputAddress --- .../client/src/components/SafeContacts.js | 1 + packages/client/src/components/SafeOwners.js | 48 +++++-------------- .../components/Assets/AddCollection.js | 1 + .../components/Owners/AddSafeOwner.js | 42 +++++----------- .../src/library/components/InputAddress.js | 19 ++++++-- packages/client/src/pages/CreateSafe.js | 42 ++++------------ packages/client/src/pages/LoadSafe.js | 47 +++++------------- 7 files changed, 62 insertions(+), 138 deletions(-) diff --git a/packages/client/src/components/SafeContacts.js b/packages/client/src/components/SafeContacts.js index c4e1e2f..cedc610 100644 --- a/packages/client/src/components/SafeContacts.js +++ b/packages/client/src/components/SafeContacts.js @@ -44,6 +44,7 @@ function EditContactModal({ value={currentAddr} isValid={addressValid} onChange={onAddressChange} + className="mt-2" /> {!addressNew && (

diff --git a/packages/client/src/components/SafeOwners.js b/packages/client/src/components/SafeOwners.js index e426d2d..c4efd9a 100644 --- a/packages/client/src/components/SafeOwners.js +++ b/packages/client/src/components/SafeOwners.js @@ -1,21 +1,18 @@ import React from 'react'; +import { InputAddress } from 'library/components'; import Svg from 'library/Svg'; -function SafeOwners({ - address, - safeOwners, - safeOwnersValidByAddress, - setSafeOwners, -}) { +function SafeOwners({ address, safeOwners, setSafeOwners }) { const onOwnerNameChange = (value, idx) => { const newOwners = safeOwners.slice(0); newOwners[idx].name = value; setSafeOwners([...newOwners]); }; - const onOwnerAddressChange = (value, idx) => { + const onOwnerAddressChange = (value, isValid, idx) => { const newOwners = safeOwners.slice(0); newOwners[idx].address = value; + newOwners[idx].isValid = isValid; setSafeOwners([...newOwners]); }; @@ -33,18 +30,7 @@ function SafeOwners({

-
- -
- -
-
+
, ]; @@ -70,22 +56,14 @@ function SafeOwners({ *
-
- - onOwnerAddressChange(e.target.value, idx + 1) - } - /> - {safeOwnersValidByAddress[so.address] && ( -
- -
- )} -
+ + onOwnerAddressChange(value, isValid, idx + 1) + } + isValid={so?.isValid} + />