From 3d4e03f2cd4cb2db3df535a2c95dd2e500fb6f6e Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 16 May 2018 17:44:10 -0700 Subject: Refactor account management itmes --- packages/website/ts/components/portal/portal.tsx | 144 +++++++++++------------ 1 file changed, 70 insertions(+), 74 deletions(-) diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx index bcb8e60ef..d9d50c5ab 100644 --- a/packages/website/ts/components/portal/portal.tsx +++ b/packages/website/ts/components/portal/portal.tsx @@ -74,6 +74,12 @@ interface PortalState { tokenManagementState: TokenManagementState; } +interface AccountManagementItem { + pathName: string; + headerText: string; + render: () => React.ReactNode; +} + enum TokenManagementState { Add = 'Add', Remove = 'Remove', @@ -95,6 +101,7 @@ const styles: Styles = { }, leftColumn: { width: LEFT_COLUMN_WIDTH, + height: '100%', }, scrollContainer: { height: `calc(100vh - ${TOP_BAR_HEIGHT}px)`, @@ -241,7 +248,7 @@ export class Portal extends React.Component { ); } private _renderWalletAndRelayerIndex(): React.ReactNode { - return ; + return ; } private _renderMenuAndAccountManagement(routeComponentProps: RouteComponentProps): React.ReactNode { return ; @@ -283,74 +290,73 @@ export class Portal extends React.Component { ); } private _renderAccountManagement(): React.ReactNode { + const accountManagementItems: AccountManagementItem[] = [ + { + pathName: `${WebsitePaths.Portal}/weth`, + headerText: 'Wrapped ETH', + render: this._renderEthWrapper.bind(this), + }, + { + pathName: `${WebsitePaths.Portal}/account`, + headerText: 'Your Account', + render: this._renderTokenBalances.bind(this), + }, + { + pathName: `${WebsitePaths.Portal}/trades`, + headerText: 'Trade History', + render: this._renderTradeHistory.bind(this), + }, + { + pathName: `${WebsitePaths.Portal}/direct`, + headerText: 'Trade Direct', + render: this._renderTradeDirect.bind(this), + }, + ]; return ( - - - - + {_.map(accountManagementItems, item => { + return ; + })}} ); } - private _renderEthWrapper(): React.ReactNode { + private _renderAccountManagementItem(item: AccountManagementItem): React.ReactNode { return (
} - body={ - - } - /> - } + header={} + body={} + /> + ); + } + private _renderEthWrapper(): React.ReactNode { + return ( + ); } private _renderTradeHistory(): React.ReactNode { return ( -
} - body={ - - } - /> - } + ); } private _renderTradeDirect(match: any, location: Location, history: History): React.ReactNode { return ( -
} - body={ - - } - /> - } + ); } @@ -358,32 +364,22 @@ export class Portal extends React.Component { const allTokens = _.values(this.props.tokenByAddress); const trackedTokens = _.filter(allTokens, t => t.isTracked); return ( -
} - body={ - - } - /> - } + ); } - private _renderRelayerIndex(): React.ReactNode { + private _renderRelayerIndexSection(): React.ReactNode { return (
} -- cgit