From e9e4df48912e22b22b2fc874cb64c5da63364772 Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 5 Jul 2018 11:28:34 -0700 Subject: Fix onboarding closing on unlock metamask step on click outside --- packages/website/ts/components/onboarding/onboarding_flow.tsx | 4 +++- .../website/ts/components/onboarding/portal_onboarding_flow.tsx | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/website/ts/components/onboarding/onboarding_flow.tsx b/packages/website/ts/components/onboarding/onboarding_flow.tsx index c2b4a4ca7..46dc897bd 100644 --- a/packages/website/ts/components/onboarding/onboarding_flow.tsx +++ b/packages/website/ts/components/onboarding/onboarding_flow.tsx @@ -44,12 +44,14 @@ export interface OnboardingFlowProps { updateOnboardingStep: (stepIndex: number) => void; disableOverlay?: boolean; isMobile: boolean; + disableCloseOnClickOutside?: boolean; } export class OnboardingFlow extends React.Component { public static defaultProps = { disableOverlay: false, isMobile: false, + disableCloseOnClickOutside: false, }; public render(): React.ReactNode { if (!this.props.isRunning) { @@ -86,7 +88,7 @@ export class OnboardingFlow extends React.Component { } return (
- + {onboardingElement}
); diff --git a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx index 1c2c92fd1..fcfed82fa 100644 --- a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx +++ b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx @@ -23,7 +23,7 @@ import { WrapEthOnboardingStep3, } from 'ts/components/onboarding/wrap_eth_onboarding_step'; import { AllowanceToggle } from 'ts/containers/inputs/allowance_toggle'; -import { ProviderType, ScreenWidths, Token, TokenByAddress, TokenStateByAddress } from 'ts/types'; +import { BrowserType, ProviderType, ScreenWidths, Token, TokenByAddress, TokenStateByAddress } from 'ts/types'; import { analytics } from 'ts/utils/analytics'; import { utils } from 'ts/utils/utils'; @@ -77,6 +77,10 @@ class PlainPortalOnboardingFlow extends React.Component ); } -- cgit From 97312c265666b3f3f955c096de5aba8791329d79 Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 5 Jul 2018 11:45:54 -0700 Subject: Use default networkId of 1 for ledger dropdown --- packages/website/ts/components/dialogs/ledger_config_dialog.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx index 38e4732a4..d2f373d67 100644 --- a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx +++ b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx @@ -29,7 +29,7 @@ interface LedgerConfigDialogProps { toggleDialogFn: (isOpen: boolean) => void; dispatcher: Dispatcher; blockchain: Blockchain; - networkId: number; + networkId?: number; providerType: ProviderType; } @@ -44,6 +44,9 @@ interface LedgerConfigDialogState { } export class LedgerConfigDialog extends React.Component { + public static defaultProps = { + networkId: 1, + }; constructor(props: LedgerConfigDialogProps) { super(props); const derivationPathIfExists = props.blockchain.getLedgerDerivationPathIfExists(); -- cgit From 127fbc6e943d23cf1202f403a5b402226963d947 Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 5 Jul 2018 15:16:46 -0700 Subject: Just disable closing onboarding by clicking outside for firefox --- packages/website/ts/components/onboarding/portal_onboarding_flow.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx index fcfed82fa..e3072b9b4 100644 --- a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx +++ b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx @@ -78,9 +78,7 @@ class PlainPortalOnboardingFlow extends React.Component ); } -- cgit From f894ffc0ccccca8e94ea37dda6184168f126839d Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 5 Jul 2018 15:37:35 -0700 Subject: Poll for gas prices and use fast instead of average for better UX --- packages/website/ts/blockchain.ts | 30 ++++++++++++++++++++++++++---- packages/website/ts/types.ts | 3 +++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index cc2afa28a..efeeafe32 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -89,6 +89,7 @@ export class Blockchain { private _userAddressIfExists: string; private _ledgerSubprovider: LedgerSubprovider; private _defaultGasPrice: BigNumber; + private _watchGasPriceIntervalId: NodeJS.Timer; private static _getNameGivenProvider(provider: Provider): string { const providerType = utils.getProviderType(provider); const providerNameIfExists = providerToName[providerType]; @@ -196,13 +197,11 @@ export class Blockchain { } constructor(dispatcher: Dispatcher) { this._dispatcher = dispatcher; - const defaultGasPrice = GWEI_IN_WEI * 30; + const defaultGasPrice = GWEI_IN_WEI * 40; this._defaultGasPrice = new BigNumber(defaultGasPrice); // We need a unique reference to this function so we can use it to unsubcribe. this._injectedProviderUpdateHandler = this._handleInjectedProviderUpdateAsync.bind(this); // tslint:disable-next-line:no-floating-promises - this._updateDefaultGasPriceAsync(); - // tslint:disable-next-line:no-floating-promises this._onPageLoadInitFireAndForgetAsync(); } public async networkIdUpdatedFireAndForgetAsync(newNetworkId: number): Promise { @@ -537,6 +536,7 @@ export class Blockchain { this._blockchainWatcher.destroy(); this._injectedProviderObservable.unsubscribe(this._injectedProviderUpdateHandler); this._stopWatchingExchangeLogFillEvents(); + this._stopWatchingGasPrice(); } public async fetchTokenInformationAsync(): Promise { utils.assert( @@ -798,8 +798,30 @@ export class Blockchain { this._updateProviderName(injectedWeb3IfExists); const shouldPollUserAddress = true; const shouldUseLedgerProvider = false; + this._startWatchingGasPrice(); await this._resetOrInitializeAsync(this.networkId, shouldPollUserAddress, shouldUseLedgerProvider); } + private _startWatchingGasPrice(): void { + if (!_.isUndefined(this._watchGasPriceIntervalId)) { + return; // we are already watching + } + // tslint:disable-next-line:no-floating-promises + this._updateDefaultGasPriceAsync(); + this._watchGasPriceIntervalId = intervalUtils.setAsyncExcludingInterval( + this._updateDefaultGasPriceAsync.bind(this), + // 1 minute + 60000, + (err: Error) => { + logUtils.log(`Watching gas price failed: ${err.stack}`); + this._stopWatchingGasPrice(); + }, + ); + } + private _stopWatchingGasPrice(): void { + if (!_.isUndefined(this._watchGasPriceIntervalId)) { + intervalUtils.clearAsyncExcludingInterval(this._watchGasPriceIntervalId); + } + } private async _resetOrInitializeAsync( networkId: number, shouldPollUserAddress: boolean = false, @@ -895,7 +917,7 @@ export class Blockchain { private async _updateDefaultGasPriceAsync(): Promise { try { const gasInfo = await backendClient.getGasInfoAsync(); - const gasPriceInGwei = new BigNumber(gasInfo.average / 10); + const gasPriceInGwei = new BigNumber(gasInfo.fast / 10); const gasPriceInWei = gasPriceInGwei.mul(1000000000); this._defaultGasPrice = gasPriceInWei; } catch (err) { diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index 93d029325..a13853052 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -551,7 +551,10 @@ export interface WebsiteBackendTokenInfo { } export interface WebsiteBackendGasInfo { + safeSlow: number; average: number; + fast: number; + fastest: number; } export interface WebsiteBackendJobInfo { -- cgit From 97809a03eb5be210a20247444cfd45ed68b515fd Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 5 Jul 2018 17:11:50 -0700 Subject: Make wallet height responsive --- packages/website/ts/components/wallet/wallet.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index 1e0b9ec48..8ea2725fe 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -270,7 +270,7 @@ export class Wallet extends React.Component { overflowY: this.state.isHoveringSidebar ? 'scroll' : 'hidden', marginRight: this.state.isHoveringSidebar ? 0 : 4, // TODO: make this completely responsive - maxHeight: this.props.screenWidth !== ScreenWidths.Sm ? 475 : undefined, + maxHeight: !utils.isMobileWidth(this.props.screenWidth) ? 'calc(90vh - 300px)' : undefined, }; } private _onSidebarHover(_event: React.FormEvent): void { -- cgit From afbc4989d512d3dcc24a7cbc29e96afaae3acdc0 Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 6 Jul 2018 11:23:41 -0700 Subject: address CR feedback --- packages/website/ts/blockchain.ts | 4 ++-- packages/website/ts/components/onboarding/portal_onboarding_flow.tsx | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index efeeafe32..169d01ecb 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -805,12 +805,12 @@ export class Blockchain { if (!_.isUndefined(this._watchGasPriceIntervalId)) { return; // we are already watching } + const oneMinuteInMs = 60000; // tslint:disable-next-line:no-floating-promises this._updateDefaultGasPriceAsync(); this._watchGasPriceIntervalId = intervalUtils.setAsyncExcludingInterval( this._updateDefaultGasPriceAsync.bind(this), - // 1 minute - 60000, + oneMinuteInMs, (err: Error) => { logUtils.log(`Watching gas price failed: ${err.stack}`); this._stopWatchingGasPrice(); diff --git a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx index e3072b9b4..503f2163d 100644 --- a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx +++ b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx @@ -68,6 +68,7 @@ class PlainPortalOnboardingFlow extends React.Component ); } -- cgit