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 { colors } from 'ts/utils/colors'; 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 = constants.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(); } } }