aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/portal/drawer_menu.tsx
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-06-19 07:55:52 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-06-19 08:08:44 +0800
commitf97e605bf6769a17d0352219f5fb1133f7cb2430 (patch)
tree102f382273c38facd8ba8448b6cbfba2329623b4 /packages/website/ts/components/portal/drawer_menu.tsx
parent49f5495c459f194f3cab6ff24526da924bd64a53 (diff)
downloaddexon-0x-contracts-f97e605bf6769a17d0352219f5fb1133f7cb2430.tar.gz
dexon-0x-contracts-f97e605bf6769a17d0352219f5fb1133f7cb2430.tar.zst
dexon-0x-contracts-f97e605bf6769a17d0352219f5fb1133f7cb2430.zip
Consolidate account state messaging logic
Diffstat (limited to 'packages/website/ts/components/portal/drawer_menu.tsx')
-rw-r--r--packages/website/ts/components/portal/drawer_menu.tsx28
1 files changed, 18 insertions, 10 deletions
diff --git a/packages/website/ts/components/portal/drawer_menu.tsx b/packages/website/ts/components/portal/drawer_menu.tsx
index 8ac2b9091..4bd07769f 100644
--- a/packages/website/ts/components/portal/drawer_menu.tsx
+++ b/packages/website/ts/components/portal/drawer_menu.tsx
@@ -2,10 +2,12 @@ import { Styles } from '@0xproject/react-shared';
import * as _ from 'lodash';
import * as React from 'react';
+import { Blockchain } from 'ts/blockchain';
import { defaultMenuItemEntries, Menu } from 'ts/components/portal/menu';
import { Identicon } from 'ts/components/ui/identicon';
+import { Text } from 'ts/components/ui/text';
import { colors } from 'ts/style/colors';
-import { WebsitePaths } from 'ts/types';
+import { ProviderType, WebsitePaths } from 'ts/types';
import { utils } from 'ts/utils/utils';
const IDENTICON_DIAMETER = 45;
@@ -25,14 +27,15 @@ const styles: Styles = {
MozBorderRadius: BORDER_RADIUS,
WebkitBorderRadius: BORDER_RADIUS,
},
- userAddress: {
- color: colors.white,
- },
};
export interface DrawerMenuProps {
selectedPath?: string;
userAddress?: string;
+ injectedProviderName: string;
+ providerType: ProviderType;
+ blockchain?: Blockchain;
+ blockchainIsLoaded: boolean;
}
export const DrawerMenu = (props: DrawerMenuProps) => {
const relayerItemEntry = {
@@ -41,9 +44,15 @@ export const DrawerMenu = (props: DrawerMenuProps) => {
iconName: 'zmdi-portable-wifi',
};
const menuItemEntries = _.concat(relayerItemEntry, defaultMenuItemEntries);
+ const displayMessage = utils.getReadableAccountState(
+ props.blockchainIsLoaded && !_.isUndefined(props.blockchain),
+ props.providerType,
+ props.injectedProviderName,
+ props.userAddress,
+ );
return (
<div style={styles.root}>
- <Header userAddress={props.userAddress} />
+ <Header userAddress={props.userAddress} displayMessage={displayMessage} />
<Menu selectedPath={props.selectedPath} menuItemEntries={menuItemEntries} />
</div>
);
@@ -51,17 +60,16 @@ export const DrawerMenu = (props: DrawerMenuProps) => {
interface HeaderProps {
userAddress?: string;
+ displayMessage: string;
}
const Header = (props: HeaderProps) => {
return (
<div className="flex flex-center py4">
<div className="flex flex-column mx-auto">
<Identicon address={props.userAddress} diameter={IDENTICON_DIAMETER} style={styles.identicon} />
- {!_.isUndefined(props.userAddress) && (
- <div className="pt2" style={styles.userAddress}>
- {utils.getAddressBeginAndEnd(props.userAddress)}
- </div>
- )}
+ <Text className="pt2" fontColor={colors.white}>
+ {props.displayMessage}
+ </Text>
</div>
</div>
);