diff options
author | Bennett <hello@vantezzen.io> | 2020-03-25 10:30:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-25 10:30:08 +0100 |
commit | 1cc9c70e4774f4da8b1ad927d6cb7f74c0ce730a (patch) | |
tree | c66660ee310029431c6943b31d6f8c53fcc59616 /src/components | |
parent | Support new recipe repository hierarchy (#492) (diff) | |
download | ferdium-app-1cc9c70e4774f4da8b1ad927d6cb7f74c0ce730a.tar.gz ferdium-app-1cc9c70e4774f4da8b1ad927d6cb7f74c0ce730a.tar.zst ferdium-app-1cc9c70e4774f4da8b1ad927d6cb7f74c0ce730a.zip |
Improve user onboarding (#493)
Until now, new users have started on the Ferdi dashboard and not on the Welcome screen like Franz does it. This change was made, as users needed to be ablet to change their server before logging in.
This commit will change this onboarding process to bring users to the welcome screen on first login and it adds a new "Change Server" screen during authentication that allows the user to change the server without going to the full settings screen.
This way, the onboarding experience for new users is a lot easier to go though while also improving the experience for experienced users who want to change their server as they only get the option they are looking for and not the whole settings list.
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/auth/ChangeServer.js | 80 | ||||
-rw-r--r-- | src/components/auth/Login.js | 4 | ||||
-rw-r--r-- | src/components/auth/Signup.js | 7 | ||||
-rw-r--r-- | src/components/auth/Welcome.js | 4 |
4 files changed, 91 insertions, 4 deletions
diff --git a/src/components/auth/ChangeServer.js b/src/components/auth/ChangeServer.js new file mode 100644 index 000000000..433334b6c --- /dev/null +++ b/src/components/auth/ChangeServer.js | |||
@@ -0,0 +1,80 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { observer } from 'mobx-react'; | ||
4 | import { defineMessages, intlShape } from 'react-intl'; | ||
5 | |||
6 | import Form from '../../lib/Form'; | ||
7 | import Input from '../ui/Input'; | ||
8 | import Button from '../ui/Button'; | ||
9 | |||
10 | const messages = defineMessages({ | ||
11 | headline: { | ||
12 | id: 'changeserver.headline', | ||
13 | defaultMessage: '!!!Change server', | ||
14 | }, | ||
15 | label: { | ||
16 | id: 'changeserver.label', | ||
17 | defaultMessage: '!!!Server', | ||
18 | }, | ||
19 | submit: { | ||
20 | id: 'changeserver.submit', | ||
21 | defaultMessage: '!!!Submit', | ||
22 | }, | ||
23 | }); | ||
24 | |||
25 | export default @observer class ChangeServer extends Component { | ||
26 | static propTypes = { | ||
27 | onSubmit: PropTypes.func.isRequired, | ||
28 | server: PropTypes.string.isRequired, | ||
29 | }; | ||
30 | |||
31 | static contextTypes = { | ||
32 | intl: intlShape, | ||
33 | }; | ||
34 | |||
35 | form = new Form({ | ||
36 | fields: { | ||
37 | server: { | ||
38 | label: this.context.intl.formatMessage(messages.label), | ||
39 | value: '', | ||
40 | }, | ||
41 | }, | ||
42 | }, this.context.intl); | ||
43 | |||
44 | componentDidMount() { | ||
45 | this.form.$('server').value = this.props.server; | ||
46 | } | ||
47 | |||
48 | submit(e) { | ||
49 | e.preventDefault(); | ||
50 | this.form.submit({ | ||
51 | onSuccess: (form) => { | ||
52 | this.props.onSubmit(form.values()); | ||
53 | }, | ||
54 | onError: () => { }, | ||
55 | }); | ||
56 | } | ||
57 | |||
58 | render() { | ||
59 | const { form } = this; | ||
60 | const { intl } = this.context; | ||
61 | |||
62 | return ( | ||
63 | <div className="auth__container"> | ||
64 | <form className="franz-form auth__form" onSubmit={e => this.submit(e)}> | ||
65 | <h1>{intl.formatMessage(messages.headline)}</h1> | ||
66 | |||
67 | <Input | ||
68 | field={form.$('server')} | ||
69 | focus | ||
70 | /> | ||
71 | <Button | ||
72 | type="submit" | ||
73 | className="auth__button" | ||
74 | label={intl.formatMessage(messages.submit)} | ||
75 | /> | ||
76 | </form> | ||
77 | </div> | ||
78 | ); | ||
79 | } | ||
80 | } | ||
diff --git a/src/components/auth/Login.js b/src/components/auth/Login.js index e25121de0..f33d134c8 100644 --- a/src/components/auth/Login.js +++ b/src/components/auth/Login.js | |||
@@ -78,6 +78,7 @@ export default @inject('actions') @observer class Login extends Component { | |||
78 | isServerLogout: PropTypes.bool.isRequired, | 78 | isServerLogout: PropTypes.bool.isRequired, |
79 | signupRoute: PropTypes.string.isRequired, | 79 | signupRoute: PropTypes.string.isRequired, |
80 | passwordRoute: PropTypes.string.isRequired, | 80 | passwordRoute: PropTypes.string.isRequired, |
81 | changeServerRoute: PropTypes.string.isRequired, | ||
81 | error: globalErrorPropType.isRequired, | 82 | error: globalErrorPropType.isRequired, |
82 | actions: PropTypes.object.isRequired, | 83 | actions: PropTypes.object.isRequired, |
83 | }; | 84 | }; |
@@ -127,6 +128,7 @@ export default @inject('actions') @observer class Login extends Component { | |||
127 | isServerLogout, | 128 | isServerLogout, |
128 | signupRoute, | 129 | signupRoute, |
129 | passwordRoute, | 130 | passwordRoute, |
131 | changeServerRoute, | ||
130 | error, | 132 | error, |
131 | } = this.props; | 133 | } = this.props; |
132 | 134 | ||
@@ -194,7 +196,7 @@ export default @inject('actions') @observer class Login extends Component { | |||
194 | )} | 196 | )} |
195 | </form> | 197 | </form> |
196 | <div className="auth__links"> | 198 | <div className="auth__links"> |
197 | <Link to="/settings/app">{intl.formatMessage(messages.changeServer)}</Link> | 199 | <Link to={changeServerRoute}>{intl.formatMessage(messages.changeServer)}</Link> |
198 | <a onClick={this.useLocalServer.bind(this)}>{intl.formatMessage(messages.serverless)}</a> | 200 | <a onClick={this.useLocalServer.bind(this)}>{intl.formatMessage(messages.serverless)}</a> |
199 | <Link to={signupRoute}>{intl.formatMessage(messages.signupLink)}</Link> | 201 | <Link to={signupRoute}>{intl.formatMessage(messages.signupLink)}</Link> |
200 | <Link to={passwordRoute}>{intl.formatMessage(messages.passwordLink)}</Link> | 202 | <Link to={passwordRoute}>{intl.formatMessage(messages.passwordLink)}</Link> |
diff --git a/src/components/auth/Signup.js b/src/components/auth/Signup.js index a166155a7..6a7db5cde 100644 --- a/src/components/auth/Signup.js +++ b/src/components/auth/Signup.js | |||
@@ -79,6 +79,7 @@ export default @inject('actions') @observer class Signup extends Component { | |||
79 | onSubmit: PropTypes.func.isRequired, | 79 | onSubmit: PropTypes.func.isRequired, |
80 | isSubmitting: PropTypes.bool.isRequired, | 80 | isSubmitting: PropTypes.bool.isRequired, |
81 | loginRoute: PropTypes.string.isRequired, | 81 | loginRoute: PropTypes.string.isRequired, |
82 | changeServerRoute: PropTypes.string.isRequired, | ||
82 | error: globalErrorPropType.isRequired, | 83 | error: globalErrorPropType.isRequired, |
83 | actions: PropTypes.object.isRequired, | 84 | actions: PropTypes.object.isRequired, |
84 | }; | 85 | }; |
@@ -130,7 +131,9 @@ export default @inject('actions') @observer class Signup extends Component { | |||
130 | render() { | 131 | render() { |
131 | const { form } = this; | 132 | const { form } = this; |
132 | const { intl } = this.context; | 133 | const { intl } = this.context; |
133 | const { isSubmitting, loginRoute, error } = this.props; | 134 | const { |
135 | isSubmitting, loginRoute, error, changeServerRoute, | ||
136 | } = this.props; | ||
134 | 137 | ||
135 | const termsBase = window.ferdi.stores.settings.all.app.server !== 'https://api.franzinfra.com' ? window.ferdi.stores.settings.all.app.server : 'https://meetfranz.com'; | 138 | const termsBase = window.ferdi.stores.settings.all.app.server !== 'https://api.franzinfra.com' ? window.ferdi.stores.settings.all.app.server : 'https://meetfranz.com'; |
136 | 139 | ||
@@ -198,7 +201,7 @@ export default @inject('actions') @observer class Signup extends Component { | |||
198 | </p> | 201 | </p> |
199 | </form> | 202 | </form> |
200 | <div className="auth__links"> | 203 | <div className="auth__links"> |
201 | <Link to="/settings/app">{intl.formatMessage(messages.changeServer)}</Link> | 204 | <Link to={changeServerRoute}>{intl.formatMessage(messages.changeServer)}</Link> |
202 | <a onClick={this.useLocalServer.bind(this)}>{intl.formatMessage(messages.serverless)}</a> | 205 | <a onClick={this.useLocalServer.bind(this)}>{intl.formatMessage(messages.serverless)}</a> |
203 | <Link to={loginRoute}>{intl.formatMessage(messages.loginLink)}</Link> | 206 | <Link to={loginRoute}>{intl.formatMessage(messages.loginLink)}</Link> |
204 | </div> | 207 | </div> |
diff --git a/src/components/auth/Welcome.js b/src/components/auth/Welcome.js index 1453c1d7c..6e742e0c1 100644 --- a/src/components/auth/Welcome.js +++ b/src/components/auth/Welcome.js | |||
@@ -26,6 +26,7 @@ export default @inject('actions') @observer class Login extends Component { | |||
26 | static propTypes = { | 26 | static propTypes = { |
27 | loginRoute: PropTypes.string.isRequired, | 27 | loginRoute: PropTypes.string.isRequired, |
28 | signupRoute: PropTypes.string.isRequired, | 28 | signupRoute: PropTypes.string.isRequired, |
29 | changeServerRoute: PropTypes.string.isRequired, | ||
29 | recipes: MobxPropTypes.arrayOrObservableArray.isRequired, | 30 | recipes: MobxPropTypes.arrayOrObservableArray.isRequired, |
30 | actions: PropTypes.object.isRequired, | 31 | actions: PropTypes.object.isRequired, |
31 | }; | 32 | }; |
@@ -43,6 +44,7 @@ export default @inject('actions') @observer class Login extends Component { | |||
43 | const { | 44 | const { |
44 | loginRoute, | 45 | loginRoute, |
45 | signupRoute, | 46 | signupRoute, |
47 | changeServerRoute, | ||
46 | recipes, | 48 | recipes, |
47 | } = this.props; | 49 | } = this.props; |
48 | 50 | ||
@@ -71,7 +73,7 @@ export default @inject('actions') @observer class Login extends Component { | |||
71 | <br /> | 73 | <br /> |
72 | 74 | ||
73 | 75 | ||
74 | <Link to="settings/app"> | 76 | <Link to={changeServerRoute}> |
75 | <span style={{ | 77 | <span style={{ |
76 | textAlign: 'center', | 78 | textAlign: 'center', |
77 | width: '100%', | 79 | width: '100%', |