aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-03-24 06:44:29 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-03-24 06:44:29 +0800
commit8e30acb41a2cd97efd5428c60c2a5c910758b412 (patch)
treeae797e27d776827424fb9f15be07d3b02e5c9f92 /ui/app/components
parentc8540261c1c9b60c98845bdd19095efc064fdde8 (diff)
parentf29a116d4027e387180aa1232d35afcc15b920b0 (diff)
downloadtangerine-wallet-browser-8e30acb41a2cd97efd5428c60c2a5c910758b412.tar
tangerine-wallet-browser-8e30acb41a2cd97efd5428c60c2a5c910758b412.tar.gz
tangerine-wallet-browser-8e30acb41a2cd97efd5428c60c2a5c910758b412.tar.bz2
tangerine-wallet-browser-8e30acb41a2cd97efd5428c60c2a5c910758b412.tar.lz
tangerine-wallet-browser-8e30acb41a2cd97efd5428c60c2a5c910758b412.tar.xz
tangerine-wallet-browser-8e30acb41a2cd97efd5428c60c2a5c910758b412.tar.zst
tangerine-wallet-browser-8e30acb41a2cd97efd5428c60c2a5c910758b412.zip
Merge branch 'master' into mascara
Diffstat (limited to 'ui/app/components')
-rw-r--r--ui/app/components/account-export.js93
-rw-r--r--ui/app/components/binary-renderer.js21
-rw-r--r--ui/app/components/drop-menu-item.js5
-rw-r--r--ui/app/components/ens-input.js29
-rw-r--r--ui/app/components/fiat-value.js4
-rw-r--r--ui/app/components/network.js12
-rw-r--r--ui/app/components/pending-personal-msg-details.js13
-rw-r--r--ui/app/components/transaction-list-item.js2
8 files changed, 126 insertions, 53 deletions
diff --git a/ui/app/components/account-export.js b/ui/app/components/account-export.js
index 6d8b099a5..888196c5d 100644
--- a/ui/app/components/account-export.js
+++ b/ui/app/components/account-export.js
@@ -4,14 +4,21 @@ const inherits = require('util').inherits
const copyToClipboard = require('copy-to-clipboard')
const actions = require('../actions')
const ethUtil = require('ethereumjs-util')
+const connect = require('react-redux').connect
-module.exports = ExportAccountView
+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 () {
console.log('EXPORT VIEW')
console.dir(this.props)
@@ -28,35 +35,58 @@ ExportAccountView.prototype.render = function () {
if (notExporting) return h('div')
if (exportRequested) {
- var warning = `Exporting your private key is very dangerous,
- and you should only do it if you know what you're doing.`
- var confirmation = `If you're absolutely sure, type "I understand" below and
- submit.`
+ var warning = `Export private keys at your own risk.`
return (
-
h('div', {
- key: 'exporting',
style: {
- margin: '0 20px',
+ display: 'inline-block',
+ textAlign: 'center',
},
- }, [
- h('p.error', warning),
- h('p', confirmation),
- h('input#exportAccount.sizing-input', {
- onKeyPress: this.onExportKeyPress.bind(this),
- style: {
- position: 'relative',
- top: '1.5px',
+ },
+ [
+ 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: () => {} }),
- }, 'Submit'),
- h('button', {
- onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)),
- }, 'Cancel'),
- ])
-
+ [
+ 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('-'))
+ ),
+ ])
)
}
@@ -89,15 +119,6 @@ ExportAccountView.prototype.onExportKeyPress = function (event) {
if (event.key !== 'Enter') return
event.preventDefault()
- var input = document.getElementById('exportAccount')
- if (input.value === 'I understand') {
- this.props.dispatch(actions.exportAccount(this.props.address))
- } else {
- input.value = ''
- input.placeholder = 'Please retype "I understand" exactly.'
- }
-}
-
-ExportAccountView.prototype.exportAccount = function (address) {
- this.props.dispatch(actions.exportAccount(address))
+ var input = document.getElementById('exportAccount').value
+ this.props.dispatch(actions.exportAccount(input, this.props.address))
}
diff --git a/ui/app/components/binary-renderer.js b/ui/app/components/binary-renderer.js
index a9d49b128..0b6a1f5c2 100644
--- a/ui/app/components/binary-renderer.js
+++ b/ui/app/components/binary-renderer.js
@@ -2,6 +2,7 @@ const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
const ethUtil = require('ethereumjs-util')
+const extend = require('xtend')
module.exports = BinaryRenderer
@@ -12,20 +13,22 @@ function BinaryRenderer () {
BinaryRenderer.prototype.render = function () {
const props = this.props
- const { value } = props
+ const { value, style } = props
const text = this.hexToText(value)
+ const defaultStyle = extend({
+ width: '315px',
+ maxHeight: '210px',
+ resize: 'none',
+ border: 'none',
+ background: 'white',
+ padding: '3px',
+ }, style)
+
return (
h('textarea.font-small', {
readOnly: true,
- style: {
- width: '315px',
- maxHeight: '210px',
- resize: 'none',
- border: 'none',
- background: 'white',
- padding: '3px',
- },
+ style: defaultStyle,
defaultValue: text,
})
)
diff --git a/ui/app/components/drop-menu-item.js b/ui/app/components/drop-menu-item.js
index 9f002234e..3eb6ec876 100644
--- a/ui/app/components/drop-menu-item.js
+++ b/ui/app/components/drop-menu-item.js
@@ -42,7 +42,10 @@ DropMenuItem.prototype.activeNetworkRender = function () {
if (providerType === 'mainnet') return h('.check', '✓')
break
case 'Ropsten Test Network':
- if (provider.type === 'testnet') return h('.check', '✓')
+ if (providerType === 'testnet') return h('.check', '✓')
+ break
+ case 'Kovan Test Network':
+ if (providerType === 'kovan') return h('.check', '✓')
break
case 'Localhost 8545':
if (activeNetwork === 'http://localhost:8545') return h('.check', '✓')
diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js
index ffc4eab4a..facf29d97 100644
--- a/ui/app/components/ens-input.js
+++ b/ui/app/components/ens-input.js
@@ -21,6 +21,7 @@ function EnsInput () {
EnsInput.prototype.render = function () {
const props = this.props
const opts = extend(props, {
+ list: 'addresses',
onChange: () => {
const network = this.props.network
let resolverAddress = networkResolvers[network]
@@ -46,6 +47,25 @@ EnsInput.prototype.render = function () {
style: { width: '100%' },
}, [
h('input.large-input', opts),
+ // The address book functionality.
+ h('datalist#addresses',
+ [
+ // Corresponds to the addresses owned.
+ Object.keys(props.identities).map((key) => {
+ let identity = props.identities[key]
+ return h('option', {
+ value: identity.address,
+ label: identity.name,
+ })
+ }),
+ // Corresponds to previously sent-to addresses.
+ props.addressBook.map((identity) => {
+ return h('option', {
+ value: identity.address,
+ label: identity.name,
+ })
+ }),
+ ]),
this.ensIcon(),
])
}
@@ -80,11 +100,13 @@ EnsInput.prototype.lookupEnsName = function () {
this.setState({
loadingEns: false,
ensResolution: address,
+ nickname: recipient.trim(),
hoverText: address + '\nClick to Copy',
})
}
})
.catch((reason) => {
+ log.error(reason)
return this.setState({
loadingEns: false,
ensFailure: true,
@@ -95,10 +117,13 @@ EnsInput.prototype.lookupEnsName = function () {
EnsInput.prototype.componentDidUpdate = function (prevProps, prevState) {
const state = this.state || {}
- const { ensResolution } = state
+ const ensResolution = state.ensResolution
+ // If an address is sent without a nickname, meaning not from ENS or from
+ // the user's own accounts, a default of a one-space string is used.
+ const nickname = state.nickname || ' '
if (ensResolution && this.props.onChange &&
ensResolution !== prevState.ensResolution) {
- this.props.onChange(ensResolution)
+ this.props.onChange(ensResolution, nickname)
}
}
diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js
index 13ee48245..298809b30 100644
--- a/ui/app/components/fiat-value.js
+++ b/ui/app/components/fiat-value.js
@@ -9,7 +9,7 @@ module.exports = connect(mapStateToProps)(FiatValue)
function mapStateToProps (state) {
return {
conversionRate: state.metamask.conversionRate,
- currentFiat: state.metamask.currentFiat,
+ currentCurrency: state.metamask.currentCurrency,
}
}
@@ -34,7 +34,7 @@ FiatValue.prototype.render = function () {
fiatTooltipNumber = 'Unknown'
}
- var fiatSuffix = props.currentFiat
+ var fiatSuffix = props.currentCurrency
return fiatDisplay(fiatDisplayNumber, fiatSuffix)
}
diff --git a/ui/app/components/network.js b/ui/app/components/network.js
index 77805fd57..d9045167f 100644
--- a/ui/app/components/network.js
+++ b/ui/app/components/network.js
@@ -40,6 +40,9 @@ Network.prototype.render = function () {
} else if (parseInt(networkNumber) === 3) {
hoverText = 'Ropsten Test Network'
iconName = 'ropsten-test-network'
+ } else if (providerName === 'kovan') {
+ hoverText = 'Kovan Test Network'
+ iconName = 'kovan-test-network'
} else {
hoverText = 'Unknown Private Network'
iconName = 'unknown-private-network'
@@ -70,6 +73,15 @@ Network.prototype.render = function () {
}},
'Ropsten Test Net'),
])
+ case 'kovan-test-network':
+ return h('.network-indicator', [
+ h('.menu-icon.hollow-diamond'),
+ h('.network-name', {
+ style: {
+ color: '#690496',
+ }},
+ 'Kovan Test Net'),
+ ])
default:
return h('.network-indicator', [
h('i.fa.fa-question-circle.fa-lg', {
diff --git a/ui/app/components/pending-personal-msg-details.js b/ui/app/components/pending-personal-msg-details.js
index fa2c6416c..1050513f2 100644
--- a/ui/app/components/pending-personal-msg-details.js
+++ b/ui/app/components/pending-personal-msg-details.js
@@ -40,9 +40,18 @@ PendingMsgDetails.prototype.render = function () {
}),
// message data
- h('div', [
+ h('div', {
+ style: {
+ height: '260px',
+ },
+ }, [
h('label.font-small', { style: { display: 'block' } }, 'MESSAGE'),
- h(BinaryRenderer, { value: data }),
+ h(BinaryRenderer, {
+ value: data,
+ style: {
+ height: '215px',
+ },
+ }),
]),
])
diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js
index 44d2dc587..ee32be7d3 100644
--- a/ui/app/components/transaction-list-item.js
+++ b/ui/app/components/transaction-list-item.js
@@ -28,7 +28,7 @@ TransactionListItem.prototype.render = function () {
let isLinkable = false
const numericNet = parseInt(network)
- isLinkable = numericNet === 1 || numericNet === 3
+ isLinkable = numericNet === 1 || numericNet === 3 || numericNet === 42
var isMsg = ('msgParams' in transaction)
var isTx = ('txParams' in transaction)