diff options
author | 2018-01-30 12:41:42 +0100 | |
---|---|---|
committer | 2018-01-30 12:41:42 +0100 | |
commit | 25446bbdf8d0020b1adfe34e4f45c1a1eec6528e (patch) | |
tree | ce1716855f3501da31ec2994e6d9ddb3d7e3fa09 /src/components | |
parent | Merge branch 'develop' into feature/invite-button (diff) | |
download | ferdium-app-25446bbdf8d0020b1adfe34e4f45c1a1eec6528e.tar.gz ferdium-app-25446bbdf8d0020b1adfe34e4f45c1a1eec6528e.tar.zst ferdium-app-25446bbdf8d0020b1adfe34e4f45c1a1eec6528e.zip |
Merge branch 'fix-invite-screen' into feature/invite-button
fix linitng errors
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/auth/Invite.js | 39 | ||||
-rw-r--r-- | src/components/settings/account/AccountDashboard.js | 10 | ||||
-rw-r--r-- | src/components/ui/Link.js | 2 |
3 files changed, 16 insertions, 35 deletions
diff --git a/src/components/auth/Invite.js b/src/components/auth/Invite.js index 1fe594d73..fa83837ac 100644 --- a/src/components/auth/Invite.js +++ b/src/components/auth/Invite.js | |||
@@ -30,16 +30,17 @@ const messages = defineMessages({ | |||
30 | id: 'invite.skip.label', | 30 | id: 'invite.skip.label', |
31 | defaultMessage: '!!!I want to do this later', | 31 | defaultMessage: '!!!I want to do this later', |
32 | }, | 32 | }, |
33 | noEmailAddresses: { | ||
34 | id: 'invite.error.noEmails', | ||
35 | defaultMessage: '!!!At least one email address is required', | ||
36 | } | ||
37 | }); | 33 | }); |
38 | 34 | ||
39 | @observer | 35 | @observer |
40 | export default class Invite extends Component { | 36 | export default class Invite extends Component { |
41 | static propTypes = { | 37 | static propTypes = { |
42 | onSubmit: PropTypes.func.isRequired, | 38 | onSubmit: PropTypes.func.isRequired, |
39 | from: PropTypes.string, | ||
40 | }; | ||
41 | |||
42 | static defaultProps = { | ||
43 | from: '/', | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | static contextTypes = { | 46 | static contextTypes = { |
@@ -58,8 +59,8 @@ export default class Invite extends Component { | |||
58 | label: this.context.intl.formatMessage(messages.emailLabel), | 59 | label: this.context.intl.formatMessage(messages.emailLabel), |
59 | placeholder: this.context.intl.formatMessage(messages.emailLabel), | 60 | placeholder: this.context.intl.formatMessage(messages.emailLabel), |
60 | validators: [email], | 61 | validators: [email], |
61 | } | 62 | }, |
62 | } | 63 | }, |
63 | })], | 64 | })], |
64 | }, | 65 | }, |
65 | }, this.context.intl); | 66 | }, this.context.intl); |
@@ -68,21 +69,6 @@ export default class Invite extends Component { | |||
68 | e.preventDefault(); | 69 | e.preventDefault(); |
69 | this.form.submit({ | 70 | this.form.submit({ |
70 | onSuccess: (form) => { | 71 | onSuccess: (form) => { |
71 | |||
72 | this.props.onSubmit({ | ||
73 | invites: form.values().invite, | ||
74 | from: this.props.from | ||
75 | }); | ||
76 | |||
77 | const atLeastOneEmailAddress = form.$('invite') | ||
78 | .map(invite => {return invite.$('email').value}) | ||
79 | .some(email => email.trim() !== '') | ||
80 | |||
81 | if (!atLeastOneEmailAddress) { | ||
82 | form.invalidate('no-email-addresses') | ||
83 | return | ||
84 | } | ||
85 | |||
86 | this.props.onSubmit({ invites: form.values().invite }); | 72 | this.props.onSubmit({ invites: form.values().invite }); |
87 | }, | 73 | }, |
88 | onError: () => {}, | 74 | onError: () => {}, |
@@ -95,8 +81,8 @@ export default class Invite extends Component { | |||
95 | const { from } = this.props; | 81 | const { from } = this.props; |
96 | 82 | ||
97 | const atLeastOneEmailAddress = form.$('invite') | 83 | const atLeastOneEmailAddress = form.$('invite') |
98 | .map(invite => {return invite.$('email').value}) | 84 | .map(invite => invite.$('email').value) |
99 | .some(email => email.trim() !== '') | 85 | .some(emailValue => emailValue.trim() !== ''); |
100 | 86 | ||
101 | return ( | 87 | return ( |
102 | <div className="auth__container auth__container--signup"> | 88 | <div className="auth__container auth__container--signup"> |
@@ -117,11 +103,6 @@ export default class Invite extends Component { | |||
117 | </div> | 103 | </div> |
118 | </div> | 104 | </div> |
119 | ))} | 105 | ))} |
120 | {form.error === 'no-email-addresses' && ( | ||
121 | <p className="franz-form__error invite-form__error"> | ||
122 | {intl.formatMessage(messages.noEmailAddresses)} | ||
123 | </p> | ||
124 | )} | ||
125 | <Button | 106 | <Button |
126 | type="submit" | 107 | type="submit" |
127 | className="auth__button" | 108 | className="auth__button" |
@@ -129,7 +110,7 @@ export default class Invite extends Component { | |||
129 | label={intl.formatMessage(messages.submitButtonLabel)} | 110 | label={intl.formatMessage(messages.submitButtonLabel)} |
130 | /> | 111 | /> |
131 | <Link | 112 | <Link |
132 | to={ !!from ? from : '/'} | 113 | to={from || '/'} |
133 | className="franz-form__button franz-form__button--secondary auth__button auth__button--skip" | 114 | className="franz-form__button franz-form__button--secondary auth__button auth__button--skip" |
134 | > | 115 | > |
135 | {intl.formatMessage(messages.skipButtonLabel)} | 116 | {intl.formatMessage(messages.skipButtonLabel)} |
diff --git a/src/components/settings/account/AccountDashboard.js b/src/components/settings/account/AccountDashboard.js index d5f2e238c..2e2805557 100644 --- a/src/components/settings/account/AccountDashboard.js +++ b/src/components/settings/account/AccountDashboard.js | |||
@@ -49,10 +49,9 @@ const messages = defineMessages({ | |||
49 | defaultMessage: '!!!Edit Account', | 49 | defaultMessage: '!!!Edit Account', |
50 | }, | 50 | }, |
51 | accountInviteButton: { | 51 | accountInviteButton: { |
52 | id: "settings.account.account.inviteButton", | 52 | id: 'settings.account.account.inviteButton', |
53 | defaultMessage: '!!!Invite Friends', | 53 | defaultMessage: '!!!Invite Friends', |
54 | }, | 54 | }, |
55 | |||
56 | invoiceDownload: { | 55 | invoiceDownload: { |
57 | id: 'settings.account.invoiceDownload', | 56 | id: 'settings.account.invoiceDownload', |
58 | defaultMessage: '!!!Download', | 57 | defaultMessage: '!!!Download', |
@@ -96,6 +95,7 @@ export default class AccountDashboard extends Component { | |||
96 | deleteAccount: PropTypes.func.isRequired, | 95 | deleteAccount: PropTypes.func.isRequired, |
97 | isLoadingDeleteAccount: PropTypes.bool.isRequired, | 96 | isLoadingDeleteAccount: PropTypes.bool.isRequired, |
98 | isDeleteAccountSuccessful: PropTypes.bool.isRequired, | 97 | isDeleteAccountSuccessful: PropTypes.bool.isRequired, |
98 | pathname: PropTypes.string.isRequired, | ||
99 | }; | 99 | }; |
100 | 100 | ||
101 | static contextTypes = { | 101 | static contextTypes = { |
@@ -193,12 +193,12 @@ export default class AccountDashboard extends Component { | |||
193 | query: { from: pathname }, | 193 | query: { from: pathname }, |
194 | // state: { "from": 'hi' } // is not being passed to route | 194 | // state: { "from": 'hi' } // is not being passed to route |
195 | }} | 195 | }} |
196 | className="button account__invite-button"> | 196 | className="button account__invite-button" |
197 | > | ||
197 | {intl.formatMessage(messages.accountInviteButton)} | 198 | {intl.formatMessage(messages.accountInviteButton)} |
198 | </Link> | 199 | </Link> |
199 | </div> | 200 | </div> |
200 | </div> | 201 | </div> |
201 | |||
202 | {user.emailValidated} | 202 | {user.emailValidated} |
203 | </div> | 203 | </div> |
204 | </div> | 204 | </div> |
diff --git a/src/components/ui/Link.js b/src/components/ui/Link.js index bc3c2d8aa..693be84ea 100644 --- a/src/components/ui/Link.js +++ b/src/components/ui/Link.js | |||
@@ -64,7 +64,7 @@ Link.wrappedComponent.propTypes = { | |||
64 | ]).isRequired, | 64 | ]).isRequired, |
65 | to: PropTypes.oneOfType([ | 65 | to: PropTypes.oneOfType([ |
66 | PropTypes.string, | 66 | PropTypes.string, |
67 | PropTypes.object | 67 | PropTypes.object, |
68 | ]).isRequired, | 68 | ]).isRequired, |
69 | className: PropTypes.string, | 69 | className: PropTypes.string, |
70 | activeClassName: PropTypes.string, | 70 | activeClassName: PropTypes.string, |