From 2bba01c664efb52d3213be54544ef9d9cea0f82f Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 9 Nov 2018 15:40:02 -0800 Subject: feat: toggle wallet connection color --- packages/instant/src/components/payment_method.tsx | 35 +++++++++++++++------- packages/instant/src/constants.ts | 1 + 2 files changed, 26 insertions(+), 10 deletions(-) (limited to 'packages/instant/src') diff --git a/packages/instant/src/components/payment_method.tsx b/packages/instant/src/components/payment_method.tsx index ca646880d..3bbe3f1a0 100644 --- a/packages/instant/src/components/payment_method.tsx +++ b/packages/instant/src/components/payment_method.tsx @@ -9,6 +9,7 @@ import { PaymentMethodDropdown } from './payment_method_dropdown'; import { Circle } from './ui/circle'; import { Container } from './ui/container'; import { Flex } from './ui/flex'; +import { Icon } from './ui/icon'; import { Text } from './ui/text'; export interface PaymentMethodProps { @@ -56,10 +57,11 @@ export class PaymentMethod extends React.Component { }; private readonly _renderTitleLabel = (): React.ReactNode => { const { account } = this.props; - if (account.state === AccountState.Ready) { + if (account.state === AccountState.Ready || account.state === AccountState.Locked) { + const circleColor: ColorOption = account.state === AccountState.Ready ? ColorOption.green : ColorOption.red; return ( - + MetaMask @@ -74,11 +76,25 @@ export class PaymentMethod extends React.Component { const { account, network } = this.props; switch (account.state) { case AccountState.Loading: - return 'loading...'; + return ; case AccountState.Locked: - return Unlock MetaMask; + return ( + } + > + Please Unlock MetaMask + + ); case AccountState.None: - return Install MetaMask; + return ( + } + > + Install MetaMask + + ); case AccountState.Ready: return ( { /> ); default: - return 'payment method'; + return null; } }; private readonly _openInstallWalletPanel = () => { @@ -97,10 +113,11 @@ export class PaymentMethod extends React.Component { } interface WalletPromptProps { + image: React.ReactNode; onClick?: () => void; } -const WalletPrompt: React.StatelessComponent = ({ onClick, children }) => ( +const WalletPrompt: React.StatelessComponent = ({ onClick, image, children }) => ( = ({ onClick, ch boxShadowOnHover={!!onClick} > - - - + {image} {children} diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts index 3e2638b0e..4db73845b 100644 --- a/packages/instant/src/constants.ts +++ b/packages/instant/src/constants.ts @@ -17,6 +17,7 @@ export const ETH_GAS_STATION_API_BASE_URL = 'https://ethgasstation.info'; export const COINBASE_API_BASE_URL = 'https://api.coinbase.com/v2'; export const PROGRESS_STALL_AT_WIDTH = '95%'; export const PROGRESS_FINISH_ANIMATION_TIME_MS = 200; +export const NULL_ADDRESS = '0x0000000000000000000000000000000000000000'; export const META_MASK_CHROME_STORE_URL = 'https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en'; export const META_MASK_SITE_URL = 'https://metamask.io/'; -- cgit