From 431f21970985963c400c13630e89992bf98325f7 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Thu, 27 Jun 2019 10:14:52 +0200 Subject: [PATCH] Create account cleanups (#1340) * Creqate account cleanups * No need for noop --- packages/app-accounts/src/modals/Create.tsx | 50 ++++++++++----------- packages/ui-app/src/Input.tsx | 4 +- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/packages/app-accounts/src/modals/Create.tsx b/packages/app-accounts/src/modals/Create.tsx index cf7cbee976..0732d8bdf2 100644 --- a/packages/app-accounts/src/modals/Create.tsx +++ b/packages/app-accounts/src/modals/Create.tsx @@ -152,6 +152,7 @@ class Create extends React.PureComponent { private renderInput () { const { t } = this.props; const { address, deriveError, derivePath, isNameValid, isPassValid, isSeedValid, name, pairType, password, seed, seedOptions, seedType } = this.state; + const isDevSeed = seedType === 'dev'; const seedLabel = (() => { switch (seedType) { case 'bip': @@ -184,6 +185,7 @@ class Create extends React.PureComponent { help={t('The private key for your account is derived from this seed. This seed must be kept secret as anyone in its possession has access to the funds of this account. If you validate, use the seed of the session account as the "--key" parameter of your node.')} isAction isError={!isSeedValid} + isReadOnly={isDevSeed} label={seedLabel} onChange={this.onChangeSeed} onEnter={this.onCommit} @@ -210,33 +212,27 @@ class Create extends React.PureComponent { open > {t('Advanced creation options')} -
-
- -
-
- //". The "/" and "//" may be repeated and mixed`.')} - isError={!!deriveError} - label={t('secret derivation path')} - onChange={this.onChangeDerive} - onEnter={this.onCommit} - value={derivePath} - /> -
- { - deriveError - ?
{deriveError}
- : null - } -
+ + //". The "/" and "//" may be repeated and mixed`.')} + isError={!!deriveError} + label={t('secret derivation path')} + onChange={this.onChangeDerive} + onEnter={this.onCommit} + value={derivePath} + /> + { + deriveError + ?
{deriveError}
+ : null + } diff --git a/packages/ui-app/src/Input.tsx b/packages/ui-app/src/Input.tsx index 4649a236ca..fb9cc7a868 100644 --- a/packages/ui-app/src/Input.tsx +++ b/packages/ui-app/src/Input.tsx @@ -23,6 +23,7 @@ type Props = BareProps & { isEditable?: boolean, isError?: boolean, isHidden?: boolean, + isReadOnly?: boolean, label?: React.ReactNode, max?: any, maxLength?: number, @@ -94,7 +95,7 @@ export default class Input extends React.PureComponent { }; render () { - const { autoFocus = false, children, className, defaultValue, help, icon, isEditable = false, isAction = false, isDisabled = false, isError = false, isHidden = false, label, max, maxLength, min, name, placeholder, style, tabIndex, type = 'text', value, withEllipsis, withLabel } = this.props; + const { autoFocus = false, children, className, defaultValue, help, icon, isEditable = false, isAction = false, isDisabled = false, isError = false, isHidden = false, isReadOnly = false, label, max, maxLength, min, name, placeholder, style, tabIndex, type = 'text', value, withEllipsis, withLabel } = this.props; return ( { onKeyDown={this.onKeyDown} onKeyUp={this.onKeyUp} placeholder={placeholder} + readOnly={isReadOnly} tabIndex={tabIndex} type={type} value={value}