import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Dropdown from '../../../components/ui/dropdown'; // Subviews import ZENDESK_URLS from '../../../helpers/constants/zendesk-url'; import JsonImportView from './json'; import PrivateKeyImportView from './private-key'; export default class AccountImportSubview extends Component { static contextTypes = { t: PropTypes.func, }; state = {}; getMenuItemTexts() { return [this.context.t('privateKey'), this.context.t('jsonFile')]; } renderImportView() { const { type } = this.state; const menuItems = this.getMenuItemTexts(); const current = type || menuItems[0]; switch (current) { case this.context.t('privateKey'): return ; case this.context.t('jsonFile'): return ; default: return ; } } render() { const menuItems = this.getMenuItemTexts(); const { type } = this.state; const { t } = this.context; return ( <>
{t('importAccount')}
{t('importAccountMsg')} { global.platform.openTab({ url: ZENDESK_URLS.IMPORTED_ACCOUNTS, }); }} > {t('here')}
{t('selectType')}
({ value: text }))} selectedOption={type || menuItems[0]} onChange={(value) => { this.setState({ type: value }); }} />
{this.renderImportView()}
); } }