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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
8 additions and
30 deletions
-
package.json
-
src/components/SelectCurrency/index.js
-
src/components/modals/AddAccount/01-step-currency.js
-
src/helpers/btc.js
|
|
@ -14,7 +14,6 @@ |
|
|
|
"flow": "flow", |
|
|
|
"lint": "eslint src webpack .storybook", |
|
|
|
"postinstall": "bash ./scripts/postinstall.sh", |
|
|
|
"precommit": "lint-staged", |
|
|
|
"prettier": "prettier --write \"{src,webpack,.storybook}/**/*.js\"", |
|
|
|
"publish-storybook": "bash ./scripts/publish-storybook.sh", |
|
|
|
"release": "build", |
|
|
@ -22,13 +21,6 @@ |
|
|
|
"storybook": "NODE_ENV=development STORYBOOK_ENV=1 start-storybook -s ./static -p 4444", |
|
|
|
"trans": "node scripts/trans" |
|
|
|
}, |
|
|
|
"lint-staged": { |
|
|
|
"*.js": [ |
|
|
|
"eslint --fix", |
|
|
|
"prettier --write", |
|
|
|
"git add" |
|
|
|
] |
|
|
|
}, |
|
|
|
"electronWebpack": { |
|
|
|
"title": true, |
|
|
|
"renderer": { |
|
|
@ -139,7 +131,6 @@ |
|
|
|
"husky": "^0.14.3", |
|
|
|
"jest": "^22.4.3", |
|
|
|
"js-yaml": "^3.10.0", |
|
|
|
"lint-staged": "^7.0.4", |
|
|
|
"node-loader": "^0.6.0", |
|
|
|
"prettier": "^1.12.1", |
|
|
|
"react-hot-loader": "^4.1.0", |
|
|
|
|
|
@ -32,10 +32,11 @@ const currencies = listCryptoCurrencies().sort((a, b) => a.name.localeCompare(b. |
|
|
|
type Props = { |
|
|
|
onChange: Function, |
|
|
|
value?: CryptoCurrency, |
|
|
|
placeholder: string, |
|
|
|
t: T, |
|
|
|
} |
|
|
|
|
|
|
|
const SelectCurrency = ({ onChange, value, t, ...props }: Props) => ( |
|
|
|
const SelectCurrency = ({ onChange, value, t, placeholder, ...props }: Props) => ( |
|
|
|
<Select |
|
|
|
{...props} |
|
|
|
value={value} |
|
|
@ -43,7 +44,7 @@ const SelectCurrency = ({ onChange, value, t, ...props }: Props) => ( |
|
|
|
renderItem={renderItem} |
|
|
|
keyProp="id" |
|
|
|
items={currencies} |
|
|
|
placeholder={t('common:selectCurrency')} |
|
|
|
placeholder={placeholder || t('common:selectCurrency')} |
|
|
|
fontSize={4} |
|
|
|
onChange={onChange} |
|
|
|
/> |
|
|
|
|
|
@ -2,22 +2,12 @@ |
|
|
|
|
|
|
|
import React from 'react' |
|
|
|
|
|
|
|
import { listCryptoCurrencies } from '@ledgerhq/live-common/lib/helpers/currencies' |
|
|
|
|
|
|
|
import type { CryptoCurrency } from '@ledgerhq/live-common/lib/types' |
|
|
|
import type { T } from 'types/common' |
|
|
|
|
|
|
|
import get from 'lodash/get' |
|
|
|
|
|
|
|
import Box from 'components/base/Box' |
|
|
|
import Label from 'components/base/Label' |
|
|
|
import Select from 'components/base/Select' |
|
|
|
|
|
|
|
const currencies = listCryptoCurrencies().map(currency => ({ |
|
|
|
key: currency.id, |
|
|
|
name: currency.name, |
|
|
|
data: currency, |
|
|
|
})) |
|
|
|
import SelectCurrency from 'components/SelectCurrency' |
|
|
|
|
|
|
|
type Props = { |
|
|
|
onChangeCurrency: Function, |
|
|
@ -28,14 +18,10 @@ type Props = { |
|
|
|
export default (props: Props) => ( |
|
|
|
<Box flow={1}> |
|
|
|
<Label>{props.t('common:currency')}</Label> |
|
|
|
<Select |
|
|
|
<SelectCurrency |
|
|
|
placeholder={props.t('common:chooseWalletPlaceholder')} |
|
|
|
onChange={item => props.onChangeCurrency(item.data)} |
|
|
|
renderSelected={item => item.name} |
|
|
|
items={currencies} |
|
|
|
value={ |
|
|
|
props.currency ? currencies.find(c => c.key === get(props, 'currency.coinType')) : null |
|
|
|
} |
|
|
|
onChange={props.onChangeCurrency} |
|
|
|
value={props.currency} |
|
|
|
/> |
|
|
|
</Box> |
|
|
|
) |
|
|
|
|
|
@ -17,7 +17,7 @@ export const networks = { |
|
|
|
...bitcoin.networks.bitcoin, |
|
|
|
family: 1, |
|
|
|
}, |
|
|
|
testnet: { |
|
|
|
bitcoin_testnet: { |
|
|
|
...bitcoin.networks.testnet, |
|
|
|
family: 1, |
|
|
|
}, |
|
|
|