diff options
author | 2021-09-13 14:45:46 +0200 | |
---|---|---|
committer | 2021-09-13 14:45:46 +0200 | |
commit | 537697a6e9757f118d09d9e76362ba1ff617e2c6 (patch) | |
tree | bc55447115e385137684e84697a8c15d2199b8d5 /src/containers/settings/EditUserScreen.js | |
parent | Bumped up version to: 5.6.3-nightly.0 [skip ci] (diff) | |
download | ferdium-app-537697a6e9757f118d09d9e76362ba1ff617e2c6.tar.gz ferdium-app-537697a6e9757f118d09d9e76362ba1ff617e2c6.tar.zst ferdium-app-537697a6e9757f118d09d9e76362ba1ff617e2c6.zip |
chore: upgrade intl dependencies (#1920)
Diffstat (limited to 'src/containers/settings/EditUserScreen.js')
-rw-r--r-- | src/containers/settings/EditUserScreen.js | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/src/containers/settings/EditUserScreen.js b/src/containers/settings/EditUserScreen.js index 820b5e4d3..92ef94c29 100644 --- a/src/containers/settings/EditUserScreen.js +++ b/src/containers/settings/EditUserScreen.js | |||
@@ -1,7 +1,7 @@ | |||
1 | import React, { Component } from 'react'; | 1 | 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 | import { defineMessages, intlShape } from 'react-intl'; | 4 | import { defineMessages, injectIntl } from 'react-intl'; |
5 | 5 | ||
6 | import UserStore from '../../stores/UserStore'; | 6 | import UserStore from '../../stores/UserStore'; |
7 | import Form from '../../lib/Form'; | 7 | import Form from '../../lib/Form'; |
@@ -13,47 +13,45 @@ import { required, email, minLength } from '../../helpers/validation-helpers'; | |||
13 | const messages = defineMessages({ | 13 | const messages = defineMessages({ |
14 | firstname: { | 14 | firstname: { |
15 | id: 'settings.user.form.firstname', | 15 | id: 'settings.user.form.firstname', |
16 | defaultMessage: '!!!Firstname', | 16 | defaultMessage: 'Firstname', |
17 | }, | 17 | }, |
18 | lastname: { | 18 | lastname: { |
19 | id: 'settings.user.form.lastname', | 19 | id: 'settings.user.form.lastname', |
20 | defaultMessage: '!!!Lastname', | 20 | defaultMessage: 'Lastname', |
21 | }, | 21 | }, |
22 | email: { | 22 | email: { |
23 | id: 'settings.user.form.email', | 23 | id: 'settings.user.form.email', |
24 | defaultMessage: '!!!Email', | 24 | defaultMessage: 'Email', |
25 | }, | 25 | }, |
26 | accountTypeLabel: { | 26 | accountTypeLabel: { |
27 | id: 'settings.user.form.accountType.label', | 27 | id: 'settings.user.form.accountType.label', |
28 | defaultMessage: '!!!Account type', | 28 | defaultMessage: 'Account type', |
29 | }, | 29 | }, |
30 | accountTypeIndividual: { | 30 | accountTypeIndividual: { |
31 | id: 'settings.user.form.accountType.individual', | 31 | id: 'settings.user.form.accountType.individual', |
32 | defaultMessage: '!!!Individual', | 32 | defaultMessage: 'Individual', |
33 | }, | 33 | }, |
34 | accountTypeNonProfit: { | 34 | accountTypeNonProfit: { |
35 | id: 'settings.user.form.accountType.non-profit', | 35 | id: 'settings.user.form.accountType.non-profit', |
36 | defaultMessage: '!!!Non-Profit', | 36 | defaultMessage: 'Non-Profit', |
37 | }, | 37 | }, |
38 | accountTypeCompany: { | 38 | accountTypeCompany: { |
39 | id: 'settings.user.form.accountType.company', | 39 | id: 'settings.user.form.accountType.company', |
40 | defaultMessage: '!!!Company', | 40 | defaultMessage: 'Company', |
41 | }, | 41 | }, |
42 | currentPassword: { | 42 | currentPassword: { |
43 | id: 'settings.user.form.currentPassword', | 43 | id: 'settings.user.form.currentPassword', |
44 | defaultMessage: '!!!Current password', | 44 | defaultMessage: 'Current password', |
45 | }, | 45 | }, |
46 | newPassword: { | 46 | newPassword: { |
47 | id: 'settings.user.form.newPassword', | 47 | id: 'settings.user.form.newPassword', |
48 | defaultMessage: '!!!New password', | 48 | defaultMessage: 'New password', |
49 | }, | 49 | }, |
50 | }); | 50 | }); |
51 | 51 | ||
52 | export default @inject('stores', 'actions') @observer class EditUserScreen extends Component { | 52 | @inject('stores', 'actions') |
53 | static contextTypes = { | 53 | @observer |
54 | intl: intlShape, | 54 | class EditUserScreen extends Component { |
55 | }; | ||
56 | |||
57 | componentWillUnmount() { | 55 | componentWillUnmount() { |
58 | this.props.actions.user.resetStatus(); | 56 | this.props.actions.user.resetStatus(); |
59 | } | 57 | } |
@@ -67,7 +65,7 @@ export default @inject('stores', 'actions') @observer class EditUserScreen exten | |||
67 | } | 65 | } |
68 | 66 | ||
69 | prepareForm(user) { | 67 | prepareForm(user) { |
70 | const { intl } = this.context; | 68 | const { intl } = this.props; |
71 | 69 | ||
72 | const config = { | 70 | const config = { |
73 | fields: { | 71 | fields: { |
@@ -93,16 +91,20 @@ export default @inject('stores', 'actions') @observer class EditUserScreen exten | |||
93 | value: user.accountType, | 91 | value: user.accountType, |
94 | validators: [required], | 92 | validators: [required], |
95 | label: intl.formatMessage(messages.accountTypeLabel), | 93 | label: intl.formatMessage(messages.accountTypeLabel), |
96 | options: [{ | 94 | options: [ |
97 | value: 'individual', | 95 | { |
98 | label: intl.formatMessage(messages.accountTypeIndividual), | 96 | value: 'individual', |
99 | }, { | 97 | label: intl.formatMessage(messages.accountTypeIndividual), |
100 | value: 'non-profit', | 98 | }, |
101 | label: intl.formatMessage(messages.accountTypeNonProfit), | 99 | { |
102 | }, { | 100 | value: 'non-profit', |
103 | value: 'company', | 101 | label: intl.formatMessage(messages.accountTypeNonProfit), |
104 | label: intl.formatMessage(messages.accountTypeCompany), | 102 | }, |
105 | }], | 103 | { |
104 | value: 'company', | ||
105 | label: intl.formatMessage(messages.accountTypeCompany), | ||
106 | }, | ||
107 | ], | ||
106 | }, | 108 | }, |
107 | organization: { | 109 | organization: { |
108 | label: intl.formatMessage(messages.accountTypeCompany), | 110 | label: intl.formatMessage(messages.accountTypeCompany), |
@@ -129,7 +131,7 @@ export default @inject('stores', 'actions') @observer class EditUserScreen exten | |||
129 | const { user } = this.props.stores; | 131 | const { user } = this.props.stores; |
130 | 132 | ||
131 | if (user.getUserInfoRequest.isExecuting) { | 133 | if (user.getUserInfoRequest.isExecuting) { |
132 | return (<div>Loading...</div>); | 134 | return <div>Loading...</div>; |
133 | } | 135 | } |
134 | 136 | ||
135 | const form = this.prepareForm(user.data); | 137 | const form = this.prepareForm(user.data); |
@@ -141,7 +143,7 @@ export default @inject('stores', 'actions') @observer class EditUserScreen exten | |||
141 | status={user.actionStatus} | 143 | status={user.actionStatus} |
142 | form={form} | 144 | form={form} |
143 | isSaving={user.updateUserInfoRequest.isExecuting} | 145 | isSaving={user.updateUserInfoRequest.isExecuting} |
144 | onSubmit={(d) => this.onSubmit(d)} | 146 | onSubmit={d => this.onSubmit(d)} |
145 | /> | 147 | /> |
146 | </ErrorBoundary> | 148 | </ErrorBoundary> |
147 | ); | 149 | ); |
@@ -156,3 +158,5 @@ EditUserScreen.wrappedComponent.propTypes = { | |||
156 | user: PropTypes.instanceOf(UserStore).isRequired, | 158 | user: PropTypes.instanceOf(UserStore).isRequired, |
157 | }).isRequired, | 159 | }).isRequired, |
158 | }; | 160 | }; |
161 | |||
162 | export default injectIntl(EditUserScreen); | ||