diff options
author | 2021-09-13 14:45:46 +0200 | |
---|---|---|
committer | 2021-09-13 14:45:46 +0200 | |
commit | 537697a6e9757f118d09d9e76362ba1ff617e2c6 (patch) | |
tree | bc55447115e385137684e84697a8c15d2199b8d5 /src/components/auth/Import.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/components/auth/Import.js')
-rw-r--r-- | src/components/auth/Import.js | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/src/components/auth/Import.js b/src/components/auth/Import.js index 3073cad73..44cb7e791 100644 --- a/src/components/auth/Import.js +++ b/src/components/auth/Import.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 { observer, PropTypes as MobxPropTypes } from 'mobx-react'; | 3 | import { observer, PropTypes as MobxPropTypes } from 'mobx-react'; |
4 | import { defineMessages, intlShape } from 'react-intl'; | 4 | import { defineMessages, injectIntl } from 'react-intl'; |
5 | import { Link } from 'react-router'; | 5 | import { Link } from 'react-router'; |
6 | import classnames from 'classnames'; | 6 | import classnames from 'classnames'; |
7 | 7 | ||
@@ -12,23 +12,22 @@ import Button from '../ui/Button'; | |||
12 | const messages = defineMessages({ | 12 | const messages = defineMessages({ |
13 | headline: { | 13 | headline: { |
14 | id: 'import.headline', | 14 | id: 'import.headline', |
15 | defaultMessage: '!!!Import your Ferdi 4 services', | 15 | defaultMessage: 'Import your Ferdi 4 services', |
16 | }, | 16 | }, |
17 | notSupportedHeadline: { | 17 | notSupportedHeadline: { |
18 | id: 'import.notSupportedHeadline', | 18 | id: 'import.notSupportedHeadline', |
19 | defaultMessage: '!!!Services not yet supported in Ferdi 5', | 19 | defaultMessage: 'Services not yet supported in Ferdi 5', |
20 | }, | 20 | }, |
21 | submitButtonLabel: { | 21 | submitButtonLabel: { |
22 | id: 'import.submit.label', | 22 | id: 'import.submit.label', |
23 | defaultMessage: '!!!Import {count} services', | 23 | defaultMessage: 'Import {count} services', |
24 | }, | 24 | }, |
25 | skipButtonLabel: { | 25 | skipButtonLabel: { |
26 | id: 'import.skip.label', | 26 | id: 'import.skip.label', |
27 | defaultMessage: '!!!I want to add services manually', | 27 | defaultMessage: 'I want to add services manually', |
28 | }, | 28 | }, |
29 | }); | 29 | }); |
30 | 30 | ||
31 | export default | ||
32 | @observer | 31 | @observer |
33 | class Import extends Component { | 32 | class Import extends Component { |
34 | static propTypes = { | 33 | static propTypes = { |
@@ -38,17 +37,13 @@ class Import extends Component { | |||
38 | inviteRoute: PropTypes.string.isRequired, | 37 | inviteRoute: PropTypes.string.isRequired, |
39 | }; | 38 | }; |
40 | 39 | ||
41 | static contextTypes = { | ||
42 | intl: intlShape, | ||
43 | }; | ||
44 | |||
45 | componentDidMount() { | 40 | componentDidMount() { |
46 | const config = { | 41 | const config = { |
47 | fields: { | 42 | fields: { |
48 | import: [ | 43 | import: [ |
49 | ...this.props.services | 44 | ...this.props.services |
50 | .filter((s) => s.recipe) | 45 | .filter(s => s.recipe) |
51 | .map((s) => ({ | 46 | .map(s => ({ |
52 | fields: { | 47 | fields: { |
53 | add: { | 48 | add: { |
54 | default: true, | 49 | default: true, |
@@ -60,20 +55,20 @@ class Import extends Component { | |||
60 | }, | 55 | }, |
61 | }; | 56 | }; |
62 | 57 | ||
63 | this.form = new Form(config, this.context.intl); | 58 | this.form = new Form(config, this.props.intl); |
64 | } | 59 | } |
65 | 60 | ||
66 | submit(e) { | 61 | submit(e) { |
67 | const { services } = this.props; | 62 | const { services } = this.props; |
68 | e.preventDefault(); | 63 | e.preventDefault(); |
69 | this.form.submit({ | 64 | this.form.submit({ |
70 | onSuccess: (form) => { | 65 | onSuccess: form => { |
71 | const servicesImport = form | 66 | const servicesImport = form |
72 | .values() | 67 | .values() |
73 | .import.map( | 68 | .import.map( |
74 | (value, i) => !value.add || services.filter((s) => s.recipe)[i], | 69 | (value, i) => !value.add || services.filter(s => s.recipe)[i], |
75 | ) | 70 | ) |
76 | .filter((s) => typeof s !== 'boolean'); | 71 | .filter(s => typeof s !== 'boolean'); |
77 | 72 | ||
78 | this.props.onSubmit({ services: servicesImport }); | 73 | this.props.onSubmit({ services: servicesImport }); |
79 | }, | 74 | }, |
@@ -82,18 +77,18 @@ class Import extends Component { | |||
82 | } | 77 | } |
83 | 78 | ||
84 | render() { | 79 | render() { |
85 | const { intl } = this.context; | 80 | const { intl } = this.props; |
86 | const { services, isSubmitting, inviteRoute } = this.props; | 81 | const { services, isSubmitting, inviteRoute } = this.props; |
87 | 82 | ||
88 | const availableServices = services.filter((s) => s.recipe); | 83 | const availableServices = services.filter(s => s.recipe); |
89 | const unavailableServices = services.filter((s) => !s.recipe); | 84 | const unavailableServices = services.filter(s => !s.recipe); |
90 | 85 | ||
91 | return ( | 86 | return ( |
92 | <div className="auth__scroll-container"> | 87 | <div className="auth__scroll-container"> |
93 | <div className="auth__container auth__container--signup"> | 88 | <div className="auth__container auth__container--signup"> |
94 | <form | 89 | <form |
95 | className="franz-form auth__form" | 90 | className="franz-form auth__form" |
96 | onSubmit={(e) => this.submit(e)} | 91 | onSubmit={e => this.submit(e)} |
97 | > | 92 | > |
98 | <img src="./assets/images/logo.svg" className="auth__logo" alt="" /> | 93 | <img src="./assets/images/logo.svg" className="auth__logo" alt="" /> |
99 | <h1>{intl.formatMessage(messages.headline)}</h1> | 94 | <h1>{intl.formatMessage(messages.headline)}</h1> |
@@ -107,8 +102,8 @@ class Import extends Component { | |||
107 | <td className="service-table__column-icon"> | 102 | <td className="service-table__column-icon"> |
108 | <img | 103 | <img |
109 | src={ | 104 | src={ |
110 | availableServices[i].custom_icon | 105 | availableServices[i].custom_icon || |
111 | || availableServices[i].recipe.icons.svg | 106 | availableServices[i].recipe.icons.svg |
112 | } | 107 | } |
113 | className={classnames({ | 108 | className={classnames({ |
114 | 'service-table__icon': true, | 109 | 'service-table__icon': true, |
@@ -133,7 +128,7 @@ class Import extends Component { | |||
133 | </strong> | 128 | </strong> |
134 | <p> | 129 | <p> |
135 | {services | 130 | {services |
136 | .filter((s) => !s.recipe) | 131 | .filter(s => !s.recipe) |
137 | .map((service, i) => ( | 132 | .map((service, i) => ( |
138 | <span key={service.id}> | 133 | <span key={service.id}> |
139 | {service.name !== '' ? service.name : service.service} | 134 | {service.name !== '' ? service.name : service.service} |
@@ -170,3 +165,5 @@ class Import extends Component { | |||
170 | ); | 165 | ); |
171 | } | 166 | } |
172 | } | 167 | } |
168 | |||
169 | export default injectIntl(Import); | ||