Skip to content

Commit

Permalink
Merge pull request #140 from poanetwork/search-POA-tokens
Browse files Browse the repository at this point in the history
(Feature) Search tokens in POA network
  • Loading branch information
vbaranov committed Oct 2, 2018
2 parents 6d8e5cb + 5b742b9 commit d4adec4
Show file tree
Hide file tree
Showing 16 changed files with 236 additions and 87 deletions.
44 changes: 22 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,22 @@ workflows:
jobs:
prep-deps-npm:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ .Revision }}
- run:
name: Install npm 6 + deps via npm
command: |
sudo npm install -g npm@6.1.0 && npm install --no-save
sudo npm install -g npm@6.4.1 && npm install --no-save
- save_cache:
key: dependency-cache-{{ .Revision }}
paths:
- node_modules
prep-deps-firefox:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -126,7 +126,7 @@ jobs:

prep-build:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -145,7 +145,7 @@ jobs:

prep-docs:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -160,7 +160,7 @@ jobs:

prep-scss:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -179,7 +179,7 @@ jobs:

test-lint:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -190,7 +190,7 @@ jobs:

test-deps:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -201,7 +201,7 @@ jobs:

test-e2e-chrome:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -217,7 +217,7 @@ jobs:

test-e2e-firefox:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -238,7 +238,7 @@ jobs:

test-e2e-beta-chrome:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -254,7 +254,7 @@ jobs:

test-e2e-beta-firefox:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -275,7 +275,7 @@ jobs:

job-screens:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -292,7 +292,7 @@ jobs:

job-publish-prerelease:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -319,7 +319,7 @@ jobs:

job-publish-release:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -332,7 +332,7 @@ jobs:

job-publish-postrelease:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -355,7 +355,7 @@ jobs:

test-unit:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -368,7 +368,7 @@ jobs:
environment:
browsers: '["Firefox"]'
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -392,7 +392,7 @@ jobs:
environment:
browsers: '["Chrome"]'
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -411,7 +411,7 @@ jobs:
environment:
browsers: '["Firefox"]'
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -435,7 +435,7 @@ jobs:
environment:
browsers: '["Chrome"]'
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -452,7 +452,7 @@ jobs:

all-tests-pass:
docker:
- image: circleci/node:8.11.4-browsers
- image: circleci/node:8.12.0-browsers
steps:
- run:
name: All Tests Passed
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.11.4
v8.12.0
4 changes: 4 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ createCopyTasks('contractImages', {
source: './node_modules/eth-contract-metadata/images/',
destinations: commonPlatforms.map(platform => `./dist/${platform}/images/contract`),
})
createCopyTasks('contractImagesPOA', {
source: './node_modules/poa-contract-metadata/images/',
destinations: commonPlatforms.map(platform => `./dist/${platform}/images/contractPOA`),
})
createCopyTasks('fonts', {
source: './app/fonts/',
destinations: commonPlatforms.map(platform => `./dist/${platform}/fonts`),
Expand Down
30 changes: 24 additions & 6 deletions old-ui/app/components/add-token/add-token.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { Component } = React
const h = require('react-hyperscript')
const Tooltip = require('../tooltip.js')
const TabBar = require('../tab-bar')
const { checkExistingAddresses } = require('../../../../ui/app/components/pages/add-token/util')
const { checkExistingAddresses } = require('./util')
const TokenList = require('./token-list')
const TokenSearch = require('./token-search')
const { tokenInfoGetter } = require('../../../../ui/app/token-util')
Expand All @@ -24,6 +24,7 @@ class AddTokenScreen extends Component {
}

static propTypes = {
goHome: PropTypes.func,
setPendingTokens: PropTypes.func,
pendingTokens: PropTypes.object,
clearPendingTokens: PropTypes.func,
Expand Down Expand Up @@ -90,7 +91,8 @@ class AddTokenScreen extends Component {
const { network } = this.props
const networkID = parseInt(network)
let views = []
networkID === 1 ? views = [h(TabBar, {
const isProdNetwork = networkID === 1 || networkID === 99
isProdNetwork ? views = [h(TabBar, {
style: {
paddingTop: '0px',
},
Expand Down Expand Up @@ -258,15 +260,14 @@ class AddTokenScreen extends Component {
}

renderTabBar () {
const props = this.props
const state = this.state
const { tokenSelectorError, selectedTokens, searchResults } = state
const { clearPendingTokens, goHome } = props
const { tokenSelectorError, selectedTokens, searchResults } = this.state
const { clearPendingTokens, goHome, network } = this.props
return h('div', [
h('.add-token__search-token', [
h(TokenSearch, {
onSearch: ({ results = [] }) => this.setState({ searchResults: results }),
error: tokenSelectorError,
network: network,
}),
h('.add-token__token-list', {
style: {
Expand All @@ -278,6 +279,7 @@ class AddTokenScreen extends Component {
h(TokenList, {
results: searchResults,
selectedTokens: selectedTokens,
network: network,
onToggleToken: token => this.handleToggleToken(token),
}),
]),
Expand Down Expand Up @@ -312,6 +314,22 @@ class AddTokenScreen extends Component {
displayWarning('')
}

componentWillUpdate (nextProps) {
const {
network: oldNet,
} = this.props
const {
network: newNet,
} = nextProps

if (oldNet !== newNet) {
this.setState({
selectedTokens: {},
searchResults: [],
})
}
}

validateInputs () {
let msg = ''
const state = this.state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ export default class InfoBox extends Component {
}

static propTypes = {
network: PropTypes.string,
tokens: PropTypes.array,
results: PropTypes.array,
selectedTokens: PropTypes.object,
onToggleToken: PropTypes.func,
}

render () {
const { results = [], selectedTokens = {}, onToggleToken, tokens = [] } = this.props
const { results = [], selectedTokens = {}, onToggleToken, tokens = [], network } = this.props
const networkID = parseInt(network)
const imagesFolder = networkID === 1 ? 'images/contract' : 'images/contractPOA'

return results.length === 0
? <TokenListPlaceholder />
Expand All @@ -43,7 +46,7 @@ export default class InfoBox extends Component {
<div
className="token-list__token-icon"
style={{
'backgroundImage': logo && `url(images/contract/${logo})`,
'backgroundImage': logo && `url(${imagesFolder}/${logo})`,
}}
>
</div>
Expand Down
2 changes: 1 addition & 1 deletion old-ui/app/components/add-token/token-search/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import TokenSearch from './token-search.component'
import TokenSearch from './token-search.container'
module.exports = TokenSearch
Loading

0 comments on commit d4adec4

Please sign in to comment.