aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components
diff options
context:
space:
mode:
authorFrankie <frankie.pangilinan@consensys.net>2016-06-22 06:04:00 +0800
committerFrankie <frankie.pangilinan@consensys.net>2016-06-22 06:04:00 +0800
commitcf663f1104697440121d32cc6db2a8a1d5d54c5a (patch)
tree3ed4b8b9fe8c85f3b3a5bf68482c3fb9967f2de5 /ui/app/components
parent265725c6edd62a7f46a9b9cf5a443cf01f0ff00c (diff)
parentdc2ef967028723afe9fe1efd669754723e38a4f0 (diff)
downloadtangerine-wallet-browser-cf663f1104697440121d32cc6db2a8a1d5d54c5a.tar.gz
tangerine-wallet-browser-cf663f1104697440121d32cc6db2a8a1d5d54c5a.tar.zst
tangerine-wallet-browser-cf663f1104697440121d32cc6db2a8a1d5d54c5a.zip
Fix conflict
Diffstat (limited to 'ui/app/components')
-rw-r--r--ui/app/components/account-export.js21
-rw-r--r--ui/app/components/account-panel.js20
-rw-r--r--ui/app/components/drop-menu-item.js8
-rw-r--r--ui/app/components/editable-label.js21
-rw-r--r--ui/app/components/eth-balance.js5
-rw-r--r--ui/app/components/identicon.js6
-rw-r--r--ui/app/components/mascot.js15
-rw-r--r--ui/app/components/network.js57
-rw-r--r--ui/app/components/panel.js9
-rw-r--r--ui/app/components/pending-msg.js12
-rw-r--r--ui/app/components/pending-tx.js10
-rw-r--r--ui/app/components/template.js9
-rw-r--r--ui/app/components/transaction-list-item-icon.js13
-rw-r--r--ui/app/components/transaction-list-item.js30
-rw-r--r--ui/app/components/transaction-list.js25
15 files changed, 110 insertions, 151 deletions
diff --git a/ui/app/components/account-export.js b/ui/app/components/account-export.js
index e31951a7d..f36b9faeb 100644
--- a/ui/app/components/account-export.js
+++ b/ui/app/components/account-export.js
@@ -6,14 +6,13 @@ const actions = require('../actions')
module.exports = ExportAccountView
-
inherits(ExportAccountView, Component)
-function ExportAccountView() {
+function ExportAccountView () {
Component.call(this)
}
-ExportAccountView.prototype.render = function() {
- console.log("EXPORT VIEW")
+ExportAccountView.prototype.render = function () {
+ console.log('EXPORT VIEW')
console.dir(this.props)
var state = this.props
var accountDetail = state.accountDetail
@@ -47,13 +46,13 @@ ExportAccountView.prototype.render = function() {
style: {
position: 'relative',
top: '1.5px',
- }
+ },
}),
h('button', {
onClick: () => this.onExportKeyPress({ key: 'Enter', preventDefault: () => {} }),
}, 'Submit'),
h('button', {
- onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address))
+ onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)),
}, 'Cancel'),
])
@@ -72,18 +71,18 @@ ExportAccountView.prototype.render = function() {
webkitUserSelect: 'text',
width: '100%',
},
- onClick: function(event) {
+ onClick: function (event) {
copyToClipboard(accountDetail.privateKey)
- }
+ },
}, accountDetail.privateKey),
h('button', {
- onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address))
+ onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)),
}, 'Done'),
])
}
}
-ExportAccountView.prototype.onExportKeyPress = function(event) {
+ExportAccountView.prototype.onExportKeyPress = function (event) {
if (event.key !== 'Enter') return
event.preventDefault()
@@ -96,6 +95,6 @@ ExportAccountView.prototype.onExportKeyPress = function(event) {
}
}
-ExportAccountView.prototype.exportAccount = function(address) {
+ExportAccountView.prototype.exportAccount = function (address) {
this.props.dispatch(actions.exportAccount(address))
}
diff --git a/ui/app/components/account-panel.js b/ui/app/components/account-panel.js
index 5583d06ae..112b897d5 100644
--- a/ui/app/components/account-panel.js
+++ b/ui/app/components/account-panel.js
@@ -1,30 +1,24 @@
const inherits = require('util').inherits
-const ethUtil = require('ethereumjs-util')
const Component = require('react').Component
const h = require('react-hyperscript')
const formatBalance = require('../util').formatBalance
-const Identicon = require('./identicon')
const addressSummary = require('../util').addressSummary
const Panel = require('./panel')
module.exports = AccountPanel
-
inherits(AccountPanel, Component)
-function AccountPanel() {
+function AccountPanel () {
Component.call(this)
}
-AccountPanel.prototype.render = function() {
+AccountPanel.prototype.render = function () {
var state = this.props
var identity = state.identity || {}
var account = state.account || {}
var isFauceting = state.isFauceting
- var identicon = new Identicon(identity.address, 46).toString()
- var identiconSrc = `data:image/png;base64,${identicon}`
-
var panelOpts = {
key: `accountPanel${identity.address}`,
onClick: (event) => {
@@ -40,21 +34,19 @@ AccountPanel.prototype.render = function() {
value: addressSummary(identity.address),
},
balanceOrFaucetingIndication(account, isFauceting),
- ]
+ ],
}
return h(Panel, panelOpts,
!state.onShowDetail ? null : h('.arrow-right.cursor-pointer', [
h('i.fa.fa-chevron-right.fa-lg'),
]))
-
}
-function balanceOrFaucetingIndication(account, isFauceting) {
-
+function balanceOrFaucetingIndication (account, isFauceting) {
// Temporarily deactivating isFauceting indication
// because it shows fauceting for empty restored accounts.
- if (/*isFauceting*/ false) {
+ if (/* isFauceting*/ false) {
return {
key: 'Account is auto-funding.',
value: 'Please wait.',
@@ -62,7 +54,7 @@ function balanceOrFaucetingIndication(account, isFauceting) {
} else {
return {
key: 'BALANCE',
- value: formatBalance(account.balance)
+ value: formatBalance(account.balance),
}
}
}
diff --git a/ui/app/components/drop-menu-item.js b/ui/app/components/drop-menu-item.js
index c8e61278c..d9fde72ac 100644
--- a/ui/app/components/drop-menu-item.js
+++ b/ui/app/components/drop-menu-item.js
@@ -4,16 +4,14 @@ const inherits = require('util').inherits
module.exports = DropMenuItem
-
inherits(DropMenuItem, Component)
-function DropMenuItem() {
+function DropMenuItem () {
Component.call(this)
}
-DropMenuItem.prototype.render = function() {
-
+DropMenuItem.prototype.render = function () {
return h('li.drop-menu-item', {
- onClick:() => {
+ onClick: () => {
this.props.closeMenu()
this.props.action()
},
diff --git a/ui/app/components/editable-label.js b/ui/app/components/editable-label.js
index 41c129d4e..3d7ca17d4 100644
--- a/ui/app/components/editable-label.js
+++ b/ui/app/components/editable-label.js
@@ -5,46 +5,43 @@ const findDOMNode = require('react-dom').findDOMNode
module.exports = EditableLabel
-
inherits(EditableLabel, Component)
-function EditableLabel() {
+function EditableLabel () {
Component.call(this)
}
-EditableLabel.prototype.render = function() {
+EditableLabel.prototype.render = function () {
const props = this.props
- let state = this.state
+ const state = this.state
if (state && state.isEditingLabel) {
-
return h('div.editable-label', [
h('input.sizing-input', {
defaultValue: props.textValue,
- onKeyPress:(event) => {
+ onKeyPress: (event) => {
this.saveIfEnter(event)
},
}),
h('button.editable-button', {
- onClick:() => this.saveText(),
- }, 'Save')
+ onClick: () => this.saveText(),
+ }, 'Save'),
])
-
} else {
return h('div.name-label', {
- onClick:(event) => {
+ onClick: (event) => {
this.setState({ isEditingLabel: true })
},
}, this.props.children)
}
}
-EditableLabel.prototype.saveIfEnter = function(event) {
+EditableLabel.prototype.saveIfEnter = function (event) {
if (event.key === 'Enter') {
this.saveText()
}
}
-EditableLabel.prototype.saveText = function() {
+EditableLabel.prototype.saveText = function () {
var container = findDOMNode(this)
var text = container.querySelector('.editable-label input').value
this.props.saveText(text)
diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js
index 76b75d4c8..710d4fc8b 100644
--- a/ui/app/components/eth-balance.js
+++ b/ui/app/components/eth-balance.js
@@ -1,17 +1,16 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const parseBalance = require('../util').parseBalance
const formatBalance = require('../util').formatBalance
module.exports = EthBalanceComponent
inherits(EthBalanceComponent, Component)
-function EthBalanceComponent() {
+function EthBalanceComponent () {
Component.call(this)
}
-EthBalanceComponent.prototype.render = function() {
+EthBalanceComponent.prototype.render = function () {
var state = this.props
var style = state.style
var value = formatBalance(state.value)
diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js
index fd61b3125..5fe07ce7a 100644
--- a/ui/app/components/identicon.js
+++ b/ui/app/components/identicon.js
@@ -9,13 +9,13 @@ const iconFactory = iconFactoryGen(jazzicon)
module.exports = IdenticonComponent
inherits(IdenticonComponent, Component)
-function IdenticonComponent() {
+function IdenticonComponent () {
Component.call(this)
this.defaultDiameter = 46
}
-IdenticonComponent.prototype.render = function() {
+IdenticonComponent.prototype.render = function () {
var state = this.props
var diameter = state.diameter || this.defaultDiameter
return (
@@ -32,7 +32,7 @@ IdenticonComponent.prototype.render = function() {
)
}
-IdenticonComponent.prototype.componentDidMount = function(){
+IdenticonComponent.prototype.componentDidMount = function () {
var state = this.props
var address = state.address
diff --git a/ui/app/components/mascot.js b/ui/app/components/mascot.js
index e043caca1..ddd51f8ba 100644
--- a/ui/app/components/mascot.js
+++ b/ui/app/components/mascot.js
@@ -2,14 +2,12 @@ const inherits = require('util').inherits
const Component = require('react').Component
const h = require('react-hyperscript')
const metamaskLogo = require('metamask-logo')
-const getCaretCoordinates = require('textarea-caret')
const debounce = require('debounce')
module.exports = Mascot
-
inherits(Mascot, Component)
-function Mascot() {
+function Mascot () {
Component.call(this)
this.logo = metamaskLogo({
followMouse: true,
@@ -22,8 +20,7 @@ function Mascot() {
this.unfollowMouse = this.logo.setFollowMouse.bind(this.logo, false)
}
-
-Mascot.prototype.render = function() {
+Mascot.prototype.render = function () {
// this is a bit hacky
// the event emitter is on `this.props`
// and we dont get that until render
@@ -36,19 +33,19 @@ Mascot.prototype.render = function() {
)
}
-Mascot.prototype.componentDidMount = function() {
+Mascot.prototype.componentDidMount = function () {
if (!this.logo) return
var targetDivId = 'metamask-mascot-container'
var container = document.getElementById(targetDivId)
container.appendChild(this.logo.canvas)
}
-Mascot.prototype.componentWillUnmount = function() {
+Mascot.prototype.componentWillUnmount = function () {
if (!this.logo) return
this.logo.canvas.remove()
}
-Mascot.prototype.handleAnimationEvents = function(){
+Mascot.prototype.handleAnimationEvents = function () {
if (!this.logo) return
// only setup listeners once
if (this.animations) return
@@ -57,7 +54,7 @@ Mascot.prototype.handleAnimationEvents = function(){
this.animations.on('setFollowMouse', this.logo.setFollowMouse.bind(this.logo))
}
-Mascot.prototype.lookAt = function(target){
+Mascot.prototype.lookAt = function (target) {
if (!this.logo) return
this.unfollowMouse()
this.logo.lookAt(target)
diff --git a/ui/app/components/network.js b/ui/app/components/network.js
index b226a6db6..771be5f32 100644
--- a/ui/app/components/network.js
+++ b/ui/app/components/network.js
@@ -6,34 +6,33 @@ module.exports = Network
inherits(Network, Component)
-function Network() {
+function Network () {
Component.call(this)
}
-Network.prototype.render = function() {
+Network.prototype.render = function () {
const state = this.props
const networkNumber = state.network
let iconName, hoverText
- const imagePath = "/images/"
- if (networkNumber == 'loading') {
+ if (networkNumber === 'loading') {
return h('img', {
title: 'Attempting to connect to blockchain.',
- onClick:(event) => this.props.onClick(event),
+ onClick: (event) => this.props.onClick(event),
style: {
width: '27px',
- marginRight: '-27px'
+ marginRight: '-27px',
},
src: 'images/loading.svg',
})
- } else if (parseInt(networkNumber) == 1) {
+ } else if (parseInt(networkNumber) === 1) {
hoverText = 'Main Ethereum Network'
iconName = 'ethereum-network'
- }else if (parseInt(networkNumber) == 2) {
- hoverText = "Morden Test Network"
+ } else if (parseInt(networkNumber) === 2) {
+ hoverText = 'Morden Test Network'
iconName = 'morden-test-network'
- }else {
- hoverText = "Unknown Private Network"
+ } else {
+ hoverText = 'Unknown Private Network'
iconName = 'unknown-private-network'
}
return (
@@ -43,24 +42,24 @@ Network.prototype.render = function() {
marginLeft: '-3px',
},
title: hoverText,
- onClick:(event) => this.props.onClick(event),
- },[
- function() {
- switch (iconName) {
- case 'ethereum-network':
- return h('.menu-icon.ether-icon')
- case 'morden-test-network':
- return h('.menu-icon.morden-icon')
- default:
- return h('i.fa.fa-question-circle.fa-lg', {
- ariaHidden: true,
- style: {
- margin: '10px',
- color: 'rgb(125, 128, 130)',
- },
- })
- }
- }()
+ onClick: (event) => this.props.onClick(event),
+ }, [
+ (function () {
+ switch (iconName) {
+ case 'ethereum-network':
+ return h('.menu-icon.ether-icon')
+ case 'morden-test-network':
+ return h('.menu-icon.morden-icon')
+ default:
+ return h('i.fa.fa-question-circle.fa-lg', {
+ ariaHidden: true,
+ style: {
+ margin: '10px',
+ color: 'rgb(125, 128, 130)',
+ },
+ })
+ }
+ })(),
])
)
}
diff --git a/ui/app/components/panel.js b/ui/app/components/panel.js
index 5d72d6068..cbdc82982 100644
--- a/ui/app/components/panel.js
+++ b/ui/app/components/panel.js
@@ -1,23 +1,18 @@
const inherits = require('util').inherits
-const ethUtil = require('ethereumjs-util')
const Component = require('react').Component
const h = require('react-hyperscript')
const Identicon = require('./identicon')
module.exports = Panel
-
inherits(Panel, Component)
-function Panel() {
+function Panel () {
Component.call(this)
}
-Panel.prototype.render = function() {
+Panel.prototype.render = function () {
var state = this.props
- var identity = state.identity || {}
- var account = state.account || {}
- var isFauceting = state.isFauceting
var style = {
flex: '1 0 auto',
}
diff --git a/ui/app/components/pending-msg.js b/ui/app/components/pending-msg.js
index b0a6bb87d..7f3914d56 100644
--- a/ui/app/components/pending-msg.js
+++ b/ui/app/components/pending-msg.js
@@ -3,25 +3,21 @@ const h = require('react-hyperscript')
const inherits = require('util').inherits
const AccountPanel = require('./account-panel')
-const addressSummary = require('../util').addressSummary
const readableDate = require('../util').readableDate
-const formatBalance = require('../util').formatBalance
-const dataSize = require('../util').dataSize
module.exports = PendingMsg
-
inherits(PendingMsg, Component)
-function PendingMsg() {
+function PendingMsg () {
Component.call(this)
}
-PendingMsg.prototype.render = function() {
+PendingMsg.prototype.render = function () {
var state = this.props
var msgData = state.txData
var msgParams = msgData.msgParams || {}
- var address = msgParams.from || state.selectedAddress
+ var address = msgParams.from || state.selectedAddress
var identity = state.identities[address] || { address: address }
var account = state.accounts[address] || { address: address }
@@ -34,7 +30,7 @@ PendingMsg.prototype.render = function() {
style: {
fontWeight: 'bold',
textAlign: 'center',
- }
+ },
}, 'Sign Message'),
// account that will sign
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index 2bfb89705..1835239e5 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -6,22 +6,20 @@ const AccountPanel = require('./account-panel')
const addressSummary = require('../util').addressSummary
const readableDate = require('../util').readableDate
const formatBalance = require('../util').formatBalance
-const dataSize = require('../util').dataSize
module.exports = PendingTx
-
inherits(PendingTx, Component)
-function PendingTx() {
+function PendingTx () {
Component.call(this)
}
-PendingTx.prototype.render = function() {
+PendingTx.prototype.render = function () {
var state = this.props
var txData = state.txData
var txParams = txData.txParams || {}
- var address = txParams.from || state.selectedAddress
+ var address = txParams.from || state.selectedAddress
var identity = state.identities[address] || { address: address }
var account = state.accounts[address] || { address: address }
@@ -34,7 +32,7 @@ PendingTx.prototype.render = function() {
style: {
fontWeight: 'bold',
textAlign: 'center',
- }
+ },
}, 'Submit Transaction'),
// account that will sign
diff --git a/ui/app/components/template.js b/ui/app/components/template.js
index 9e4eca20f..b6ed8eaa0 100644
--- a/ui/app/components/template.js
+++ b/ui/app/components/template.js
@@ -4,16 +4,15 @@ const inherits = require('util').inherits
module.exports = NewComponent
-
inherits(NewComponent, Component)
-function NewComponent() {
+function NewComponent () {
Component.call(this)
}
-NewComponent.prototype.render = function() {
- var state = this.props
+NewComponent.prototype.render = function () {
+ const props = this.props
return (
- h('span', 'Placeholder component')
+ h('span', props.message)
)
}
diff --git a/ui/app/components/transaction-list-item-icon.js b/ui/app/components/transaction-list-item-icon.js
index fbee4b218..c640de551 100644
--- a/ui/app/components/transaction-list-item-icon.js
+++ b/ui/app/components/transaction-list-item-icon.js
@@ -6,20 +6,19 @@ const Identicon = require('./identicon')
module.exports = TransactionIcon
-
inherits(TransactionIcon, Component)
-function TransactionIcon() {
+function TransactionIcon () {
Component.call(this)
}
-TransactionIcon.prototype.render = function() {
- const { transaction, txParams, isTx, isMsg } = this.props
+TransactionIcon.prototype.render = function () {
+ const { transaction, txParams, isMsg } = this.props
if (transaction.status === 'rejected') {
return h('i.fa.fa-exclamation-triangle.fa-lg.error', {
style: {
width: '24px',
- }
+ },
})
}
@@ -27,7 +26,7 @@ TransactionIcon.prototype.render = function() {
return h('i.fa.fa-certificate.fa-lg', {
style: {
width: '24px',
- }
+ },
})
}
@@ -40,7 +39,7 @@ TransactionIcon.prototype.render = function() {
return h('i.fa.fa-file-text-o.fa-lg', {
style: {
width: '24px',
- }
+ },
})
}
}
diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js
index fc1c3c630..56f2103f3 100644
--- a/ui/app/components/transaction-list-item.js
+++ b/ui/app/components/transaction-list-item.js
@@ -5,20 +5,18 @@ const inherits = require('util').inherits
const EtherBalance = require('./eth-balance')
const addressSummary = require('../util').addressSummary
const explorerLink = require('../../lib/explorer-link')
-const formatBalance = require('../util').formatBalance
const vreme = new (require('vreme'))
const TransactionIcon = require('./transaction-list-item-icon')
module.exports = TransactionListItem
-
inherits(TransactionListItem, Component)
-function TransactionListItem() {
+function TransactionListItem () {
Component.call(this)
}
-TransactionListItem.prototype.render = function() {
+TransactionListItem.prototype.render = function () {
const { transaction, i, network } = this.props
var date = formatDate(transaction.time)
@@ -59,8 +57,8 @@ TransactionListItem.prototype.render = function() {
// large identicon
h('.identicon-wrapper.flex-column.flex-center.select-none', [
- transaction.status === 'unconfirmed' ? h('.red-dot', ' ') :
- h(TransactionIcon, { txParams, transaction, isTx, isMsg }),
+ transaction.status === 'unconfirmed' ? h('.red-dot', ' ')
+ : h(TransactionIcon, { txParams, transaction, isTx, isMsg }),
]),
h('.flex-column', [
@@ -76,24 +74,24 @@ TransactionListItem.prototype.render = function() {
)
}
-function domainField(txParams) {
+function domainField (txParams) {
return h('div', {
style: {
fontSize: 'small',
color: '#ABA9AA',
},
- },[
+ }, [
txParams.origin,
])
}
-function recipientField(txParams, transaction, isTx, isMsg) {
+function recipientField (txParams, transaction, isTx, isMsg) {
let message
if (isMsg) {
message = 'Signature Requested'
} else if (txParams.to) {
- message = addressSummary(txParams.to)
+ message = addressSummary(txParams.to)
} else {
message = 'Contract Published'
}
@@ -103,23 +101,17 @@ function recipientField(txParams, transaction, isTx, isMsg) {
fontSize: 'small',
color: '#ABA9AA',
},
- },[
+ }, [
message,
failIfFailed(transaction),
])
-
-}
-
-TransactionListItem.prototype.renderMessage = function() {
- const { transaction, i, network } = this.props
- return h('div', 'wowie, thats a message')
}
-function formatDate(date){
+function formatDate (date) {
return vreme.format(new Date(date), 'March 16 2014 14:30')
}
-function failIfFailed(transaction) {
+function failIfFailed (transaction) {
if (transaction.status === 'rejected') {
return h('span.error', ' (Rejected)')
}
diff --git a/ui/app/components/transaction-list.js b/ui/app/components/transaction-list.js
index ed2e1ee0a..a1a5db475 100644
--- a/ui/app/components/transaction-list.js
+++ b/ui/app/components/transaction-list.js
@@ -8,12 +8,12 @@ module.exports = TransactionList
inherits(TransactionList, Component)
-function TransactionList() {
+function TransactionList () {
Component.call(this)
}
-TransactionList.prototype.render = function() {
- const { txsToRender, network, unconfTxs, unconfMsgs } = this.props
+TransactionList.prototype.render = function () {
+ const { txsToRender, network, unconfMsgs } = this.props
const transactions = txsToRender.concat(unconfMsgs)
.sort((a, b) => b.time - a.time)
@@ -49,22 +49,21 @@ TransactionList.prototype.render = function() {
},
}, (
- transactions.length ?
- transactions.map((transaction, i) => {
+ transactions.length
+ ? transactions.map((transaction, i) => {
return h(TransactionListItem, {
transaction, i, network,
- showTx:(txId) => {
+ showTx: (txId) => {
this.props.viewPendingTx(txId)
},
})
})
- :
- [h('.flex-center', {
- style: {
- height: '100%',
- },
- }, 'No transaction history...')]
- ))
+ : [h('.flex-center', {
+ style: {
+ height: '100%',
+ },
+ }, 'No transaction history...')]
+ )),
])
)
}