|
@ -6,12 +6,11 @@ import type { Exchange } from '@ledgerhq/live-common/lib/countervalues/types' |
|
|
import logger from 'logger' |
|
|
import logger from 'logger' |
|
|
|
|
|
|
|
|
import Select from 'components/base/Select' |
|
|
import Select from 'components/base/Select' |
|
|
import Spinner from 'components/base/Spinner' |
|
|
|
|
|
import Text from 'components/base/Text' |
|
|
import Text from 'components/base/Text' |
|
|
import CounterValues from 'helpers/countervalues' |
|
|
import CounterValues from 'helpers/countervalues' |
|
|
import type { T } from 'types/common' |
|
|
import type { T } from 'types/common' |
|
|
|
|
|
|
|
|
class ExchangeSelect extends Component< |
|
|
class SelectExchange extends Component< |
|
|
{ |
|
|
{ |
|
|
from: Currency, |
|
|
from: Currency, |
|
|
to: Currency, |
|
|
to: Currency, |
|
@ -84,21 +83,20 @@ class ExchangeSelect extends Component< |
|
|
|
|
|
|
|
|
const options = exchanges ? exchanges.map(e => ({ value: e.id, label: e.name, ...e })) : [] |
|
|
const options = exchanges ? exchanges.map(e => ({ value: e.id, label: e.name, ...e })) : [] |
|
|
|
|
|
|
|
|
return exchanges && exchanges.length > 0 ? ( |
|
|
return error ? ( |
|
|
|
|
|
<Text ff="Open Sans|SemiBold" color="dark" fontSize={4}> |
|
|
|
|
|
{t('app:common.error.load')} |
|
|
|
|
|
</Text> |
|
|
|
|
|
) : ( |
|
|
<Select |
|
|
<Select |
|
|
value={options.find(e => e.id === exchangeId)} |
|
|
value={options.find(e => e.id === exchangeId)} |
|
|
options={options} |
|
|
options={options} |
|
|
onChange={onChange} |
|
|
onChange={onChange} |
|
|
|
|
|
isLoading={options.length === 0} |
|
|
{...props} |
|
|
{...props} |
|
|
/> |
|
|
/> |
|
|
) : error ? ( |
|
|
|
|
|
<Text ff="Open Sans|SemiBold" color="dark" fontSize={4}> |
|
|
|
|
|
{t('app:common.error.load')} |
|
|
|
|
|
</Text> |
|
|
|
|
|
) : ( |
|
|
|
|
|
<Spinner color="grey" size={24} /> |
|
|
|
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export default translate()(ExchangeSelect) |
|
|
export default translate()(SelectExchange) |
|
|