GenerateWallet.tsx
1 import React, { Component } from 'react'; 2 import { Route, Switch } from 'react-router'; 3 import { RouteComponentProps } from 'react-router-dom'; 4 5 import TabSection from 'containers/TabSection'; 6 import { RouteNotFound } from 'components/RouteNotFound'; 7 import Keystore from './components/Keystore'; 8 import Mnemonic from './components/Mnemonic'; 9 import WalletTypes from './components/WalletTypes'; 10 import CryptoWarning from './components/CryptoWarning'; 11 12 export enum WalletType { 13 Keystore = 'keystore', 14 Mnemonic = 'mnemonic' 15 } 16 17 export default class GenerateWallet extends Component<RouteComponentProps<{}>> { 18 public render() { 19 const currentPath = this.props.match.url; 20 return ( 21 <React.Fragment> 22 <TabSection> 23 <section className="Tab-content"> 24 {window.crypto ? ( 25 <Switch> 26 <Route exact={true} path={currentPath} component={WalletTypes} /> 27 <Route exact={true} path={`${currentPath}/keystore`} component={Keystore} /> 28 <Route exact={true} path={`${currentPath}/mnemonic`} component={Mnemonic} /> 29 <RouteNotFound /> 30 </Switch> 31 ) : ( 32 <CryptoWarning /> 33 )} 34 </section> 35 </TabSection> 36 </React.Fragment> 37 ); 38 } 39 }