From 2570abd97795efad8521caf07969f19df7e77242 Mon Sep 17 00:00:00 2001 From: skubakdj Date: Mon, 27 Nov 2017 15:31:23 -0500 Subject: [PATCH] Remove Redux-Form in Generate Wallet (#466) * remove redux-form from package.json, vendors, reducers * refactor GenerateWallet components, remove redux-form dependency --- .../components/EnterPassword.tsx | 48 +++++++++---------- .../components/PasswordInput.tsx | 18 +++++-- common/reducers/index.ts | 2 - common/vendors.js | 1 - package.json | 1 - 5 files changed, 36 insertions(+), 34 deletions(-) diff --git a/common/containers/Tabs/GenerateWallet/components/EnterPassword.tsx b/common/containers/Tabs/GenerateWallet/components/EnterPassword.tsx index f4d1596f..3f234f97 100644 --- a/common/containers/Tabs/GenerateWallet/components/EnterPassword.tsx +++ b/common/containers/Tabs/GenerateWallet/components/EnterPassword.tsx @@ -1,41 +1,37 @@ import { GenerateNewWalletAction } from 'actions/generateWallet'; import React, { Component } from 'react'; import { Link } from 'react-router-dom'; -import { Field, reduxForm } from 'redux-form'; import translate from 'translations'; import './EnterPassword.scss'; import PasswordInput from './PasswordInput'; import Template from './Template'; + // VALIDATORS -const minLength = min => value => { - return value && value.length < min - ? `Must be ${min} characters or more` - : undefined; -}; +const minLength = min => value => value && value.length >= min; const minLength9 = minLength(9); -const required = value => (value ? undefined : 'Required'); interface Props { - walletPasswordForm: any; generateNewWallet(pw: string): GenerateNewWalletAction; } interface State { fileName: null | string; blobURI: null | string; + password: string; + isPasswordValid: boolean; isPasswordVisible: boolean; } -class EnterPassword extends Component { +export default class EnterPassword extends Component { public state = { fileName: null, blobURI: null, + password: '', + isPasswordValid: false, isPasswordVisible: false }; public render() { - const { walletPasswordForm } = this.props; - const { isPasswordVisible } = this.state; - const AnyField = Field as new () => Field; + const { password, isPasswordValid, isPasswordVisible } = this.state; const content = (

@@ -44,20 +40,18 @@ class EnterPassword extends Component {