aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/components/payment_method.tsx
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-11-15 08:27:27 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-11-16 04:41:49 +0800
commitf9e012398606a85d286087f3e94bf8b95a52df55 (patch)
tree48cd81751217bc0877faa73de2174052734dacb5 /packages/instant/src/components/payment_method.tsx
parentf4cc152cfb6da5c13d2d95ccd2f1a022af9b91a0 (diff)
downloaddexon-sol-tools-f9e012398606a85d286087f3e94bf8b95a52df55.tar
dexon-sol-tools-f9e012398606a85d286087f3e94bf8b95a52df55.tar.gz
dexon-sol-tools-f9e012398606a85d286087f3e94bf8b95a52df55.tar.bz2
dexon-sol-tools-f9e012398606a85d286087f3e94bf8b95a52df55.tar.lz
dexon-sol-tools-f9e012398606a85d286087f3e94bf8b95a52df55.tar.xz
dexon-sol-tools-f9e012398606a85d286087f3e94bf8b95a52df55.tar.zst
dexon-sol-tools-f9e012398606a85d286087f3e94bf8b95a52df55.zip
feat: make onUnlockWalletClick different based on ON
Diffstat (limited to 'packages/instant/src/components/payment_method.tsx')
-rw-r--r--packages/instant/src/components/payment_method.tsx33
1 files changed, 29 insertions, 4 deletions
diff --git a/packages/instant/src/components/payment_method.tsx b/packages/instant/src/components/payment_method.tsx
index 662dd9d22..21bb2902b 100644
--- a/packages/instant/src/components/payment_method.tsx
+++ b/packages/instant/src/components/payment_method.tsx
@@ -1,11 +1,16 @@
import * as _ from 'lodash';
import * as React from 'react';
+import {
+ COINBASE_WALLET_ANDROID_APP_STORE_URL,
+ COINBASE_WALLET_IOS_APP_STORE_URL,
+ COINBASE_WALLET_SITE_URL,
+} from '../constants';
import { ColorOption } from '../style/theme';
-import { Account, AccountState, Network } from '../types';
+import { Account, AccountState, Network, OperatingSystem } from '../types';
import { envUtil } from '../util/env';
-import { CoinbaseWalletAppLogo } from './coinbase_wallet_logo';
+import { CoinbaseWalletLogo } from './coinbase_wallet_logo';
import { MetaMaskLogo } from './meta_mask_logo';
import { PaymentMethodDropdown } from './payment_method_dropdown';
import { Circle } from './ui/circle';
@@ -77,7 +82,7 @@ export class PaymentMethod extends React.Component<PaymentMethodProps> {
private readonly _renderMainContent = (): React.ReactNode => {
const { account, network } = this.props;
const isMobile = envUtil.isMobileOperatingSystem();
- const logo = isMobile ? <CoinbaseWalletAppLogo width={22} /> : <MetaMaskLogo width={19} height={18} />;
+ const logo = isMobile ? <CoinbaseWalletLogo width={22} /> : <MetaMaskLogo width={19} height={18} />;
const primaryColor = isMobile ? ColorOption.darkBlue : ColorOption.darkOrange;
const secondaryColor = isMobile ? ColorOption.lightBlue : ColorOption.lightOrange;
const colors = { primaryColor, secondaryColor };
@@ -97,7 +102,7 @@ export class PaymentMethod extends React.Component<PaymentMethodProps> {
);
case AccountState.None:
return (
- <WalletPrompt onClick={this.props.onInstallWalletClick} image={logo} {...colors}>
+ <WalletPrompt onClick={this._handleInstallWalletClick} image={logo} {...colors}>
{isMobile ? 'Install Coinbase Wallet' : 'Install MetaMask'}
</WalletPrompt>
);
@@ -111,4 +116,24 @@ export class PaymentMethod extends React.Component<PaymentMethodProps> {
);
}
};
+ private readonly _handleInstallWalletClick = (): void => {
+ const isMobile = envUtil.isMobileOperatingSystem();
+ if (!isMobile) {
+ this.props.onInstallWalletClick();
+ return;
+ }
+ const operatingSystem = envUtil.getOperatingSystem();
+ let url = COINBASE_WALLET_SITE_URL;
+ switch (operatingSystem) {
+ case OperatingSystem.Android:
+ url = COINBASE_WALLET_ANDROID_APP_STORE_URL;
+ break;
+ case OperatingSystem.iOS:
+ url = COINBASE_WALLET_IOS_APP_STORE_URL;
+ break;
+ default:
+ break;
+ }
+ window.open(url, '_blank');
+ };
}