William O'Beirne 6513acd03d Generate Mnemonic Wallet (#659)
* Initial work at splitting out generate into two flows.

* Finish mnemonic flow.

* Convert keystore to state-based component. Remove all redux generate stuff. Remove generate help section. Fix styles.

* Add back button, switch to routing instead of state for generate pages.

* PR feedback.

* Alertify warning at generate. Linkify alternatives. Fix some alert link styles.
2017-12-28 13:54:07 -06:00

38 lines
1.0 KiB
TypeScript

import React, { Component } from 'react';
import Keystore from './components/Keystore';
import Mnemonic from './components/Mnemonic';
import WalletTypes from './components/WalletTypes';
import CryptoWarning from './components/CryptoWarning';
import TabSection from 'containers/TabSection';
import { RouteComponentProps } from 'react-router-dom';
export enum WalletType {
Keystore = 'keystore',
Mnemonic = 'mnemonic'
}
export default class GenerateWallet extends Component<RouteComponentProps<{}>> {
public render() {
const walletType = this.props.location.pathname.split('/')[2];
let content;
if (window.crypto) {
if (walletType === WalletType.Mnemonic) {
content = <Mnemonic />;
} else if (walletType === WalletType.Keystore) {
content = <Keystore />;
} else {
content = <WalletTypes />;
}
} else {
content = <CryptoWarning />;
}
return (
<TabSection>
<section className="Tab-content">{content}</section>
</TabSection>
);
}
}