diff options
Diffstat (limited to 'src/containers')
-rw-r--r-- | src/containers/auth/InviteScreen.js | 2 | ||||
-rw-r--r-- | src/containers/settings/AccountScreen.js | 12 | ||||
-rw-r--r-- | src/containers/settings/EditServiceScreen.js | 12 | ||||
-rw-r--r-- | src/containers/settings/EditUserScreen.js | 12 | ||||
-rw-r--r-- | src/containers/settings/InviteScreen.js | 44 | ||||
-rw-r--r-- | src/containers/subscription/SubscriptionFormScreen.js (renamed from src/containers/ui/SubscriptionFormScreen.js) | 57 | ||||
-rw-r--r-- | src/containers/subscription/SubscriptionPopupScreen.js (renamed from src/containers/ui/SubscriptionPopupScreen.js) | 2 |
7 files changed, 83 insertions, 58 deletions
diff --git a/src/containers/auth/InviteScreen.js b/src/containers/auth/InviteScreen.js index 51971f436..059888c99 100644 --- a/src/containers/auth/InviteScreen.js +++ b/src/containers/auth/InviteScreen.js | |||
@@ -12,9 +12,11 @@ export default class InviteScreen extends Component { | |||
12 | 12 | ||
13 | render() { | 13 | render() { |
14 | const { actions } = this.props; | 14 | const { actions } = this.props; |
15 | |||
15 | return ( | 16 | return ( |
16 | <Invite | 17 | <Invite |
17 | onSubmit={actions.user.invite} | 18 | onSubmit={actions.user.invite} |
19 | embed={false} | ||
18 | /> | 20 | /> |
19 | ); | 21 | ); |
20 | } | 22 | } |
diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js index 008c495d4..c5c2982b0 100644 --- a/src/containers/settings/AccountScreen.js +++ b/src/containers/settings/AccountScreen.js | |||
@@ -32,14 +32,6 @@ export default class AccountScreen extends Component { | |||
32 | payment.plansRequest.reload(); | 32 | payment.plansRequest.reload(); |
33 | } | 33 | } |
34 | 34 | ||
35 | stopMiner() { | ||
36 | const { update } = this.props.actions.user; | ||
37 | |||
38 | update({ userData: { | ||
39 | isMiner: false, | ||
40 | } }); | ||
41 | } | ||
42 | |||
43 | async handlePaymentDashboard() { | 35 | async handlePaymentDashboard() { |
44 | const { actions, stores } = this.props; | 36 | const { actions, stores } = this.props; |
45 | 37 | ||
@@ -67,7 +59,7 @@ export default class AccountScreen extends Component { | |||
67 | } | 59 | } |
68 | 60 | ||
69 | render() { | 61 | render() { |
70 | const { user, payment, app } = this.props.stores; | 62 | const { user, payment } = this.props.stores; |
71 | const { openExternalUrl } = this.props.actions.app; | 63 | const { openExternalUrl } = this.props.actions.app; |
72 | const { user: userActions } = this.props.actions; | 64 | const { user: userActions } = this.props.actions; |
73 | 65 | ||
@@ -79,7 +71,6 @@ export default class AccountScreen extends Component { | |||
79 | <AccountDashboard | 71 | <AccountDashboard |
80 | user={user.data} | 72 | user={user.data} |
81 | orders={payment.orders} | 73 | orders={payment.orders} |
82 | hashrate={app.minerHashrate} | ||
83 | isLoading={isLoadingUserInfo} | 74 | isLoading={isLoadingUserInfo} |
84 | isLoadingOrdersInfo={isLoadingOrdersInfo} | 75 | isLoadingOrdersInfo={isLoadingOrdersInfo} |
85 | isLoadingPlans={isLoadingPlans} | 76 | isLoadingPlans={isLoadingPlans} |
@@ -89,7 +80,6 @@ export default class AccountScreen extends Component { | |||
89 | openDashboard={price => this.handlePaymentDashboard(price)} | 80 | openDashboard={price => this.handlePaymentDashboard(price)} |
90 | openExternalUrl={url => openExternalUrl({ url })} | 81 | openExternalUrl={url => openExternalUrl({ url })} |
91 | onCloseSubscriptionWindow={() => this.onCloseWindow()} | 82 | onCloseSubscriptionWindow={() => this.onCloseWindow()} |
92 | stopMiner={() => this.stopMiner()} | ||
93 | deleteAccount={userActions.delete} | 83 | deleteAccount={userActions.delete} |
94 | isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} | 84 | isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} |
95 | isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} | 85 | isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} |
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js index c26195a1e..67c2731fc 100644 --- a/src/containers/settings/EditServiceScreen.js +++ b/src/containers/settings/EditServiceScreen.js | |||
@@ -121,7 +121,7 @@ export default class EditServiceScreen extends Component { | |||
121 | label: intl.formatMessage(messages.team), | 121 | label: intl.formatMessage(messages.team), |
122 | placeholder: intl.formatMessage(messages.team), | 122 | placeholder: intl.formatMessage(messages.team), |
123 | value: service.team, | 123 | value: service.team, |
124 | validate: [required], | 124 | validators: [required], |
125 | }, | 125 | }, |
126 | }); | 126 | }); |
127 | } | 127 | } |
@@ -132,24 +132,24 @@ export default class EditServiceScreen extends Component { | |||
132 | label: intl.formatMessage(messages.customUrl), | 132 | label: intl.formatMessage(messages.customUrl), |
133 | placeholder: 'https://', | 133 | placeholder: 'https://', |
134 | value: service.customUrl, | 134 | value: service.customUrl, |
135 | validate: [required, url], | 135 | validators: [required, url], |
136 | }, | 136 | }, |
137 | }); | 137 | }); |
138 | } | 138 | } |
139 | 139 | ||
140 | // More fine grained and use case specific validation rules | 140 | // More fine grained and use case specific validation rules |
141 | if (recipe.hasTeamId && recipe.hasCustomUrl) { | 141 | if (recipe.hasTeamId && recipe.hasCustomUrl) { |
142 | config.fields.team.validate = [oneRequired(['team', 'customUrl'])]; | 142 | config.fields.team.validators = [oneRequired(['team', 'customUrl'])]; |
143 | config.fields.customUrl.validate = [url, oneRequired(['team', 'customUrl'])]; | 143 | config.fields.customUrl.validators = [url, oneRequired(['team', 'customUrl'])]; |
144 | } | 144 | } |
145 | 145 | ||
146 | // If a service can be hosted and has a teamId or customUrl | 146 | // If a service can be hosted and has a teamId or customUrl |
147 | if (recipe.hasHostedOption && (recipe.hasTeamId || recipe.hasCustomUrl)) { | 147 | if (recipe.hasHostedOption && (recipe.hasTeamId || recipe.hasCustomUrl)) { |
148 | if (config.fields.team) { | 148 | if (config.fields.team) { |
149 | config.fields.team.validate = []; | 149 | config.fields.team.validators = []; |
150 | } | 150 | } |
151 | if (config.fields.customUrl) { | 151 | if (config.fields.customUrl) { |
152 | config.fields.customUrl.validate = [url]; | 152 | config.fields.customUrl.validators = [url]; |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
diff --git a/src/containers/settings/EditUserScreen.js b/src/containers/settings/EditUserScreen.js index fb5c5db89..dda8ce513 100644 --- a/src/containers/settings/EditUserScreen.js +++ b/src/containers/settings/EditUserScreen.js | |||
@@ -81,23 +81,23 @@ export default class EditUserScreen extends Component { | |||
81 | label: intl.formatMessage(messages.firstname), | 81 | label: intl.formatMessage(messages.firstname), |
82 | placeholder: intl.formatMessage(messages.firstname), | 82 | placeholder: intl.formatMessage(messages.firstname), |
83 | value: user.firstname, | 83 | value: user.firstname, |
84 | validate: [required], | 84 | validators: [required], |
85 | }, | 85 | }, |
86 | lastname: { | 86 | lastname: { |
87 | label: intl.formatMessage(messages.lastname), | 87 | label: intl.formatMessage(messages.lastname), |
88 | placeholder: intl.formatMessage(messages.lastname), | 88 | placeholder: intl.formatMessage(messages.lastname), |
89 | value: user.lastname, | 89 | value: user.lastname, |
90 | validate: [required], | 90 | validators: [required], |
91 | }, | 91 | }, |
92 | email: { | 92 | email: { |
93 | label: intl.formatMessage(messages.email), | 93 | label: intl.formatMessage(messages.email), |
94 | placeholder: intl.formatMessage(messages.email), | 94 | placeholder: intl.formatMessage(messages.email), |
95 | value: user.email, | 95 | value: user.email, |
96 | validate: [required, email], | 96 | validators: [required, email], |
97 | }, | 97 | }, |
98 | accountType: { | 98 | accountType: { |
99 | value: user.accountType, | 99 | value: user.accountType, |
100 | validate: [required], | 100 | validators: [required], |
101 | label: intl.formatMessage(messages.accountType.label), | 101 | label: intl.formatMessage(messages.accountType.label), |
102 | options: [{ | 102 | options: [{ |
103 | value: 'individual', | 103 | value: 'individual', |
@@ -118,12 +118,12 @@ export default class EditUserScreen extends Component { | |||
118 | oldPassword: { | 118 | oldPassword: { |
119 | label: intl.formatMessage(messages.currentPassword), | 119 | label: intl.formatMessage(messages.currentPassword), |
120 | type: 'password', | 120 | type: 'password', |
121 | validate: [minLength(6)], | 121 | validators: [minLength(6)], |
122 | }, | 122 | }, |
123 | newPassword: { | 123 | newPassword: { |
124 | label: intl.formatMessage(messages.newPassword), | 124 | label: intl.formatMessage(messages.newPassword), |
125 | type: 'password', | 125 | type: 'password', |
126 | validate: [minLength(6)], | 126 | validators: [minLength(6)], |
127 | }, | 127 | }, |
128 | }, | 128 | }, |
129 | }; | 129 | }; |
diff --git a/src/containers/settings/InviteScreen.js b/src/containers/settings/InviteScreen.js new file mode 100644 index 000000000..5f341b1b3 --- /dev/null +++ b/src/containers/settings/InviteScreen.js | |||
@@ -0,0 +1,44 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { inject, observer } from 'mobx-react'; | ||
4 | |||
5 | import Invite from '../../components/auth/Invite'; | ||
6 | import { gaPage } from '../../lib/analytics'; | ||
7 | |||
8 | @inject('stores', 'actions') @observer | ||
9 | export default class InviteScreen extends Component { | ||
10 | componentDidMount() { | ||
11 | gaPage('Settings/Invite'); | ||
12 | } | ||
13 | |||
14 | componentWillUnmount() { | ||
15 | this.props.stores.user.inviteRequest.reset(); | ||
16 | } | ||
17 | |||
18 | render() { | ||
19 | const { actions } = this.props; | ||
20 | const { user } = this.props.stores; | ||
21 | |||
22 | return ( | ||
23 | <Invite | ||
24 | onSubmit={actions.user.invite} | ||
25 | isLoadingInvite={user.inviteRequest.isExecuting} | ||
26 | isInviteSuccessful={user.inviteRequest.wasExecuted && !user.inviteRequest.isError} | ||
27 | embed | ||
28 | /> | ||
29 | ); | ||
30 | } | ||
31 | } | ||
32 | |||
33 | InviteScreen.wrappedComponent.propTypes = { | ||
34 | actions: PropTypes.shape({ | ||
35 | user: PropTypes.shape({ | ||
36 | invite: PropTypes.func.isRequired, | ||
37 | }).isRequired, | ||
38 | }).isRequired, | ||
39 | stores: PropTypes.shape({ | ||
40 | user: PropTypes.shape({ | ||
41 | inviteRequest: PropTypes.object, | ||
42 | }).isRequired, | ||
43 | }).isRequired, | ||
44 | }; | ||
diff --git a/src/containers/ui/SubscriptionFormScreen.js b/src/containers/subscription/SubscriptionFormScreen.js index d08507809..fc6e3c4be 100644 --- a/src/containers/ui/SubscriptionFormScreen.js +++ b/src/containers/subscription/SubscriptionFormScreen.js | |||
@@ -5,7 +5,7 @@ import { inject, observer } from 'mobx-react'; | |||
5 | 5 | ||
6 | import PaymentStore from '../../stores/PaymentStore'; | 6 | import PaymentStore from '../../stores/PaymentStore'; |
7 | 7 | ||
8 | import SubscriptionForm from '../../components/ui/Subscription'; | 8 | import SubscriptionForm from '../../components/subscription/SubscriptionForm'; |
9 | 9 | ||
10 | const { BrowserWindow } = remote; | 10 | const { BrowserWindow } = remote; |
11 | 11 | ||
@@ -34,47 +34,36 @@ export default class SubscriptionFormScreen extends Component { | |||
34 | actions, | 34 | actions, |
35 | stores, | 35 | stores, |
36 | onCloseWindow, | 36 | onCloseWindow, |
37 | skipAction, | ||
38 | } = this.props; | 37 | } = this.props; |
39 | 38 | ||
40 | if (plan !== 'mining') { | 39 | const interval = plan; |
41 | const interval = plan; | ||
42 | |||
43 | const { id } = stores.payment.plan[interval]; | ||
44 | actions.payment.createHostedPage({ | ||
45 | planId: id, | ||
46 | }); | ||
47 | 40 | ||
48 | const hostedPage = await stores.payment.createHostedPageRequest; | 41 | const { id } = stores.payment.plan[interval]; |
49 | const url = `file://${__dirname}/../../index.html#/payment/${encodeURIComponent(hostedPage.url)}`; | 42 | actions.payment.createHostedPage({ |
43 | planId: id, | ||
44 | }); | ||
50 | 45 | ||
51 | if (hostedPage.url) { | 46 | const hostedPage = await stores.payment.createHostedPageRequest; |
52 | const paymentWindow = new BrowserWindow({ | 47 | const url = `file://${__dirname}/../../index.html#/payment/${encodeURIComponent(hostedPage.url)}`; |
53 | parent: remote.getCurrentWindow(), | ||
54 | modal: true, | ||
55 | title: '🔒 Franz Supporter License', | ||
56 | width: 600, | ||
57 | height: window.innerHeight - 100, | ||
58 | maxWidth: 600, | ||
59 | minWidth: 600, | ||
60 | webPreferences: { | ||
61 | nodeIntegration: true, | ||
62 | }, | ||
63 | }); | ||
64 | paymentWindow.loadURL(url); | ||
65 | 48 | ||
66 | paymentWindow.on('closed', () => { | 49 | if (hostedPage.url) { |
67 | onCloseWindow(); | 50 | const paymentWindow = new BrowserWindow({ |
68 | }); | 51 | parent: remote.getCurrentWindow(), |
69 | } | 52 | modal: true, |
70 | } else { | 53 | title: '🔒 Franz Supporter License', |
71 | actions.user.update({ | 54 | width: 600, |
72 | userData: { | 55 | height: window.innerHeight - 100, |
73 | isMiner: true, | 56 | maxWidth: 600, |
57 | minWidth: 600, | ||
58 | webPreferences: { | ||
59 | nodeIntegration: true, | ||
74 | }, | 60 | }, |
75 | }); | 61 | }); |
62 | paymentWindow.loadURL(url); | ||
76 | 63 | ||
77 | skipAction(); | 64 | paymentWindow.on('closed', () => { |
65 | onCloseWindow(); | ||
66 | }); | ||
78 | } | 67 | } |
79 | } | 68 | } |
80 | 69 | ||
diff --git a/src/containers/ui/SubscriptionPopupScreen.js b/src/containers/subscription/SubscriptionPopupScreen.js index 0b6432e50..bb0603170 100644 --- a/src/containers/ui/SubscriptionPopupScreen.js +++ b/src/containers/subscription/SubscriptionPopupScreen.js | |||
@@ -2,7 +2,7 @@ import React, { Component } from 'react'; | |||
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import { inject, observer } from 'mobx-react'; | 3 | import { inject, observer } from 'mobx-react'; |
4 | 4 | ||
5 | import SubscriptionPopup from '../../components/ui/SubscriptionPopup'; | 5 | import SubscriptionPopup from '../../components/subscription/SubscriptionPopup'; |
6 | 6 | ||
7 | 7 | ||
8 | @inject('stores', 'actions') @observer | 8 | @inject('stores', 'actions') @observer |