aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/components/install_wallet_panel_content.tsx
blob: 0700e9051040068747b26b49d07b9c4070f999f9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import * as React from 'react';

import {
    COINBASE_WALLET_ANDROID_APP_STORE_URL,
    COINBASE_WALLET_IOS_APP_STORE_URL,
    COINBASE_WALLET_SITE_URL,
    META_MASK_CHROME_STORE_URL,
    META_MASK_FIREFOX_STORE_URL,
    META_MASK_OPERA_STORE_URL,
    META_MASK_SITE_URL,
} from '../constants';
import { ColorOption } from '../style/theme';
import { Browser, OperatingSystem } from '../types';
import { envUtil } from '../util/env';

import { CoinbaseWalletLogo } from './coinbase_wallet_logo';
import { MetaMaskLogo } from './meta_mask_logo';
import { StandardPanelContent, StandardPanelContentProps } from './standard_panel_content';
import { Button } from './ui/button';

export interface InstallWalletPanelContentProps {}

export class InstallWalletPanelContent extends React.Component<InstallWalletPanelContentProps> {
    public render(): React.ReactNode {
        const panelProps = this._getStandardPanelContentProps();
        return <StandardPanelContent {...panelProps} />;
    }
    private readonly _getStandardPanelContentProps = (): StandardPanelContentProps => {
        const isMobileOS = envUtil.isMobileOperatingSystem();
        const browser = envUtil.getBrowser();
        const operatingSystem = envUtil.getOperatingSystem();
        if (isMobileOS) {
            let description = 'Please install the Coinbase Wallet app.';
            let actionText = 'Learn More';
            let actionUrl = COINBASE_WALLET_SITE_URL;
            switch (operatingSystem) {
                case OperatingSystem.Android:
                    description = 'Please install the Coinbase Wallet app from the Google Play Store.';
                    actionText = 'Get Coinbase Wallet';
                    actionUrl = COINBASE_WALLET_ANDROID_APP_STORE_URL;
                    break;
                case OperatingSystem.iOS:
                    description = 'Please install the Coinbase Wallet app from the iOS App Store.';
                    actionText = 'Get Coinbase Wallet';
                    actionUrl = COINBASE_WALLET_IOS_APP_STORE_URL;
                    break;
                default:
                    break;
            }
            return {
                image: <CoinbaseWalletLogo width={246} />,
                description,
                moreInfoSettings: {
                    href: COINBASE_WALLET_SITE_URL,
                    text: 'What is Coinbase Wallet?',
                },
                action: (
                    <Button
                        href={actionUrl}
                        width="100%"
                        fontColor={ColorOption.white}
                        backgroundColor={ColorOption.blue}
                    >
                        {actionText}
                    </Button>
                ),
            };
        } else {
            let description = 'Please install the MetaMask wallet browser extension.';
            let actionText = 'Learn More';
            let actionUrl = META_MASK_SITE_URL;
            switch (browser) {
                case Browser.Chrome:
                    description = 'Please install the MetaMask wallet browser extension from the Chrome Store.';
                    actionText = 'Get Chrome Extension';
                    actionUrl = META_MASK_CHROME_STORE_URL;
                    break;
                case Browser.Firefox:
                    description = 'Please install the MetaMask wallet browser extension from the Firefox Store.';
                    actionText = 'Get Firefox Extension';
                    actionUrl = META_MASK_FIREFOX_STORE_URL;
                    break;
                case Browser.Opera:
                    description = 'Please install the MetaMask wallet browser extension from the Opera Store.';
                    actionText = 'Get Opera Add-on';
                    actionUrl = META_MASK_OPERA_STORE_URL;
                    break;
                default:
                    break;
            }
            return {
                image: <MetaMaskLogo width={85} height={80} />,
                title: 'Install MetaMask',
                description,
                moreInfoSettings: {
                    href: META_MASK_SITE_URL,
                    text: 'What is MetaMask?',
                },
                action: (
                    <Button
                        href={actionUrl}
                        width="100%"
                        fontColor={ColorOption.white}
                        backgroundColor={ColorOption.darkOrange}
                    >
                        {actionText}
                    </Button>
                ),
            };
        }
    };
}