From ff025ecfe60fefd02ed803a367d904783bd1b618 Mon Sep 17 00:00:00 2001 From: apanizo Date: Mon, 12 Nov 2018 16:30:21 +0100 Subject: [PATCH 01/13] Refactor noErrors function helper when validating forms --- src/components/forms/validator.js | 2 ++ src/routes/open/components/SafeOwnersForm/index.jsx | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/forms/validator.js b/src/components/forms/validator.js index 0d0e5956..38e65462 100644 --- a/src/components/forms/validator.js +++ b/src/components/forms/validator.js @@ -71,3 +71,5 @@ export const inLimit = (limit: number, base: number, baseText: string, symbol: s return `Should not exceed ${max} ${symbol} (amount to reach ${baseText})` } + +export const noErrorsOn = (name: string, errors: Object) => errors[name] === undefined diff --git a/src/routes/open/components/SafeOwnersForm/index.jsx b/src/routes/open/components/SafeOwnersForm/index.jsx index 297327e4..4ef98bab 100644 --- a/src/routes/open/components/SafeOwnersForm/index.jsx +++ b/src/routes/open/components/SafeOwnersForm/index.jsx @@ -3,7 +3,7 @@ import * as React from 'react' import { withStyles } from '@material-ui/core/styles' import Field from '~/components/forms/Field' import TextField from '~/components/forms/TextField' -import { required, composeValidators, uniqueAddress, mustBeEthereumAddress } from '~/components/forms/validator' +import { required, composeValidators, uniqueAddress, mustBeEthereumAddress, noErrorsOn } from '~/components/forms/validator' import Block from '~/components/layout/Block' import Button from '~/components/layout/Button' import Row from '~/components/layout/Row' @@ -75,8 +75,6 @@ const getAddressValidators = (addresses: string[], position: number) => { return composeValidators(required, mustBeEthereumAddress, uniqueAddress(copy)) } -const noErrorsOn = (name: string, errors: Object) => errors[name] === undefined - export const ADD_OWNER_BUTTON = '+ ADD ANOTHER OWNER' export const calculateValuesAfterRemoving = (index: number, notRemovedOwners: number, values: Object) => { From 767fc8c7ea91fc43e4b42e520b75abff20768300 Mon Sep 17 00:00:00 2001 From: apanizo Date: Mon, 12 Nov 2018 16:32:04 +0100 Subject: [PATCH 02/13] Adding load safe route to react-router #75 --- src/routes/index.js | 8 +++++++- src/routes/routes.js | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/routes/index.js b/src/routes/index.js index e02b1dbf..fc2c8be3 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -4,7 +4,7 @@ import Loadable from 'react-loadable' import { Switch, Redirect, Route } from 'react-router-dom' import Loader from '~/components/Loader' import Welcome from './welcome/container' -import { SAFELIST_ADDRESS, OPEN_ADDRESS, SAFE_PARAM_ADDRESS, WELCOME_ADDRESS, SETTINS_ADDRESS, OPENING_ADDRESS } from './routes' +import { SAFELIST_ADDRESS, OPEN_ADDRESS, SAFE_PARAM_ADDRESS, WELCOME_ADDRESS, SETTINS_ADDRESS, OPENING_ADDRESS, LOAD_ADDRESS } from './routes' const Safe = Loadable({ loader: () => import('./safe/container'), @@ -31,6 +31,11 @@ const Opening = Loadable({ loading: Loader, }) +const Load = Loadable({ + loader: () => import('./load/container/Load'), + loading: Loader, +}) + const SAFE_ADDRESS = `${SAFELIST_ADDRESS}/:${SAFE_PARAM_ADDRESS}` const SAFE_SETTINGS = `${SAFE_ADDRESS}${SETTINS_ADDRESS}` @@ -45,6 +50,7 @@ const Routes = () => ( + ) diff --git a/src/routes/routes.js b/src/routes/routes.js index ca326218..a3f95255 100644 --- a/src/routes/routes.js +++ b/src/routes/routes.js @@ -4,6 +4,7 @@ import { history } from '~/store' export const SAFE_PARAM_ADDRESS = 'address' export const SAFELIST_ADDRESS = '/safes' export const OPEN_ADDRESS = '/open' +export const LOAD_ADDRESS = '/load' export const WELCOME_ADDRESS = '/welcome' export const SETTINS_ADDRESS = '/settings' export const OPENING_ADDRESS = '/opening' From 59392764623f4e675b1b43a5126b1282675bef8c Mon Sep 17 00:00:00 2001 From: apanizo Date: Mon, 12 Nov 2018 16:33:31 +0100 Subject: [PATCH 03/13] Redirecting Welcome's load onClick to load route #75 --- src/routes/welcome/components/Layout.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/welcome/components/Layout.jsx b/src/routes/welcome/components/Layout.jsx index 10985fb9..dc152c08 100644 --- a/src/routes/welcome/components/Layout.jsx +++ b/src/routes/welcome/components/Layout.jsx @@ -5,7 +5,7 @@ import Heading from '~/components/layout/Heading' import Img from '~/components/layout/Img' import Button from '~/components/layout/Button' import Link from '~/components/layout/Link' -import { OPEN_ADDRESS } from '~/routes/routes' +import { OPEN_ADDRESS, LOAD_ADDRESS } from '~/routes/routes' import { marginButtonImg } from '~/theme/variables' import styles from './Layout.scss' @@ -43,7 +43,7 @@ export const CreateSafe = ({ size, provider }: SafeProps) => ( export const LoadSafe = ({ size, provider }: SafeProps) => (