diff --git a/package.json b/package.json index b6ec1bed..a38c34af 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "test": "jest", "flow": "flow", "lint": "eslint src webpack .storybook", + "ci": "yarn lint && yarn flow && yarn prettier && yarn test", "postinstall": "bash ./scripts/postinstall.sh", "prettier": "prettier --write \"{src,webpack,.storybook}/**/*.js\"", "publish-storybook": "bash ./scripts/publish-storybook.sh", diff --git a/src/components/DeviceConnect/stories.js b/src/components/DeviceConnect/stories.js index 4b729e3d..1032e803 100644 --- a/src/components/DeviceConnect/stories.js +++ b/src/components/DeviceConnect/stories.js @@ -4,9 +4,16 @@ import React from 'react' import { storiesOf } from '@storybook/react' import { boolean, select, text } from '@storybook/addon-knobs' import { action } from '@storybook/addon-actions' +import { + getCryptoCurrencyById, + listCryptoCurrencies, +} from '@ledgerhq/live-common/lib/helpers/currencies' + +import type { Currency } from '@ledgerhq/live-common/lib/types' import DeviceConnect from 'components/DeviceConnect' +const currencies = listCryptoCurrencies().map(c => c.id) const stories = storiesOf('Components', module) const devices = [ @@ -34,12 +41,27 @@ const devices = [ ] stories.add('DeviceConnect', () => ( - + + {({ currency }) => ( + + )} + )) + +function Wrapper({ + currencyId, + children, +}: { + currencyId: string, + children: (props: { currency: Currency }) => any, +}) { + const currency = getCryptoCurrencyById(currencyId) + return children({ currency }) +} diff --git a/src/components/SelectAccount/index.js b/src/components/SelectAccount/index.js index f3fd2925..5ab4067a 100644 --- a/src/components/SelectAccount/index.js +++ b/src/components/SelectAccount/index.js @@ -22,8 +22,13 @@ const mapStateToProps = state => ({ }) const renderItem = a => { - const Icon = getCryptoCurrencyIcon(a) + const Icon = getCryptoCurrencyIcon(a.currency) const { color } = a.currency + + // FIXME: we need a non-hacky way to handle text ellipsis + const nameOuterStyle = { width: 0 } + const nameInnerStyle = { overflow: 'hidden', textOverflow: 'ellipsis' } + return ( {Icon && ( @@ -31,8 +36,8 @@ const renderItem = a => { )} - - + + {a.name}