diff options
author | haraldox <hnaumann+github@gmail.com> | 2018-01-30 12:41:42 +0100 |
---|---|---|
committer | haraldox <hnaumann+github@gmail.com> | 2018-01-30 12:41:42 +0100 |
commit | 25446bbdf8d0020b1adfe34e4f45c1a1eec6528e (patch) | |
tree | ce1716855f3501da31ec2994e6d9ddb3d7e3fa09 /src | |
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')
-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 | ||||
-rw-r--r-- | src/containers/auth/InviteScreen.js | 9 | ||||
-rw-r--r-- | src/containers/settings/AccountScreen.js | 3 | ||||
-rw-r--r-- | src/i18n/locales/en-US.json | 1 | ||||
-rw-r--r-- | src/stores/UserStore.js | 3 | ||||
-rw-r--r-- | src/styles/invite.scss | 4 | ||||
-rw-r--r-- | src/styles/main.scss | 1 |
9 files changed, 28 insertions, 44 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, |
diff --git a/src/containers/auth/InviteScreen.js b/src/containers/auth/InviteScreen.js index a624e2245..42a00f1fc 100644 --- a/src/containers/auth/InviteScreen.js +++ b/src/containers/auth/InviteScreen.js | |||
@@ -11,9 +11,9 @@ export default class InviteScreen extends Component { | |||
11 | } | 11 | } |
12 | 12 | ||
13 | render() { | 13 | render() { |
14 | const { | 14 | const { |
15 | actions, | 15 | actions, |
16 | location | 16 | location, |
17 | } = this.props; | 17 | } = this.props; |
18 | 18 | ||
19 | return ( | 19 | return ( |
@@ -31,4 +31,9 @@ InviteScreen.wrappedComponent.propTypes = { | |||
31 | invite: PropTypes.func.isRequired, | 31 | invite: PropTypes.func.isRequired, |
32 | }).isRequired, | 32 | }).isRequired, |
33 | }).isRequired, | 33 | }).isRequired, |
34 | location: PropTypes.shape({ | ||
35 | query: PropTypes.shape({ | ||
36 | from: PropTypes.string, | ||
37 | }), | ||
38 | }).isRequired, | ||
34 | }; | 39 | }; |
diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js index b57530884..5b0f1073b 100644 --- a/src/containers/settings/AccountScreen.js +++ b/src/containers/settings/AccountScreen.js | |||
@@ -107,4 +107,7 @@ AccountScreen.wrappedComponent.propTypes = { | |||
107 | delete: PropTypes.func.isRequired, | 107 | delete: PropTypes.func.isRequired, |
108 | }).isRequired, | 108 | }).isRequired, |
109 | }).isRequired, | 109 | }).isRequired, |
110 | location: PropTypes.shape({ | ||
111 | pathname: PropTypes.string, | ||
112 | }).isRequired, | ||
110 | }; | 113 | }; |
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index c9e9b860b..6162455bb 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json | |||
@@ -45,7 +45,6 @@ | |||
45 | "invite.name.label": "Name", | 45 | "invite.name.label": "Name", |
46 | "invite.email.label": "Email address", | 46 | "invite.email.label": "Email address", |
47 | "invite.skip.label": "I want to do this later", | 47 | "invite.skip.label": "I want to do this later", |
48 | "invite.error.noEmails": "At least one email address is required", | ||
49 | "subscription.submit.label": "I want to support the development of Franz", | 48 | "subscription.submit.label": "I want to support the development of Franz", |
50 | "subscription.paymentSessionError": "Could not initialize payment form", | 49 | "subscription.paymentSessionError": "Could not initialize payment form", |
51 | "subscription.includedFeatures": "Paid Franz Premium Supporter Account includes", | 50 | "subscription.includedFeatures": "Paid Franz Premium Supporter Account includes", |
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js index 476c1f040..91b544b29 100644 --- a/src/stores/UserStore.js +++ b/src/stores/UserStore.js | |||
@@ -2,6 +2,7 @@ import { observable, computed, action } from 'mobx'; | |||
2 | import moment from 'moment'; | 2 | import moment from 'moment'; |
3 | import jwt from 'jsonwebtoken'; | 3 | import jwt from 'jsonwebtoken'; |
4 | 4 | ||
5 | import { isDevMode } from '../environment'; | ||
5 | import Store from './lib/Store'; | 6 | import Store from './lib/Store'; |
6 | import Request from './lib/Request'; | 7 | import Request from './lib/Request'; |
7 | import CachedRequest from './lib/CachedRequest'; | 8 | import CachedRequest from './lib/CachedRequest'; |
@@ -166,7 +167,7 @@ export default class UserStore extends Store { | |||
166 | this.inviteRequest.execute(data); | 167 | this.inviteRequest.execute(data); |
167 | 168 | ||
168 | // we do not wait for a server response before redirecting the user | 169 | // we do not wait for a server response before redirecting the user |
169 | this.stores.router.push(!!from ? from : '/'); | 170 | this.stores.router.push(from || '/'); |
170 | 171 | ||
171 | gaEvent('User', 'inviteUsers'); | 172 | gaEvent('User', 'inviteUsers'); |
172 | } | 173 | } |
diff --git a/src/styles/invite.scss b/src/styles/invite.scss deleted file mode 100644 index 345095da8..000000000 --- a/src/styles/invite.scss +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | .invite-form__error { | ||
2 | text-align: center; | ||
3 | margin-bottom: 20px !important; /* otherwise overridden by rule: p:last-of-type */ | ||
4 | } | ||
diff --git a/src/styles/main.scss b/src/styles/main.scss index 20f1803e4..261396f6f 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss | |||
@@ -18,7 +18,6 @@ $mdi-font-path: '../node_modules/mdi/fonts'; | |||
18 | @import './type.scss'; | 18 | @import './type.scss'; |
19 | @import './welcome.scss'; | 19 | @import './welcome.scss'; |
20 | @import './auth.scss'; | 20 | @import './auth.scss'; |
21 | @import './invite.scss'; | ||
22 | @import './tooltip.scss'; | 21 | @import './tooltip.scss'; |
23 | @import './info-bar.scss'; | 22 | @import './info-bar.scss'; |
24 | @import './status-bar-target-url.scss'; | 23 | @import './status-bar-target-url.scss'; |