From ed3814bff8cf42218fe5a9f068b0474cac73807d Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 27 Oct 2016 16:16:28 -0700 Subject: Fix identicon rendering --- ui/app/components/identicon.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'ui/app/components') diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js index 4b2bf899e..30ef6fbd3 100644 --- a/ui/app/components/identicon.js +++ b/ui/app/components/identicon.js @@ -16,8 +16,8 @@ function IdenticonComponent () { } IdenticonComponent.prototype.render = function () { - var state = this.props - var diameter = state.diameter || this.defaultDiameter + var props = this.props + var diameter = props.diameter || this.defaultDiameter return ( h('div', { key: 'identicon-' + this.props.address, @@ -33,15 +33,14 @@ IdenticonComponent.prototype.render = function () { } IdenticonComponent.prototype.componentDidMount = function () { - var state = this.props - var address = state.address + var props = this.props + var address = props.address if (!address) return var container = findDOMNode(this) - var diameter = state.diameter || this.defaultDiameter - var imageify = state.imageify === undefined ? true : state.imageify - var img = iconFactory.iconForAddress(address, diameter, imageify) + var diameter = props.diameter || this.defaultDiameter + var img = iconFactory.iconForAddress(address, diameter, false) container.appendChild(img) } -- cgit From 25c46a16364612cd4bcebe375af910c08862b17a Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Sun, 30 Oct 2016 15:59:55 -0700 Subject: Make case condition more consistent. Remove extra action. Fix incorrect display of network. --- ui/app/components/network.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ui/app/components') diff --git a/ui/app/components/network.js b/ui/app/components/network.js index 845861396..ff5aefd41 100644 --- a/ui/app/components/network.js +++ b/ui/app/components/network.js @@ -36,13 +36,14 @@ Network.prototype.render = function () { } else if (providerName === 'mainnet') { hoverText = 'Main Ethereum Network' iconName = 'ethereum-network' - } else if (parseInt(networkNumber) === 2) { + } else if (providerName === 'testnet') { hoverText = 'Morden Test Network' iconName = 'morden-test-network' } else { hoverText = 'Unknown Private Network' iconName = 'unknown-private-network' } + return ( h('#network_component.flex-center.pointer', { style: { -- cgit From f2bfdd7f8ca4d79b3143f39a7bec3b585d9c74b7 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 1 Nov 2016 17:04:36 -0700 Subject: Make identicon tolerant of changing state --- ui/app/components/identicon.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ui/app/components') diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js index 30ef6fbd3..6d4871d02 100644 --- a/ui/app/components/identicon.js +++ b/ui/app/components/identicon.js @@ -44,3 +44,20 @@ IdenticonComponent.prototype.componentDidMount = function () { container.appendChild(img) } +IdenticonComponent.prototype.componentDidUpdate = function () { + var props = this.props + var address = props.address + + if (!address) return + + var container = findDOMNode(this) + + var children = container.children + for (var i = 0; i < children.length; i++) { + container.removeChild(children[i]) + } + + var diameter = props.diameter || this.defaultDiameter + var img = iconFactory.iconForAddress(address, diameter, false) + container.appendChild(img) +} -- cgit From 23263bec7d5100accd61f7648fd9355fc95e2bb7 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Fri, 11 Nov 2016 10:26:12 -0800 Subject: Linting to the max. --- ui/app/components/coinbase-form.js | 8 +++---- ui/app/components/copyButton.js | 4 +--- ui/app/components/drop-menu-item.js | 6 ++--- ui/app/components/network.js | 2 -- ui/app/components/pending-tx.js | 36 +++++++++++++++--------------- ui/app/components/shapeshift-form.js | 4 +--- ui/app/components/shift-list-item.js | 1 - ui/app/components/tooltip.js | 2 -- ui/app/components/transaction-list-item.js | 2 +- 9 files changed, 27 insertions(+), 38 deletions(-) (limited to 'ui/app/components') diff --git a/ui/app/components/coinbase-form.js b/ui/app/components/coinbase-form.js index 3c5708bf8..693eb2ea8 100644 --- a/ui/app/components/coinbase-form.js +++ b/ui/app/components/coinbase-form.js @@ -7,7 +7,7 @@ const actions = require('../actions') const isValidAddress = require('../util').isValidAddress module.exports = connect(mapStateToProps)(CoinbaseForm) -function mapStateToProps(state) { +function mapStateToProps (state) { return { selectedAccount: state.selectedAccount, warning: state.appState.warning, @@ -16,7 +16,7 @@ function mapStateToProps(state) { inherits(CoinbaseForm, Component) -function CoinbaseForm() { +function CoinbaseForm () { Component.call(this) } @@ -124,7 +124,6 @@ CoinbaseForm.prototype.toCoinbase = function () { } CoinbaseForm.prototype.renderLoading = function () { - return h('img', { style: { width: '27px', @@ -134,9 +133,8 @@ CoinbaseForm.prototype.renderLoading = function () { }) } -function isValidAmountforCoinBase(amount) { +function isValidAmountforCoinBase (amount) { amount = parseFloat(amount) - if (amount) { if (amount <= 5 && amount > 0) { return { diff --git a/ui/app/components/copyButton.js b/ui/app/components/copyButton.js index a01603585..a25d0719c 100644 --- a/ui/app/components/copyButton.js +++ b/ui/app/components/copyButton.js @@ -50,12 +50,10 @@ CopyButton.prototype.render = function () { ]) } -CopyButton.prototype.debounceRestore = function() { - +CopyButton.prototype.debounceRestore = function () { this.setState({ copied: true }) clearTimeout(this.timeout) this.timeout = setTimeout(() => { this.setState({ copied: false }) }, 850) - } diff --git a/ui/app/components/drop-menu-item.js b/ui/app/components/drop-menu-item.js index 8088680c0..5c06101df 100644 --- a/ui/app/components/drop-menu-item.js +++ b/ui/app/components/drop-menu-item.js @@ -32,9 +32,9 @@ DropMenuItem.prototype.render = function () { } DropMenuItem.prototype.activeNetworkRender = function () { - let activeNetwork = this.props.activeNetworkRender - let { provider } = this.props - let providerType = provider ? provider.type : null + const activeNetwork = this.props.activeNetworkRender + const { provider } = this.props + const providerType = provider ? provider.type : null if (activeNetwork === undefined) return switch (this.props.label) { diff --git a/ui/app/components/network.js b/ui/app/components/network.js index ff5aefd41..8e67dd741 100644 --- a/ui/app/components/network.js +++ b/ui/app/components/network.js @@ -22,7 +22,6 @@ Network.prototype.render = function () { let iconName, hoverText if (networkNumber === 'loading') { - return h('img.network-indicator', { title: 'Attempting to connect to blockchain.', onClick: (event) => this.props.onClick(event), @@ -32,7 +31,6 @@ Network.prototype.render = function () { }, src: 'images/loading.svg', }) - } else if (providerName === 'mainnet') { hoverText = 'Main Ethereum Network' iconName = 'ethereum-network' diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 96f968929..1fc2f47d0 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -30,22 +30,22 @@ PendingTx.prototype.render = function () { } `), - txData.simulationFails ? - h('.error', { - style: { - marginLeft: 50, - fontSize: '0.9em', - }, - }, 'Transaction Error. Exception thrown in contract code.') + txData.simulationFails + ? h('.error', { + style: { + marginLeft: 50, + fontSize: '0.9em', + }, + }, 'Transaction Error. Exception thrown in contract code.') : null, - state.insufficientBalance ? - h('span.error', { - style: { - marginLeft: 50, - fontSize: '0.9em', - }, - }, 'Insufficient balance for transaction') + state.insufficientBalance + ? h('span.error', { + style: { + marginLeft: 50, + fontSize: '0.9em', + }, + }, 'Insufficient balance for transaction') : null, // send + cancel @@ -57,10 +57,10 @@ PendingTx.prototype.render = function () { }, }, [ - state.insufficientBalance ? - h('button.btn-green', { - onClick: state.buyEth, - }, 'Buy Ether') + state.insufficientBalance + ? h('button.btn-green', { + onClick: state.buyEth, + }, 'Buy Ether') : null, h('button.confirm', { diff --git a/ui/app/components/shapeshift-form.js b/ui/app/components/shapeshift-form.js index 1da549288..383d5b623 100644 --- a/ui/app/components/shapeshift-form.js +++ b/ui/app/components/shapeshift-form.js @@ -8,7 +8,7 @@ const Qr = require('./qr-code') const isValidAddress = require('../util').isValidAddress module.exports = connect(mapStateToProps)(ShapeshiftForm) -function mapStateToProps(state) { +function mapStateToProps (state) { return { selectedAccount: state.selectedAccount, warning: state.appState.warning, @@ -25,7 +25,6 @@ function ShapeshiftForm () { } ShapeshiftForm.prototype.render = function () { - return h(ReactCSSTransitionGroup, { className: 'css-transition-group', transitionName: 'main', @@ -34,7 +33,6 @@ ShapeshiftForm.prototype.render = function () { }, [ this.props.qrRequested ? h(Qr, {key: 'qr'}) : this.renderMain(), ]) - } ShapeshiftForm.prototype.renderMain = function () { diff --git a/ui/app/components/shift-list-item.js b/ui/app/components/shift-list-item.js index 38c19eb28..e0243e247 100644 --- a/ui/app/components/shift-list-item.js +++ b/ui/app/components/shift-list-item.js @@ -26,7 +26,6 @@ function ShiftListItem () { } ShiftListItem.prototype.render = function () { - return ( h('.transaction-list-item.flex-row', { style: { diff --git a/ui/app/components/tooltip.js b/ui/app/components/tooltip.js index 757ad0cd6..edbc074bb 100644 --- a/ui/app/components/tooltip.js +++ b/ui/app/components/tooltip.js @@ -11,7 +11,6 @@ function Tooltip () { } Tooltip.prototype.render = function () { - const props = this.props const { position, title, children } = props @@ -20,5 +19,4 @@ Tooltip.prototype.render = function () { title, fixed: false, }, children) - } diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js index 491e90c7c..d1306549e 100644 --- a/ui/app/components/transaction-list-item.js +++ b/ui/app/components/transaction-list-item.js @@ -63,7 +63,7 @@ TransactionListItem.prototype.render = function () { style: { fontSize: '27px', }, - }) : h( '.pop-hover', { + }) : h('.pop-hover', { onClick: (event) => { event.stopPropagation() if (!isTx || isPending) return -- cgit From 0c23925c23ec620feadd97157e804ffa6d1003e6 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Fri, 11 Nov 2016 15:37:22 -0800 Subject: Fix lint rules for ternary operator placement. --- ui/app/components/pending-tx.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'ui/app/components') diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 1fc2f47d0..96f968929 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -30,22 +30,22 @@ PendingTx.prototype.render = function () { } `), - txData.simulationFails - ? h('.error', { - style: { - marginLeft: 50, - fontSize: '0.9em', - }, - }, 'Transaction Error. Exception thrown in contract code.') + txData.simulationFails ? + h('.error', { + style: { + marginLeft: 50, + fontSize: '0.9em', + }, + }, 'Transaction Error. Exception thrown in contract code.') : null, - state.insufficientBalance - ? h('span.error', { - style: { - marginLeft: 50, - fontSize: '0.9em', - }, - }, 'Insufficient balance for transaction') + state.insufficientBalance ? + h('span.error', { + style: { + marginLeft: 50, + fontSize: '0.9em', + }, + }, 'Insufficient balance for transaction') : null, // send + cancel @@ -57,10 +57,10 @@ PendingTx.prototype.render = function () { }, }, [ - state.insufficientBalance - ? h('button.btn-green', { - onClick: state.buyEth, - }, 'Buy Ether') + state.insufficientBalance ? + h('button.btn-green', { + onClick: state.buyEth, + }, 'Buy Ether') : null, h('button.confirm', { -- cgit