mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Convert AccountImportSubview to use JSX (#7520)
This commit is contained in:
parent
d7fabae847
commit
1454426e3e
@ -1,6 +1,5 @@
|
|||||||
|
import React, { Component } from 'react'
|
||||||
const inherits = require('util').inherits
|
const inherits = require('util').inherits
|
||||||
const Component = require('react').Component
|
|
||||||
const h = require('react-hyperscript')
|
|
||||||
const PropTypes = require('prop-types')
|
const PropTypes = require('prop-types')
|
||||||
const connect = require('react-redux').connect
|
const connect = require('react-redux').connect
|
||||||
import Select from 'react-select'
|
import Select from 'react-select'
|
||||||
@ -35,47 +34,44 @@ AccountImportSubview.prototype.render = function () {
|
|||||||
const { type } = state
|
const { type } = state
|
||||||
|
|
||||||
return (
|
return (
|
||||||
h('div.new-account-import-form', [
|
<div className="new-account-import-form">
|
||||||
|
<div className="new-account-import-disclaimer">
|
||||||
h('.new-account-import-disclaimer', [
|
<span>{this.context.t('importAccountMsg')}</span>
|
||||||
h('span', this.context.t('importAccountMsg')),
|
<span
|
||||||
h('span', {
|
style={{
|
||||||
style: {
|
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
textDecoration: 'underline',
|
textDecoration: 'underline',
|
||||||
},
|
}}
|
||||||
onClick: () => {
|
onClick={() => {
|
||||||
global.platform.openWindow({
|
global.platform.openWindow({
|
||||||
url: 'https://metamask.zendesk.com/hc/en-us/articles/360015289932',
|
url: 'https://metamask.zendesk.com/hc/en-us/articles/360015289932',
|
||||||
})
|
})
|
||||||
},
|
}}>
|
||||||
}, this.context.t('here')),
|
{this.context.t('here')}
|
||||||
]),
|
</span>
|
||||||
|
</div>
|
||||||
h('div.new-account-import-form__select-section', [
|
<div className="new-account-import-form__select-section">
|
||||||
|
<div className="new-account-import-form__select-label">
|
||||||
h('div.new-account-import-form__select-label', this.context.t('selectType')),
|
{this.context.t('selectType')}
|
||||||
|
</div>
|
||||||
h(Select, {
|
<Select
|
||||||
className: 'new-account-import-form__select',
|
className="new-account-import-form__select"
|
||||||
name: 'import-type-select',
|
name="import-type-select"
|
||||||
clearable: false,
|
clearable={false}
|
||||||
value: type || menuItems[0],
|
value={type || menuItems[0]}
|
||||||
options: menuItems.map((type) => {
|
options={menuItems.map((type) => {
|
||||||
return {
|
return {
|
||||||
value: type,
|
value: type,
|
||||||
label: type,
|
label: type,
|
||||||
}
|
}
|
||||||
}),
|
})}
|
||||||
onChange: (opt) => {
|
onChange={(opt) => {
|
||||||
this.setState({ type: opt.value })
|
this.setState({ type: opt.value })
|
||||||
},
|
}}
|
||||||
}),
|
/>
|
||||||
|
</div>
|
||||||
]),
|
{this.renderImportView()}
|
||||||
|
</div>
|
||||||
this.renderImportView(),
|
|
||||||
])
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,10 +83,10 @@ AccountImportSubview.prototype.renderImportView = function () {
|
|||||||
|
|
||||||
switch (current) {
|
switch (current) {
|
||||||
case this.context.t('privateKey'):
|
case this.context.t('privateKey'):
|
||||||
return h(PrivateKeyImportView)
|
return <PrivateKeyImportView />
|
||||||
case this.context.t('jsonFile'):
|
case this.context.t('jsonFile'):
|
||||||
return h(JsonImportView)
|
return <JsonImportView />
|
||||||
default:
|
default:
|
||||||
return h(JsonImportView)
|
return <JsonImportView />
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user