import TabSection from 'containers/TabSection'; import { OfflineAwareUnlockHeader } from 'components'; import React from 'react'; import { connect } from 'react-redux'; import { SideBar } from './components/index'; import { IReadOnlyWallet, IFullWallet } from 'libs/wallet'; import { getWalletInst } from 'selectors/wallet'; import { AppState } from 'reducers'; import tabs from './tabs'; import SubTabs, { Props as TabProps } from 'components/SubTabs'; import { RouteComponentProps } from 'react-router'; interface StateProps { wallet: AppState['wallet']['inst']; } export interface SubTabProps { wallet: WalletTypes; } export type WalletTypes = IReadOnlyWallet | IFullWallet | undefined | null; type Props = StateProps & RouteComponentProps<{}>; const determineActiveTab = (wallet: WalletTypes, activeTab: string) => { if (wallet && wallet.isReadOnly && (activeTab === 'send' || activeTab === undefined)) { return 'info'; } return activeTab; }; class SendTransaction extends React.Component { public render() { const { wallet, location } = this.props; const activeTab = location.pathname.split('/')[2]; const tabProps: TabProps = { root: 'account', activeTab: determineActiveTab(wallet, activeTab), sideBar: , tabs, subTabProps: { wallet } }; interface IWalletTabs { new (): SubTabs; } const WalletTabs = SubTabs as IWalletTabs; return (
{wallet && }
); } } export default connect((state: AppState) => ({ wallet: getWalletInst(state) }))(SendTransaction);