Allow you to continue the onboarding flow once youve installed metamask and refreshed the page
This commit is contained in:
@@ -8,11 +8,12 @@ export interface InstallWalletOnboardingStepProps {}
|
|||||||
|
|
||||||
export const InstallWalletOnboardingStep: React.StatelessComponent<InstallWalletOnboardingStepProps> = () => (
|
export const InstallWalletOnboardingStep: React.StatelessComponent<InstallWalletOnboardingStepProps> = () => (
|
||||||
<div className="flex items-center flex-column">
|
<div className="flex items-center flex-column">
|
||||||
<Container marginTop="15px" marginBottom="15px">
|
|
||||||
<ActionAccountBalanceWallet style={{ width: '30px', height: '30px' }} color={colors.orange} />
|
|
||||||
</Container>
|
|
||||||
<Text>
|
<Text>
|
||||||
Before you begin, you need to connect to a wallet. This will be used across all 0x relayers and dApps.
|
Before you begin, you need to connect to a wallet. This will be used across all 0x relayers and dApps.
|
||||||
</Text>
|
</Text>
|
||||||
|
<Container marginTop="15px" marginBottom="15px">
|
||||||
|
<ActionAccountBalanceWallet style={{ width: '50px', height: '50px' }} color={colors.orange} />
|
||||||
|
</Container>
|
||||||
|
<Text>Please refresh the page once you've done this to continue!</Text>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@@ -28,7 +28,7 @@ export interface PortalOnboardingFlowProps extends RouteComponentProps<any> {
|
|||||||
stepIndex: number;
|
stepIndex: number;
|
||||||
isRunning: boolean;
|
isRunning: boolean;
|
||||||
userAddress: string;
|
userAddress: string;
|
||||||
hasBeenSeen: boolean;
|
hasBeenClosed: boolean;
|
||||||
providerType: ProviderType;
|
providerType: ProviderType;
|
||||||
injectedProviderName: string;
|
injectedProviderName: string;
|
||||||
blockchainIsLoaded: boolean;
|
blockchainIsLoaded: boolean;
|
||||||
@@ -44,7 +44,8 @@ export interface PortalOnboardingFlowProps extends RouteComponentProps<any> {
|
|||||||
class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProps> {
|
class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProps> {
|
||||||
private _unlisten: () => void;
|
private _unlisten: () => void;
|
||||||
public componentDidMount(): void {
|
public componentDidMount(): void {
|
||||||
this._overrideOnboardingStateIfShould();
|
this._autoStartOnboardingIfShould();
|
||||||
|
this._adjustStepIfShould();
|
||||||
// If there is a route change, just close onboarding.
|
// If there is a route change, just close onboarding.
|
||||||
this._unlisten = this.props.history.listen(() => this.props.updateIsRunning(false));
|
this._unlisten = this.props.history.listen(() => this.props.updateIsRunning(false));
|
||||||
}
|
}
|
||||||
@@ -52,7 +53,7 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp
|
|||||||
this._unlisten();
|
this._unlisten();
|
||||||
}
|
}
|
||||||
public componentDidUpdate(): void {
|
public componentDidUpdate(): void {
|
||||||
this._overrideOnboardingStateIfShould();
|
this._adjustStepIfShould();
|
||||||
}
|
}
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
return (
|
return (
|
||||||
@@ -189,10 +190,6 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
private _overrideOnboardingStateIfShould(): void {
|
|
||||||
this._autoStartOnboardingIfShould();
|
|
||||||
this._adjustStepIfShould();
|
|
||||||
}
|
|
||||||
private _adjustStepIfShould(): void {
|
private _adjustStepIfShould(): void {
|
||||||
const stepIndex = this.props.stepIndex;
|
const stepIndex = this.props.stepIndex;
|
||||||
if (this._isAddressAvailable()) {
|
if (this._isAddressAvailable()) {
|
||||||
@@ -216,7 +213,10 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private _autoStartOnboardingIfShould(): void {
|
private _autoStartOnboardingIfShould(): void {
|
||||||
if (!this.props.isRunning && !this.props.hasBeenSeen && this.props.blockchainIsLoaded) {
|
if (
|
||||||
|
(this.props.stepIndex === 0 && !this.props.isRunning) ||
|
||||||
|
(!this.props.isRunning && !this.props.hasBeenClosed && this.props.blockchainIsLoaded)
|
||||||
|
) {
|
||||||
const networkName = sharedConstants.NETWORK_NAME_BY_ID[this.props.networkId];
|
const networkName = sharedConstants.NETWORK_NAME_BY_ID[this.props.networkId];
|
||||||
analytics.logEvent('Portal', 'Onboarding Started - Automatic', networkName, this.props.stepIndex);
|
analytics.logEvent('Portal', 'Onboarding Started - Automatic', networkName, this.props.stepIndex);
|
||||||
this.props.updateIsRunning(true);
|
this.props.updateIsRunning(true);
|
||||||
|
@@ -19,7 +19,7 @@ interface ConnectedState {
|
|||||||
stepIndex: number;
|
stepIndex: number;
|
||||||
isRunning: boolean;
|
isRunning: boolean;
|
||||||
userAddress: string;
|
userAddress: string;
|
||||||
hasBeenSeen: boolean;
|
hasBeenClosed: boolean;
|
||||||
providerType: ProviderType;
|
providerType: ProviderType;
|
||||||
injectedProviderName: string;
|
injectedProviderName: string;
|
||||||
blockchainIsLoaded: boolean;
|
blockchainIsLoaded: boolean;
|
||||||
@@ -43,7 +43,7 @@ const mapStateToProps = (state: State, _ownProps: PortalOnboardingFlowProps): Co
|
|||||||
blockchainIsLoaded: state.blockchainIsLoaded,
|
blockchainIsLoaded: state.blockchainIsLoaded,
|
||||||
userEtherBalanceInWei: state.userEtherBalanceInWei,
|
userEtherBalanceInWei: state.userEtherBalanceInWei,
|
||||||
tokenByAddress: state.tokenByAddress,
|
tokenByAddress: state.tokenByAddress,
|
||||||
hasBeenSeen: state.hasPortalOnboardingBeenSeen,
|
hasBeenClosed: state.hasPortalOnboardingBeenClosed,
|
||||||
screenWidth: state.screenWidth,
|
screenWidth: state.screenWidth,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ export interface State {
|
|||||||
userEtherBalanceInWei?: BigNumber;
|
userEtherBalanceInWei?: BigNumber;
|
||||||
portalOnboardingStep: number;
|
portalOnboardingStep: number;
|
||||||
isPortalOnboardingShowing: boolean;
|
isPortalOnboardingShowing: boolean;
|
||||||
hasPortalOnboardingBeenSeen: boolean;
|
hasPortalOnboardingBeenClosed: boolean;
|
||||||
// Note: cache of supplied orderJSON in fill order step. Do not use for anything else.
|
// Note: cache of supplied orderJSON in fill order step. Do not use for anything else.
|
||||||
userSuppliedOrderCache: Order;
|
userSuppliedOrderCache: Order;
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ export const INITIAL_STATE: State = {
|
|||||||
userSuppliedOrderCache: undefined,
|
userSuppliedOrderCache: undefined,
|
||||||
portalOnboardingStep: 0,
|
portalOnboardingStep: 0,
|
||||||
isPortalOnboardingShowing: false,
|
isPortalOnboardingShowing: false,
|
||||||
hasPortalOnboardingBeenSeen: false,
|
hasPortalOnboardingBeenClosed: false,
|
||||||
// Docs
|
// Docs
|
||||||
docsVersion: DEFAULT_DOCS_VERSION,
|
docsVersion: DEFAULT_DOCS_VERSION,
|
||||||
availableDocVersions: [DEFAULT_DOCS_VERSION],
|
availableDocVersions: [DEFAULT_DOCS_VERSION],
|
||||||
@@ -311,7 +311,7 @@ export function reducer(state: State = INITIAL_STATE, action: Action): State {
|
|||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
isPortalOnboardingShowing,
|
isPortalOnboardingShowing,
|
||||||
hasPortalOnboardingBeenSeen: true,
|
hasPortalOnboardingBeenClosed: !isPortalOnboardingShowing ? true : state.hasPortalOnboardingBeenClosed,
|
||||||
// always start onboarding from the beginning
|
// always start onboarding from the beginning
|
||||||
portalOnboardingStep: 0,
|
portalOnboardingStep: 0,
|
||||||
};
|
};
|
||||||
|
@@ -15,7 +15,7 @@ store.subscribe(
|
|||||||
_.throttle(() => {
|
_.throttle(() => {
|
||||||
// Persisted state
|
// Persisted state
|
||||||
stateStorage.saveState({
|
stateStorage.saveState({
|
||||||
hasPortalOnboardingBeenSeen: store.getState().hasPortalOnboardingBeenSeen,
|
hasPortalOnboardingBeenClosed: store.getState().hasPortalOnboardingBeenClosed,
|
||||||
});
|
});
|
||||||
}, ONE_SECOND),
|
}, ONE_SECOND),
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user