import { colors, constants as sharedConstants } from '@0xproject/react-shared'; import * as _ from 'lodash'; import { RadioButton, RadioButtonGroup } from 'material-ui/RadioButton'; import * as React from 'react'; import { Blockchain } from 'ts/blockchain'; import { Dispatcher } from 'ts/redux/dispatcher'; import { ProviderType } from 'ts/types'; import { constants } from 'ts/utils/constants'; interface ProviderPickerProps { networkId: number; injectedProviderName: string; providerType: ProviderType; onToggleLedgerDialog: () => void; dispatcher: Dispatcher; blockchain: Blockchain; } interface ProviderPickerState {} export class ProviderPicker extends React.Component { public render() { const isLedgerSelected = this.props.providerType === ProviderType.Ledger; const menuStyle = { padding: 10, paddingTop: 15, paddingBottom: 15, }; // Show dropdown with two options return (
); } private _renderLabel(title: string, shouldShowNetwork: boolean) { const label = (
{title}
{shouldShowNetwork && this._renderNetwork()}
); return label; } private _renderNetwork() { const networkName = sharedConstants.NETWORK_NAME_BY_ID[this.props.networkId]; return (
{networkName}
); } private _onProviderRadioChanged(value: string) { if (value === ProviderType.Ledger) { this.props.onToggleLedgerDialog(); } else { // tslint:disable-next-line:no-floating-promises this.props.blockchain.updateProviderToInjectedAsync(); } } }