Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

move recovery phrase print button #3697

Merged
merged 4 commits into from
Dec 2, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions js/src/modals/CreateAccount/AccountDetails/accountDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,8 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

import React, { Component, PropTypes } from 'react';
import PrintIcon from 'material-ui/svg-icons/action/print';

import { Form, Input, InputAddress } from '../../../ui';
import Button from '../../../ui/Button';

import { createIdentityImg } from '../../../api/util/identity';
import print from './print';
import recoveryPage from './recovery-page.ejs';
import ParityLogo from '../../../../assets/images/parity-logo-black-no-text.svg';

export default class AccountDetails extends Component {
static propTypes = {
Expand All @@ -49,7 +42,6 @@ export default class AccountDetails extends Component {
label='address'
value={ address } />
{ this.renderPhrase() }
{ this.renderPhraseCopyButton() }
</Form>
);
}
Expand All @@ -70,26 +62,4 @@ export default class AccountDetails extends Component {
value={ phrase } />
);
}

renderPhraseCopyButton () {
const { phrase } = this.props;
if (!phrase) {
return null;
}

return (
<Button
icon={ <PrintIcon /> }
label={ 'print recovery phrase' }
onClick={ this.printPhrase }
/>
);
}

printPhrase = () => {
const { address, phrase, name } = this.props;
const identity = createIdentityImg(address);

print(recoveryPage({ phrase, name, identity, address, logo: ParityLogo }));
}
}
23 changes: 21 additions & 2 deletions js/src/modals/CreateAccount/createAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import ActionDoneAll from 'material-ui/svg-icons/action/done-all';
import ContentClear from 'material-ui/svg-icons/content/clear';
import NavigationArrowBack from 'material-ui/svg-icons/navigation/arrow-back';
import NavigationArrowForward from 'material-ui/svg-icons/navigation/arrow-forward';
import PrintIcon from 'material-ui/svg-icons/action/print';

import { Button, Modal } from '../../ui';

Expand All @@ -32,6 +33,11 @@ import NewImport from './NewImport';
import RawKey from './RawKey';
import RecoveryPhrase from './RecoveryPhrase';

import { createIdentityImg } from '../../api/util/identity';
import print from './print';
import recoveryPage from './recovery-page.ejs';
import ParityLogo from '../../../assets/images/parity-logo-black-no-text.svg';

const TITLES = {
type: 'creation type',
create: 'create account',
Expand Down Expand Up @@ -179,12 +185,18 @@ export default class CreateAccount extends Component {
];

case 2:
return (
return [
createType === 'fromNew' ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also for fromPhrase

<Button
icon={ <PrintIcon /> }
label='Print Phrase'
onClick={ this.printPhrase } />
) : null,
<Button
icon={ <ActionDoneAll /> }
label='Close'
onClick={ this.onClose } />
);
];
}
}

Expand Down Expand Up @@ -377,4 +389,11 @@ export default class CreateAccount extends Component {

store.dispatch({ type: 'newError', error });
}

printPhrase = () => {
const { address, phrase, name } = this.state;
const identity = createIdentityImg(address);

print(recoveryPage({ phrase, name, identity, address, logo: ParityLogo }));
}
}