Browse Source

Merge pull request #9 from meriadec/migrate-live-common-fixes

Migrate live common fixes
master
Gaëtan Renaudeau 7 years ago
committed by GitHub
parent
commit
888959f105
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      package.json
  2. 5
      src/components/SelectCurrency/index.js
  3. 22
      src/components/modals/AddAccount/01-step-currency.js
  4. 2
      src/helpers/btc.js

9
package.json

@ -14,7 +14,6 @@
"flow": "flow", "flow": "flow",
"lint": "eslint src webpack .storybook", "lint": "eslint src webpack .storybook",
"postinstall": "bash ./scripts/postinstall.sh", "postinstall": "bash ./scripts/postinstall.sh",
"precommit": "lint-staged",
"prettier": "prettier --write \"{src,webpack,.storybook}/**/*.js\"", "prettier": "prettier --write \"{src,webpack,.storybook}/**/*.js\"",
"publish-storybook": "bash ./scripts/publish-storybook.sh", "publish-storybook": "bash ./scripts/publish-storybook.sh",
"release": "build", "release": "build",
@ -22,13 +21,6 @@
"storybook": "NODE_ENV=development STORYBOOK_ENV=1 start-storybook -s ./static -p 4444", "storybook": "NODE_ENV=development STORYBOOK_ENV=1 start-storybook -s ./static -p 4444",
"trans": "node scripts/trans" "trans": "node scripts/trans"
}, },
"lint-staged": {
"*.js": [
"eslint --fix",
"prettier --write",
"git add"
]
},
"electronWebpack": { "electronWebpack": {
"title": true, "title": true,
"renderer": { "renderer": {
@ -139,7 +131,6 @@
"husky": "^0.14.3", "husky": "^0.14.3",
"jest": "^22.4.3", "jest": "^22.4.3",
"js-yaml": "^3.10.0", "js-yaml": "^3.10.0",
"lint-staged": "^7.0.4",
"node-loader": "^0.6.0", "node-loader": "^0.6.0",
"prettier": "^1.12.1", "prettier": "^1.12.1",
"react-hot-loader": "^4.1.0", "react-hot-loader": "^4.1.0",

5
src/components/SelectCurrency/index.js

@ -32,10 +32,11 @@ const currencies = listCryptoCurrencies().sort((a, b) => a.name.localeCompare(b.
type Props = { type Props = {
onChange: Function, onChange: Function,
value?: CryptoCurrency, value?: CryptoCurrency,
placeholder: string,
t: T, t: T,
} }
const SelectCurrency = ({ onChange, value, t, ...props }: Props) => ( const SelectCurrency = ({ onChange, value, t, placeholder, ...props }: Props) => (
<Select <Select
{...props} {...props}
value={value} value={value}
@ -43,7 +44,7 @@ const SelectCurrency = ({ onChange, value, t, ...props }: Props) => (
renderItem={renderItem} renderItem={renderItem}
keyProp="id" keyProp="id"
items={currencies} items={currencies}
placeholder={t('common:selectCurrency')} placeholder={placeholder || t('common:selectCurrency')}
fontSize={4} fontSize={4}
onChange={onChange} onChange={onChange}
/> />

22
src/components/modals/AddAccount/01-step-currency.js

@ -2,22 +2,12 @@
import React from 'react' import React from 'react'
import { listCryptoCurrencies } from '@ledgerhq/live-common/lib/helpers/currencies'
import type { CryptoCurrency } from '@ledgerhq/live-common/lib/types' import type { CryptoCurrency } from '@ledgerhq/live-common/lib/types'
import type { T } from 'types/common' import type { T } from 'types/common'
import get from 'lodash/get'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import Label from 'components/base/Label' import Label from 'components/base/Label'
import Select from 'components/base/Select' import SelectCurrency from 'components/SelectCurrency'
const currencies = listCryptoCurrencies().map(currency => ({
key: currency.id,
name: currency.name,
data: currency,
}))
type Props = { type Props = {
onChangeCurrency: Function, onChangeCurrency: Function,
@ -28,14 +18,10 @@ type Props = {
export default (props: Props) => ( export default (props: Props) => (
<Box flow={1}> <Box flow={1}>
<Label>{props.t('common:currency')}</Label> <Label>{props.t('common:currency')}</Label>
<Select <SelectCurrency
placeholder={props.t('common:chooseWalletPlaceholder')} placeholder={props.t('common:chooseWalletPlaceholder')}
onChange={item => props.onChangeCurrency(item.data)} onChange={props.onChangeCurrency}
renderSelected={item => item.name} value={props.currency}
items={currencies}
value={
props.currency ? currencies.find(c => c.key === get(props, 'currency.coinType')) : null
}
/> />
</Box> </Box>
) )

2
src/helpers/btc.js

@ -17,7 +17,7 @@ export const networks = {
...bitcoin.networks.bitcoin, ...bitcoin.networks.bitcoin,
family: 1, family: 1,
}, },
testnet: { bitcoin_testnet: {
...bitcoin.networks.testnet, ...bitcoin.networks.testnet,
family: 1, family: 1,
}, },

Loading…
Cancel
Save