diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-02-21 20:24:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-21 20:24:32 +0800 |
commit | 65bfdeedc77e51dea28ef643b5ea9d50a8569c81 (patch) | |
tree | 91859eabd9280c19131a403e35a9bc5262a6e402 /old-ui/app/components/account-export.js | |
parent | c6e84ccf458061a6b64e6a15512b008e8d0166ea (diff) | |
parent | 38bb1d39792d8e4c238f7528990d725527379550 (diff) | |
download | tangerine-wallet-browser-65bfdeedc77e51dea28ef643b5ea9d50a8569c81.tar tangerine-wallet-browser-65bfdeedc77e51dea28ef643b5ea9d50a8569c81.tar.gz tangerine-wallet-browser-65bfdeedc77e51dea28ef643b5ea9d50a8569c81.tar.bz2 tangerine-wallet-browser-65bfdeedc77e51dea28ef643b5ea9d50a8569c81.tar.lz tangerine-wallet-browser-65bfdeedc77e51dea28ef643b5ea9d50a8569c81.tar.xz tangerine-wallet-browser-65bfdeedc77e51dea28ef643b5ea9d50a8569c81.tar.zst tangerine-wallet-browser-65bfdeedc77e51dea28ef643b5ea9d50a8569c81.zip |
Merge pull request #6166 from whymarrh/bye-bye-old-ui
Delete the old UI
Diffstat (limited to 'old-ui/app/components/account-export.js')
-rw-r--r-- | old-ui/app/components/account-export.js | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/old-ui/app/components/account-export.js b/old-ui/app/components/account-export.js deleted file mode 100644 index 51b85b786..000000000 --- a/old-ui/app/components/account-export.js +++ /dev/null @@ -1,132 +0,0 @@ -const Component = require('react').Component -const h = require('react-hyperscript') -const inherits = require('util').inherits -const exportAsFile = require('../util').exportAsFile -const copyToClipboard = require('copy-to-clipboard') -const actions = require('../../../ui/app/actions') -const ethUtil = require('ethereumjs-util') -const connect = require('react-redux').connect - -module.exports = connect(mapStateToProps)(ExportAccountView) - -inherits(ExportAccountView, Component) -function ExportAccountView () { - Component.call(this) -} - -function mapStateToProps (state) { - return { - warning: state.appState.warning, - } -} - -ExportAccountView.prototype.render = function () { - const state = this.props - const accountDetail = state.accountDetail - const nickname = state.identities[state.address].name - - if (!accountDetail) return h('div') - const accountExport = accountDetail.accountExport - - const notExporting = accountExport === 'none' - const exportRequested = accountExport === 'requested' - const accountExported = accountExport === 'completed' - - if (notExporting) return h('div') - - if (exportRequested) { - const warning = `Export private keys at your own risk.` - return ( - h('div', { - style: { - display: 'inline-block', - textAlign: 'center', - }, - }, - [ - h('div', { - key: 'exporting', - style: { - margin: '0 20px', - }, - }, [ - h('p.error', warning), - h('input#exportAccount.sizing-input', { - type: 'password', - placeholder: 'confirm password', - onKeyPress: this.onExportKeyPress.bind(this), - style: { - position: 'relative', - top: '1.5px', - marginBottom: '7px', - }, - }), - ]), - h('div', { - key: 'buttons', - style: { - margin: '0 20px', - }, - }, - [ - h('button', { - onClick: () => this.onExportKeyPress({ key: 'Enter', preventDefault: () => {} }), - style: { - marginRight: '10px', - }, - }, 'Submit'), - h('button', { - onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)), - }, 'Cancel'), - ]), - (this.props.warning) && ( - h('span.error', { - style: { - margin: '20px', - }, - }, this.props.warning.split('-')) - ), - ]) - ) - } - - if (accountExported) { - const plainKey = ethUtil.stripHexPrefix(accountDetail.privateKey) - - return h('div.privateKey', { - style: { - margin: '0 20px', - }, - }, [ - h('label', 'Your private key (click to copy):'), - h('p.error.cursor-pointer', { - style: { - textOverflow: 'ellipsis', - overflow: 'hidden', - webkitUserSelect: 'text', - maxWidth: '275px', - }, - onClick: function (event) { - copyToClipboard(ethUtil.stripHexPrefix(accountDetail.privateKey)) - }, - }, plainKey), - h('button', { - onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)), - }, 'Done'), - h('button', { - style: { - marginLeft: '10px', - }, - onClick: () => exportAsFile(`MetaMask ${nickname} Private Key`, plainKey), - }, 'Save as File'), - ]) - } -} - -ExportAccountView.prototype.onExportKeyPress = function (event) { - if (event.key !== 'Enter') return - event.preventDefault() - - const input = document.getElementById('exportAccount').value - this.props.dispatch(actions.exportAccount(input, this.props.address)) -} |