diff --git a/common/Root.tsx b/common/Root.tsx index b75f17f3..e21c63ba 100644 --- a/common/Root.tsx +++ b/common/Root.tsx @@ -45,6 +45,10 @@ export default class Root extends Component {
+ + + + diff --git a/common/actions/generateWallet/actionCreators.ts b/common/actions/generateWallet/actionCreators.ts deleted file mode 100644 index 88bf4c8e..00000000 --- a/common/actions/generateWallet/actionCreators.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { generate } from 'ethereumjs-wallet'; -import * as interfaces from './actionTypes'; -import { TypeKeys } from './constants'; - -export type TGenerateNewWallet = typeof generateNewWallet; -export function generateNewWallet(password: string): interfaces.GenerateNewWalletAction { - return { - type: TypeKeys.GENERATE_WALLET_GENERATE_WALLET, - wallet: generate(), - password - }; -} - -export type TContinueToPaper = typeof continueToPaper; -export function continueToPaper(): interfaces.ContinueToPaperAction { - return { type: TypeKeys.GENERATE_WALLET_CONTINUE_TO_PAPER }; -} - -export type TResetGenerateWallet = typeof resetGenerateWallet; -export function resetGenerateWallet(): interfaces.ResetGenerateWalletAction { - return { type: TypeKeys.GENERATE_WALLET_RESET }; -} diff --git a/common/actions/generateWallet/actionTypes.ts b/common/actions/generateWallet/actionTypes.ts deleted file mode 100644 index bfb811fd..00000000 --- a/common/actions/generateWallet/actionTypes.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { IFullWallet } from 'ethereumjs-wallet'; -import { TypeKeys } from './constants'; - -/*** Generate Wallet File ***/ -export interface GenerateNewWalletAction { - type: TypeKeys.GENERATE_WALLET_GENERATE_WALLET; - wallet: IFullWallet; - password: string; -} - -/*** Reset Generate Wallet ***/ -export interface ResetGenerateWalletAction { - type: TypeKeys.GENERATE_WALLET_RESET; -} - -/*** Confirm Continue To Paper ***/ -export interface ContinueToPaperAction { - type: TypeKeys.GENERATE_WALLET_CONTINUE_TO_PAPER; -} - -/*** Action Union ***/ -export type GenerateWalletAction = - | GenerateNewWalletAction - | ContinueToPaperAction - | ResetGenerateWalletAction; diff --git a/common/actions/generateWallet/constants.ts b/common/actions/generateWallet/constants.ts deleted file mode 100644 index d872f337..00000000 --- a/common/actions/generateWallet/constants.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum TypeKeys { - GENERATE_WALLET_GENERATE_WALLET = 'GENERATE_WALLET_GENERATE_WALLET', - GENERATE_WALLET_CONTINUE_TO_PAPER = 'GENERATE_WALLET_CONTINUE_TO_PAPER', - GENERATE_WALLET_RESET = 'GENERATE_WALLET_RESET' -} diff --git a/common/actions/generateWallet/index.ts b/common/actions/generateWallet/index.ts deleted file mode 100644 index fee14683..00000000 --- a/common/actions/generateWallet/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './constants'; -export * from './actionTypes'; -export * from './actionCreators'; diff --git a/common/assets/images/unlock-guide/provide-keystore.png b/common/assets/images/unlock-guide/provide-keystore.png new file mode 100644 index 00000000..50d73285 Binary files /dev/null and b/common/assets/images/unlock-guide/provide-keystore.png differ diff --git a/common/assets/images/unlock-guide/provide-mnemonic.png b/common/assets/images/unlock-guide/provide-mnemonic.png new file mode 100644 index 00000000..c86327e2 Binary files /dev/null and b/common/assets/images/unlock-guide/provide-mnemonic.png differ diff --git a/common/assets/images/unlock-guide/select-keystore.png b/common/assets/images/unlock-guide/select-keystore.png new file mode 100644 index 00000000..66484f84 Binary files /dev/null and b/common/assets/images/unlock-guide/select-keystore.png differ diff --git a/common/assets/images/unlock-guide/select-mnemonic.png b/common/assets/images/unlock-guide/select-mnemonic.png new file mode 100644 index 00000000..7ef09c08 Binary files /dev/null and b/common/assets/images/unlock-guide/select-mnemonic.png differ diff --git a/common/assets/images/unlock-guide/site.png b/common/assets/images/unlock-guide/site.png new file mode 100644 index 00000000..fc612020 Binary files /dev/null and b/common/assets/images/unlock-guide/site.png differ diff --git a/common/assets/images/unlock-guide/tab.png b/common/assets/images/unlock-guide/tab.png new file mode 100644 index 00000000..edbf0bf0 Binary files /dev/null and b/common/assets/images/unlock-guide/tab.png differ diff --git a/common/components/Header/components/Navigation.tsx b/common/components/Header/components/Navigation.tsx index c90402f5..ce8b58e1 100644 --- a/common/components/Header/components/Navigation.tsx +++ b/common/components/Header/components/Navigation.tsx @@ -7,7 +7,7 @@ import './Navigation.scss'; const tabs = [ { name: 'NAV_GenerateWallet', - to: '/' + to: '/generate' }, { @@ -90,7 +90,7 @@ export default class Navigation extends Component {
    {tabs.map(link => { - return ; + return ; })}
diff --git a/common/components/Header/components/NavigationLink.tsx b/common/components/Header/components/NavigationLink.tsx index c3d76b7e..ecab5d69 100644 --- a/common/components/Header/components/NavigationLink.tsx +++ b/common/components/Header/components/NavigationLink.tsx @@ -10,16 +10,25 @@ interface Props extends RouteComponentProps<{}> { to?: string; external?: boolean; }; + isHomepage: boolean; } class NavigationLink extends React.Component { public render() { - const { link, location } = this.props; + const { link, location, isHomepage } = this.props; + // isActive if + // 1) Current path is the same as link + // 2) the first path is the same for both links (/account and /account/send) + // 3) we're at the root path and this is the "homepage" nav item + const isActive = + location.pathname === link.to || + (link.to && location.pathname.split('/')[1] === link.to.split('/')[1]) || + (isHomepage && location.pathname === '/'); const linkClasses = classnames({ 'NavigationLink-link': true, 'is-disabled': !link.to, - 'is-active': location.pathname === link.to + 'is-active': isActive }); const linkLabel = `nav item: ${translateRaw(link.name)}`; diff --git a/common/components/PrintableWallet/index.tsx b/common/components/PrintableWallet/index.tsx index a689a295..f22d811c 100644 --- a/common/components/PrintableWallet/index.tsx +++ b/common/components/PrintableWallet/index.tsx @@ -1,7 +1,7 @@ import { PaperWallet } from 'components'; import { IFullWallet } from 'ethereumjs-wallet'; import React from 'react'; -import translate from 'translations'; +import { translateRaw } from 'translations'; import printElement from 'utils/printElement'; import { stripHexPrefix } from 'libs/values'; @@ -39,13 +39,13 @@ const PrintableWallet: React.SFC<{ wallet: IFullWallet }> = ({ wallet }) => { - {translate('x_Print')} + {translateRaw('x_Print')}
); diff --git a/common/components/ui/NewTabLink.tsx b/common/components/ui/NewTabLink.tsx index fa74a270..35fcf165 100644 --- a/common/components/ui/NewTabLink.tsx +++ b/common/components/ui/NewTabLink.tsx @@ -36,7 +36,7 @@ interface NewTabLinkProps extends AAttributes { const NewTabLink = ({ content, children, ...rest }: NewTabLinkProps) => ( - {content || children} {/* Keep content for short-hand text insertion */} + {content || children} ); diff --git a/common/containers/Tabs/GenerateWallet/GenerateWallet.tsx b/common/containers/Tabs/GenerateWallet/GenerateWallet.tsx new file mode 100644 index 00000000..670ab2d6 --- /dev/null +++ b/common/containers/Tabs/GenerateWallet/GenerateWallet.tsx @@ -0,0 +1,37 @@ +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> { + public render() { + const walletType = this.props.location.pathname.split('/')[2]; + let content; + + if (window.crypto) { + if (walletType === WalletType.Mnemonic) { + content = ; + } else if (walletType === WalletType.Keystore) { + content = ; + } else { + content = ; + } + } else { + content = ; + } + + return ( + +
{content}
+
+ ); + } +} diff --git a/common/containers/Tabs/GenerateWallet/components/DownloadWallet.tsx b/common/containers/Tabs/GenerateWallet/components/DownloadWallet.tsx deleted file mode 100644 index 3f725576..00000000 --- a/common/containers/Tabs/GenerateWallet/components/DownloadWallet.tsx +++ /dev/null @@ -1,135 +0,0 @@ -import { ContinueToPaperAction } from 'actions/generateWallet'; -import { IFullWallet, IV3Wallet } from 'ethereumjs-wallet'; -import { toChecksumAddress } from 'ethereumjs-util'; -import { NewTabLink } from 'components/ui'; -import React, { Component } from 'react'; -import translate from 'translations'; -import { makeBlob } from 'utils/blob'; -import './DownloadWallet.scss'; -import Template from './Template'; -import { N_FACTOR, knowledgeBaseURL } from 'config/data'; - -interface Props { - wallet: IFullWallet; - password: string; - continueToPaper(): ContinueToPaperAction; -} - -interface State { - hasDownloadedWallet: boolean; - keystore: IV3Wallet | null; -} - -export default class DownloadWallet extends Component { - public state: State = { - hasDownloadedWallet: false, - keystore: null - }; - - public componentWillMount() { - this.setWallet(this.props.wallet, this.props.password); - } - - public componentWillUpdate(nextProps: Props) { - if (this.props.wallet !== nextProps.wallet) { - this.setWallet(nextProps.wallet, nextProps.password); - } - } - - public render() { - const { hasDownloadedWallet } = this.state; - const filename = this.props.wallet.getV3Filename(); - - const content = ( -
-

{translate('GEN_Label_2')}

- - - {translate('x_Download')} {translate('x_Keystore2')} - - -
-

- Do not lose it! It cannot be recovered if you lose it. -

-

- Do not share it! Your funds will be stolen if you use this file on a - malicious/phishing site. -

-

- Make a backup! Secure it like the millions of dollars it may one day be - worth. -

-
- - -
- ); - - const help = ( -
-

{translate('GEN_Help_8')}

-
    -
  • {translate('GEN_Help_9')}
  • -
  • {translate('GEN_Help_10')}
  • - -
- -

{translate('GEN_Help_11')}

-
    -
  • {translate('GEN_Help_12')}
  • -
- -

{translate('GEN_Help_4')}

-
    -
  • - - {translate('GEN_Help_13')} - -
  • -
  • - - {translate('GEN_Help_14')} - -
  • -
-
- ); - - return