diff --git a/src/js/actions/LocalStorageActions.js b/src/js/actions/LocalStorageActions.js index 113f04c9..a6809c0f 100644 --- a/src/js/actions/LocalStorageActions.js +++ b/src/js/actions/LocalStorageActions.js @@ -12,6 +12,9 @@ import { JSONRequest, httpRequest } from '../utils/networkUtils'; import type { ThunkAction, AsyncAction, GetState, Dispatch, TrezorDevice } from '../flowtype'; import type { Config, Coin, TokensCollection } from '../reducers/LocalStorageReducer'; +import AppConfigJSON from '~/data/appConfig.json'; +import Erc20AbiJSON from '~/data/ERC20Abi.json'; + export type StorageAction = { type: typeof STORAGE.READY, config: Config, @@ -85,8 +88,8 @@ export function loadTokensFromJSON(): AsyncAction { if (typeof window.localStorage === 'undefined') return; try { - const config: Config = await httpRequest('data/appConfig.json', 'json'); - const ERC20Abi = await httpRequest('data/ERC20Abi.json', 'json'); + const config: Config = await httpRequest(AppConfigJSON, 'json'); + const ERC20Abi = await httpRequest(Erc20AbiJSON, 'json'); window.addEventListener('storage', event => { dispatch( update(event) ); diff --git a/src/js/components/wallet/Receive.js b/src/js/components/wallet/account/receive/Receive.js similarity index 53% rename from src/js/components/wallet/Receive.js rename to src/js/components/wallet/account/receive/Receive.js index baba3fc5..7ad4f33c 100644 --- a/src/js/components/wallet/Receive.js +++ b/src/js/components/wallet/account/receive/Receive.js @@ -2,37 +2,17 @@ 'use strict'; import React, { Component } from 'react'; -import { bindActionCreators } from 'redux'; -import { connect } from 'react-redux'; import Tooltip from 'rc-tooltip'; import { QRCode } from 'react-qr-svg'; -import AbstractAccount from './account/AbstractAccount'; -import { Notification } from '../common/Notification'; -import { default as ReceiveActions } from '../../actions/ReceiveActions'; -import { default as AbstractAccountActions } from '../../actions/AbstractAccountActions'; +import AbstractAccount from '../AbstractAccount'; +import { Notification } from '../../../common/Notification'; -import type { MapStateToProps, MapDispatchToProps } from 'react-redux'; -import type { State, Dispatch } from '../../flowtype'; -import type { StateProps as BaseStateProps, DispatchProps as BaseDispatchProps } from './account/AbstractAccount'; +import type { AccountState } from '../AbstractAccount'; +import type { Props } from './index'; -import type { AccountState } from './account/AbstractAccount'; - -type OwnProps = { } - -type StateProps = BaseStateProps & { - receive: $ElementType, -} - -type DispatchProps = BaseDispatchProps & { - showAddress: typeof ReceiveActions.showAddress -} - -type Props = StateProps & DispatchProps; - - -class Receive extends AbstractAccount { +export default class Receive extends AbstractAccount { render() { return super.render() || _render(this.props, this.state); } @@ -58,7 +38,7 @@ const _render = (props: Props, state: AccountState): React$Element => { let address = `${account.address.substring(0, 20)}...`; let className = 'address hidden'; let button = ( - ); @@ -87,7 +67,7 @@ const _render = (props: Props, state: AccountState): React$Element => { arrowContent={
} overlay={ tooltip } placement="bottomRight"> - @@ -108,27 +88,4 @@ const _render = (props: Props, state: AccountState): React$Element => { { qrCode } ); - - -} - -const mapStateToProps: MapStateToProps = (state: State, own: OwnProps): StateProps => { - return { - abstractAccount: state.abstractAccount, - devices: state.connect.devices, - accounts: state.accounts, - discovery: state.discovery, - receive: state.receive - }; -} - -const mapDispatchToProps: MapDispatchToProps = (dispatch: Dispatch): DispatchProps => { - return { - abstractAccountActions: bindActionCreators(AbstractAccountActions, dispatch), - initAccount: bindActionCreators(ReceiveActions.init, dispatch), - disposeAccount: bindActionCreators(ReceiveActions.dispose, dispatch), - showAddress: bindActionCreators(ReceiveActions.showAddress, dispatch), - }; -} - -export default connect(mapStateToProps, mapDispatchToProps)(Receive); \ No newline at end of file +} \ No newline at end of file diff --git a/src/js/components/wallet/account/receive/index.js b/src/js/components/wallet/account/receive/index.js new file mode 100644 index 00000000..34b10bf0 --- /dev/null +++ b/src/js/components/wallet/account/receive/index.js @@ -0,0 +1,54 @@ +/* @flow */ +'use strict'; + +import React, { Component, PropTypes } from 'react'; +import { bindActionCreators } from 'redux'; +import { connect } from 'react-redux'; + +import { default as ReceiveActions } from '../../../../actions/ReceiveActions'; +import { default as AbstractAccountActions } from '../../../../actions/AbstractAccountActions'; +import * as TokenActions from '../../../../actions/TokenActions'; +import Receive from './Receive'; + +import type { MapStateToProps, MapDispatchToProps } from 'react-redux'; +import type { State, Dispatch } from '../../../../flowtype'; +import type { + StateProps as BaseStateProps, + DispatchProps as BaseDispatchProps +} from '../AbstractAccount'; + +import type { AccountState } from '../AbstractAccount'; + +type OwnProps = { } + +type StateProps = BaseStateProps & { + receive: $ElementType, +} + +type DispatchProps = BaseDispatchProps & { + showAddress: typeof ReceiveActions.showAddress +}; + +export type Props = StateProps & DispatchProps; + +const mapStateToProps: MapStateToProps = (state: State, own: OwnProps): StateProps => { + return { + abstractAccount: state.abstractAccount, + devices: state.connect.devices, + accounts: state.accounts, + discovery: state.discovery, + receive: state.receive + }; +} + +const mapDispatchToProps: MapDispatchToProps = (dispatch: Dispatch): DispatchProps => { + return { + abstractAccountActions: bindActionCreators(AbstractAccountActions, dispatch), + + initAccount: bindActionCreators(ReceiveActions.init, dispatch), + disposeAccount: bindActionCreators(ReceiveActions.dispose, dispatch), + showAddress: bindActionCreators(ReceiveActions.showAddress, dispatch), + }; +} + +export default connect(mapStateToProps, mapDispatchToProps)(Receive); \ No newline at end of file diff --git a/src/js/components/wallet/send/AdvancedForm.js b/src/js/components/wallet/account/send/AdvancedForm.js similarity index 95% rename from src/js/components/wallet/send/AdvancedForm.js rename to src/js/components/wallet/account/send/AdvancedForm.js index 9d092a20..e8348883 100644 --- a/src/js/components/wallet/send/AdvancedForm.js +++ b/src/js/components/wallet/account/send/AdvancedForm.js @@ -3,7 +3,14 @@ import React from 'react'; import Tooltip from 'rc-tooltip'; -import type { Props } from './index'; +import type { Props as BaseProps } from './index'; + +type Props = { + abstractAccount: $ElementType, + sendForm: $ElementType, + sendFormActions: $ElementType, + children?: $ElementType, +}; const AdvancedForm = (props: Props) => { diff --git a/src/js/components/wallet/send/CoinSelectOption.js b/src/js/components/wallet/account/send/CoinSelectOption.js similarity index 100% rename from src/js/components/wallet/send/CoinSelectOption.js rename to src/js/components/wallet/account/send/CoinSelectOption.js diff --git a/src/js/components/wallet/send/FeeSelect.js b/src/js/components/wallet/account/send/FeeSelect.js similarity index 100% rename from src/js/components/wallet/send/FeeSelect.js rename to src/js/components/wallet/account/send/FeeSelect.js diff --git a/src/js/components/wallet/send/PendingTransactions.js b/src/js/components/wallet/account/send/PendingTransactions.js similarity index 85% rename from src/js/components/wallet/send/PendingTransactions.js rename to src/js/components/wallet/account/send/PendingTransactions.js index c4b66594..af154f12 100644 --- a/src/js/components/wallet/send/PendingTransactions.js +++ b/src/js/components/wallet/account/send/PendingTransactions.js @@ -5,14 +5,16 @@ import React from 'react'; import ColorHash from 'color-hash'; import ScaleText from 'react-scale-text'; -import { findAccountTokens } from '../../../reducers/TokensReducer'; +import { findAccountTokens } from '../../../../reducers/TokensReducer'; -import type { Props as ParentProps } from './index'; -import type { Coin } from '../../../reducers/LocalStorageReducer'; -import type { Account } from '../../../reducers/AccountsReducer'; -import type { Token } from '../../../reducers/TokensReducer'; +import type { Coin } from '../../../../reducers/LocalStorageReducer'; +import type { Account } from '../../../../reducers/AccountsReducer'; +import type { Token } from '../../../../reducers/TokensReducer'; +import type { Props as BaseProps } from './index'; -type Props = ParentProps & { +type Props = { + pending: $ElementType, + tokens: $ElementType, account: Account, selectedCoin: Coin } diff --git a/src/js/components/wallet/send/SendForm.js b/src/js/components/wallet/account/send/SendForm.js similarity index 92% rename from src/js/components/wallet/send/SendForm.js rename to src/js/components/wallet/account/send/SendForm.js index c8492f0b..4b23782e 100644 --- a/src/js/components/wallet/send/SendForm.js +++ b/src/js/components/wallet/account/send/SendForm.js @@ -6,12 +6,12 @@ import Select from 'react-select'; import AdvancedForm from './AdvancedForm'; import PendingTransactions from './PendingTransactions'; import { FeeSelectValue, FeeSelectOption } from './FeeSelect'; -import { Notification } from '../../common/Notification'; -import AbstractAccount from '../account/AbstractAccount'; -import { findAccountTokens } from '../../../reducers/TokensReducer'; +import { Notification } from '../../../common/Notification'; +import AbstractAccount from '../AbstractAccount'; +import { findAccountTokens } from '../../../../reducers/TokensReducer'; import type { Props } from './index'; -import type { AccountState } from '../account/AbstractAccount'; +import type { AccountState } from '../AbstractAccount'; export default class Send extends AbstractAccount { render() { @@ -19,7 +19,6 @@ export default class Send extends AbstractAccount { } } - const _render = (props: Props, state: AccountState): React$Element => { const { @@ -177,12 +176,16 @@ const _render = (props: Props, state: AccountState): React$Element => { options={ feeLevels } /> - + diff --git a/src/js/components/wallet/send/index.js b/src/js/components/wallet/account/send/index.js similarity index 81% rename from src/js/components/wallet/send/index.js rename to src/js/components/wallet/account/send/index.js index 5317fc07..8909f9b6 100644 --- a/src/js/components/wallet/send/index.js +++ b/src/js/components/wallet/account/send/index.js @@ -5,17 +5,17 @@ import * as React from 'react'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; -import { default as SendFormActions } from '../../../actions/SendFormActions'; -import { default as AbstractAccountActions } from '../../../actions/AbstractAccountActions'; +import { default as SendFormActions } from '../../../../actions/SendFormActions'; +import { default as AbstractAccountActions } from '../../../../actions/AbstractAccountActions'; import SendForm from './SendForm'; import type { MapStateToProps, MapDispatchToProps } from 'react-redux'; -import type { State, Dispatch } from '../../../flowtype'; -import type { StateProps as BaseStateProps, DispatchProps as BaseDispatchProps } from '../account/AbstractAccount'; +import type { State, Dispatch } from '../../../../flowtype'; +import type { StateProps as BaseStateProps, DispatchProps as BaseDispatchProps } from '../AbstractAccount'; type OwnProps = { } -type StateProps = BaseStateProps & { +export type StateProps = BaseStateProps & { tokens: $ElementType, pending: $ElementType, sendForm: $ElementType, @@ -24,7 +24,7 @@ type StateProps = BaseStateProps & { children?: React.Node; } -type DispatchProps = BaseDispatchProps & { +export type DispatchProps = BaseDispatchProps & { sendFormActions: typeof SendFormActions } diff --git a/src/js/components/wallet/SignVerify.js b/src/js/components/wallet/account/sign/SignVerify.js similarity index 100% rename from src/js/components/wallet/SignVerify.js rename to src/js/components/wallet/account/sign/SignVerify.js diff --git a/src/js/components/wallet/summary/Summary.js b/src/js/components/wallet/account/summary/Summary.js similarity index 87% rename from src/js/components/wallet/summary/Summary.js rename to src/js/components/wallet/account/summary/Summary.js index 10ece739..746c7ff5 100644 --- a/src/js/components/wallet/summary/Summary.js +++ b/src/js/components/wallet/account/summary/Summary.js @@ -6,20 +6,20 @@ import BigNumber from 'bignumber.js'; import { Async } from 'react-select'; import Tooltip from 'rc-tooltip'; -import { resolveAfter } from '../../../utils/promiseUtils'; -import AbstractAccount from '../account/AbstractAccount'; -import { Notification } from '../../common/Notification'; +import { resolveAfter } from '../../../../utils/promiseUtils'; +import AbstractAccount from '../AbstractAccount'; +import { Notification } from '../../../common/Notification'; import SummaryDetails from './SummaryDetails.js'; import SummaryTokens from './SummaryTokens.js'; import type { Props } from './index'; -import type { AccountState } from '../account/AbstractAccount'; +import type { AccountState } from '../AbstractAccount'; -import type { TrezorDevice } from '../../../flowtype'; -import type { NetworkToken } from '../../../reducers/LocalStorageReducer'; -import type { Account } from '../../../reducers/AccountsReducer'; -import type { Discovery } from '../../../reducers/DiscoveryReducer'; -import { findAccountTokens } from '../../../reducers/TokensReducer'; +import type { TrezorDevice } from '../../../../flowtype'; +import type { NetworkToken } from '../../../../reducers/LocalStorageReducer'; +import type { Account } from '../../../../reducers/AccountsReducer'; +import type { Discovery } from '../../../../reducers/DiscoveryReducer'; +import { findAccountTokens } from '../../../../reducers/TokensReducer'; export default class Summary extends AbstractAccount { render() { diff --git a/src/js/components/wallet/summary/SummaryDetails.js b/src/js/components/wallet/account/summary/SummaryDetails.js similarity index 95% rename from src/js/components/wallet/summary/SummaryDetails.js rename to src/js/components/wallet/account/summary/SummaryDetails.js index ca5981a2..017f3981 100644 --- a/src/js/components/wallet/summary/SummaryDetails.js +++ b/src/js/components/wallet/account/summary/SummaryDetails.js @@ -5,7 +5,7 @@ import React from 'react'; import BigNumber from 'bignumber.js'; import type { Props as BaseProps } from './index'; -import type { Coin } from '../../../reducers/LocalStorageReducer'; +import type { Coin } from '../../../../reducers/LocalStorageReducer'; type Props = { // coin: $PropertyType<$ElementType, 'coin'>, diff --git a/src/js/components/wallet/summary/SummaryTokens.js b/src/js/components/wallet/account/summary/SummaryTokens.js similarity index 100% rename from src/js/components/wallet/summary/SummaryTokens.js rename to src/js/components/wallet/account/summary/SummaryTokens.js diff --git a/src/js/components/wallet/summary/index.js b/src/js/components/wallet/account/summary/index.js similarity index 84% rename from src/js/components/wallet/summary/index.js rename to src/js/components/wallet/account/summary/index.js index 20253ff5..24b5216a 100644 --- a/src/js/components/wallet/summary/index.js +++ b/src/js/components/wallet/account/summary/index.js @@ -6,14 +6,13 @@ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import Summary from './Summary'; -import { default as AbstractAccountActions } from '../../../actions/AbstractAccountActions'; -import * as SummaryActions from '../../../actions/SummaryActions'; -import * as TokenActions from '../../../actions/TokenActions'; +import { default as AbstractAccountActions } from '../../../../actions/AbstractAccountActions'; +import * as SummaryActions from '../../../../actions/SummaryActions'; +import * as TokenActions from '../../../../actions/TokenActions'; -import type { ActionCreators } from 'redux'; import type { MapStateToProps, MapDispatchToProps } from 'react-redux'; -import type { State, Dispatch } from '../../../flowtype'; -import type { StateProps as BaseStateProps, DispatchProps as BaseDispatchProps } from '../account/AbstractAccount'; +import type { State, Dispatch } from '../../../../flowtype'; +import type { StateProps as BaseStateProps, DispatchProps as BaseDispatchProps } from '../AbstractAccount'; type OwnProps = { } diff --git a/src/js/components/wallet/index.js b/src/js/components/wallet/index.js index 33b0e8ef..b4f215e5 100644 --- a/src/js/components/wallet/index.js +++ b/src/js/components/wallet/index.js @@ -9,7 +9,7 @@ import { Route, withRouter } from 'react-router-dom'; import Header from '../common/Header'; import Footer from '../common/Footer'; import AccountTabs from './account/AccountTabs'; -import DeviceSettingsTabs from './account/DeviceSettingsTabs'; +import DeviceSettingsTabs from './pages/DeviceSettingsTabs'; import AsideContainer from './aside'; import ModalContainer from '../modal'; import Notifications from '../common/Notification'; diff --git a/src/js/components/wallet/Acquire.js b/src/js/components/wallet/pages/Acquire.js similarity index 84% rename from src/js/components/wallet/Acquire.js rename to src/js/components/wallet/pages/Acquire.js index 1e35e97b..2e7b895f 100644 --- a/src/js/components/wallet/Acquire.js +++ b/src/js/components/wallet/pages/Acquire.js @@ -4,10 +4,10 @@ import React from 'react'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; -import { Notification } from '../common/Notification'; -import * as TrezorConnectActions from '../../actions/TrezorConnectActions'; +import { Notification } from '../../common/Notification'; +import * as TrezorConnectActions from '../../../actions/TrezorConnectActions'; -import type { State, Dispatch } from '../../flowtype'; +import type { State, Dispatch } from '../../../flowtype'; type Props = { connect: $ElementType, acquireDevice: typeof TrezorConnectActions.acquire diff --git a/src/js/components/wallet/Bootloader.js b/src/js/components/wallet/pages/Bootloader.js similarity index 100% rename from src/js/components/wallet/Bootloader.js rename to src/js/components/wallet/pages/Bootloader.js diff --git a/src/js/components/wallet/Dashboard.js b/src/js/components/wallet/pages/Dashboard.js similarity index 78% rename from src/js/components/wallet/Dashboard.js rename to src/js/components/wallet/pages/Dashboard.js index 88f44080..d0278de8 100644 --- a/src/js/components/wallet/Dashboard.js +++ b/src/js/components/wallet/pages/Dashboard.js @@ -4,6 +4,7 @@ import React from 'react'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; +import DashboardImg from '~/images/dashboard.png'; const Dashboard = () => { return ( @@ -12,7 +13,7 @@ const Dashboard = () => {

Please select your coin

You will gain access to recieving & sending selected coin

- Dashboard + Dashboard
); diff --git a/src/js/components/wallet/DeviceSettings.js b/src/js/components/wallet/pages/DeviceSettings.js similarity index 100% rename from src/js/components/wallet/DeviceSettings.js rename to src/js/components/wallet/pages/DeviceSettings.js diff --git a/src/js/components/wallet/account/DeviceSettingsTabs.js b/src/js/components/wallet/pages/DeviceSettingsTabs.js similarity index 100% rename from src/js/components/wallet/account/DeviceSettingsTabs.js rename to src/js/components/wallet/pages/DeviceSettingsTabs.js diff --git a/src/js/components/wallet/WalletSettings.js b/src/js/components/wallet/pages/WalletSettings.js similarity index 100% rename from src/js/components/wallet/WalletSettings.js rename to src/js/components/wallet/pages/WalletSettings.js diff --git a/src/js/index.js b/src/js/index.js index 5e9656e7..deb1d488 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -6,7 +6,7 @@ import { render } from 'react-dom'; import store from './store'; import router from './router'; import { onBeforeUnload } from './actions/WalletActions'; -import styles from '../styles/index.less'; +import styles from '~/styles/index.less'; const root: ?HTMLElement = document.getElementById('root'); if (root) { diff --git a/src/js/router/index.js b/src/js/router/index.js index 86ce6e7c..a6355e00 100644 --- a/src/js/router/index.js +++ b/src/js/router/index.js @@ -9,16 +9,16 @@ import store, { history } from '../store'; import LandingPageContainer from '../components/landing'; import WalletContainer from '../components/wallet'; -import BootloaderContainer from '../components/wallet/Bootloader'; -import AcquireContainer from '../components/wallet/Acquire'; +import BootloaderContainer from '../components/wallet/pages/Bootloader'; +import AcquireContainer from '../components/wallet/pages/Acquire'; -import DashboardContainer from '../components/wallet/Dashboard'; -import SummaryContainer from '../components/wallet/summary'; -import SendFormContainer from '../components/wallet/send'; -import ReceiveContainer from '../components/wallet/Receive'; -import SignVerifyContainer from '../components/wallet/SignVerify'; -import DeviceSettingsContainer from '../components/wallet/DeviceSettings'; -import WalletSettingsContainer from '../components/wallet/WalletSettings'; +import DashboardContainer from '../components/wallet/pages/Dashboard'; +import SummaryContainer from '../components/wallet/account/summary'; +import SendFormContainer from '../components/wallet/account/send'; +import ReceiveContainer from '../components/wallet/account/receive'; +import SignVerifyContainer from '../components/wallet/account/sign/SignVerify'; +import DeviceSettingsContainer from '../components/wallet/pages/DeviceSettings'; +import WalletSettingsContainer from '../components/wallet/pages/WalletSettings'; export default (