diff options
author | 2021-08-13 00:45:01 +0530 | |
---|---|---|
committer | 2021-08-13 00:45:01 +0530 | |
commit | 2d27d5e66649d4f5baf127a53ee5ae524eae3a59 (patch) | |
tree | c592ea219ac8cd987fc367f57b54034c450ab2ab /src/components/ui/UpgradeButton/index.js | |
parent | Ferdi v5.6.0 (diff) | |
parent | 5.6.1-nightly.24 [skip ci] (diff) | |
download | ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.gz ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.zst ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.zip |
chore: merge from nightly branch into release branch in prep for next beta
Diffstat (limited to 'src/components/ui/UpgradeButton/index.js')
-rw-r--r-- | src/components/ui/UpgradeButton/index.js | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/src/components/ui/UpgradeButton/index.js b/src/components/ui/UpgradeButton/index.js deleted file mode 100644 index eade46cfd..000000000 --- a/src/components/ui/UpgradeButton/index.js +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { inject, observer } from 'mobx-react'; | ||
4 | import { defineMessages, intlShape } from 'react-intl'; | ||
5 | |||
6 | import { Button } from '@meetfranz/forms'; | ||
7 | |||
8 | import UserStore from '../../../stores/UserStore'; | ||
9 | import ActivateTrialButton from '../ActivateTrialButton'; | ||
10 | import UIStore from '../../../stores/UIStore'; | ||
11 | |||
12 | const messages = defineMessages({ | ||
13 | upgradeToPro: { | ||
14 | id: 'global.upgradeButton.upgradeToPro', | ||
15 | defaultMessage: '!!!Upgrade to Franz Professional', | ||
16 | }, | ||
17 | }); | ||
18 | |||
19 | @inject('stores', 'actions') @observer | ||
20 | class UpgradeButton extends Component { | ||
21 | static propTypes = { | ||
22 | // eslint-disable-next-line | ||
23 | classes: PropTypes.object.isRequired, | ||
24 | className: PropTypes.string, | ||
25 | gaEventInfo: PropTypes.shape({ | ||
26 | category: PropTypes.string.isRequired, | ||
27 | event: PropTypes.string.isRequired, | ||
28 | label: PropTypes.string, | ||
29 | }), | ||
30 | requiresPro: PropTypes.bool, | ||
31 | }; | ||
32 | |||
33 | static defaultProps = { | ||
34 | className: '', | ||
35 | gaEventInfo: null, | ||
36 | requiresPro: false, | ||
37 | } | ||
38 | |||
39 | static contextTypes = { | ||
40 | intl: intlShape, | ||
41 | }; | ||
42 | |||
43 | handleCTAClick() { | ||
44 | const { actions } = this.props; | ||
45 | |||
46 | actions.ui.openSettings({ path: 'user' }); | ||
47 | } | ||
48 | |||
49 | render() { | ||
50 | const { stores, requiresPro } = this.props; | ||
51 | const { intl } = this.context; | ||
52 | |||
53 | const { isPremium, isPersonal } = stores.user; | ||
54 | |||
55 | if (isPremium && isPersonal && requiresPro) { | ||
56 | return ( | ||
57 | <Button | ||
58 | label={intl.formatMessage(messages.upgradeToPro)} | ||
59 | onClick={this.handleCTAClick.bind(this)} | ||
60 | className={this.props.className} | ||
61 | buttonType="inverted" | ||
62 | /> | ||
63 | ); | ||
64 | } | ||
65 | |||
66 | if (!isPremium) { | ||
67 | return <ActivateTrialButton {...this.props} />; | ||
68 | } | ||
69 | |||
70 | return null; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | export default UpgradeButton; | ||
75 | |||
76 | UpgradeButton.wrappedComponent.propTypes = { | ||
77 | stores: PropTypes.shape({ | ||
78 | user: PropTypes.instanceOf(UserStore).isRequired, | ||
79 | }).isRequired, | ||
80 | actions: PropTypes.shape({ | ||
81 | ui: PropTypes.instanceOf(UIStore).isRequired, | ||
82 | }).isRequired, | ||
83 | }; | ||