From db9ff7675404b6d409cc195159a8334c59208c25 Mon Sep 17 00:00:00 2001 From: fragosti Date: Mon, 18 Jun 2018 16:57:28 -0700 Subject: Only elevate wallet zIndex when onboarding is in progress --- packages/website/ts/components/portal/portal.tsx | 3 +++ packages/website/ts/components/wallet/wallet.tsx | 9 +++++---- packages/website/ts/containers/portal.ts | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'packages/website/ts') diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx index 28a303793..046cb2096 100644 --- a/packages/website/ts/components/portal/portal.tsx +++ b/packages/website/ts/components/portal/portal.tsx @@ -33,6 +33,7 @@ import { localStorage } from 'ts/local_storage/local_storage'; import { trackedTokenStorage } from 'ts/local_storage/tracked_token_storage'; import { FullscreenMessage } from 'ts/pages/fullscreen_message'; import { Dispatcher } from 'ts/redux/dispatcher'; +import { zIndex } from 'ts/style/z_index'; import { BlockchainErrs, HashData, @@ -73,6 +74,7 @@ export interface PortalProps { flashMessage?: string | React.ReactNode; lastForceTokenStateRefetch: number; translate: Translate; + isPortalOnboardingShowing: boolean; } interface PortalState { @@ -335,6 +337,7 @@ export class Portal extends React.Component { return (
void; onRemoveToken: () => void; refetchTokenStateAsync: (tokenAddress: string) => Promise; + style: React.CSSProperties; } interface WalletState { @@ -79,7 +79,6 @@ interface AccessoryItemConfig { const styles: Styles = { root: { width: '100%', - zIndex: zIndex.aboveOverlay, position: 'relative', }, footerItemInnerDiv: { @@ -134,6 +133,9 @@ const NO_ALLOWANCE_TOGGLE_SPACE_WIDTH = 56; const ACCOUNT_PATH = `${WebsitePaths.Portal}/account`; export class Wallet extends React.Component { + public static defaultProps = { + style: {}, + }; constructor(props: WalletProps) { super(props); this.state = { @@ -141,11 +143,10 @@ export class Wallet extends React.Component { isHoveringSidebar: false, }; } - public render(): React.ReactNode { const isBlockchainLoaded = this.props.blockchainIsLoaded && this.props.blockchainErr === BlockchainErrs.NoError; return ( - + {isBlockchainLoaded ? this._renderLoadedRows() : this._renderLoadingRows()} ); diff --git a/packages/website/ts/containers/portal.ts b/packages/website/ts/containers/portal.ts index 5876e65f5..cac2477c6 100644 --- a/packages/website/ts/containers/portal.ts +++ b/packages/website/ts/containers/portal.ts @@ -28,6 +28,7 @@ interface ConnectedState { userSuppliedOrderCache: Order; flashMessage?: string | React.ReactNode; translate: Translate; + isPortalOnboardingShowing: boolean; } interface ConnectedDispatch { @@ -76,6 +77,7 @@ const mapStateToProps = (state: State, _ownProps: PortalComponentProps): Connect userSuppliedOrderCache: state.userSuppliedOrderCache, flashMessage: state.flashMessage, translate: state.translate, + isPortalOnboardingShowing: state.isPortalOnboardingShowing, }; }; -- cgit v1.2.3 From bdd299dd9ee4699ccf5a4ab648e721e03ab2a139 Mon Sep 17 00:00:00 2001 From: fragosti Date: Mon, 18 Jun 2018 17:24:31 -0700 Subject: Fix onboarding persisting when changing routes --- .../ts/components/onboarding/portal_onboarding_flow.tsx | 13 +++++++++++-- packages/website/ts/components/wallet/wallet.tsx | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'packages/website/ts') diff --git a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx index 4283022e2..159fd27e6 100644 --- a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx +++ b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx @@ -1,5 +1,6 @@ import * as _ from 'lodash'; import * as React from 'react'; +import { RouteComponentProps, withRouter } from 'react-router'; import { BigNumber } from '@0xproject/utils'; import { Blockchain } from 'ts/blockchain'; @@ -15,7 +16,7 @@ import { AllowanceToggle } from 'ts/containers/inputs/allowance_toggle'; import { ProviderType, Token, TokenByAddress, TokenStateByAddress } from 'ts/types'; import { utils } from 'ts/utils/utils'; -export interface PortalOnboardingFlowProps { +export interface PortalOnboardingFlowProps extends RouteComponentProps { blockchain: Blockchain; stepIndex: number; isRunning: boolean; @@ -32,9 +33,15 @@ export interface PortalOnboardingFlowProps { refetchTokenStateAsync: (tokenAddress: string) => Promise; } -export class PortalOnboardingFlow extends React.Component { +class PlainPortalOnboardingFlow extends React.Component { + private _unlisten: () => void; public componentDidMount(): void { this._overrideOnboardingStateIfShould(); + // If there is a route change, just close onboarding. + this._unlisten = this.props.history.listen(() => this.props.updateIsRunning(false)); + } + public componentWillUnmount(): void { + this._unlisten(); } public componentDidUpdate(): void { this._overrideOnboardingStateIfShould(); @@ -209,3 +216,5 @@ export class PortalOnboardingFlow extends React.Component { - {'manage your wallet'} + manage your wallet
// https://github.com/palantir/tslint-react/issues/140 // tslint:disable-next-line:jsx-curly-spacing -- cgit v1.2.3