aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/auth/ChangeServer.js
diff options
context:
space:
mode:
authorLibravatar Bennett <hello@vantezzen.io>2020-03-25 10:30:08 +0100
committerLibravatar GitHub <noreply@github.com>2020-03-25 10:30:08 +0100
commit1cc9c70e4774f4da8b1ad927d6cb7f74c0ce730a (patch)
treec66660ee310029431c6943b31d6f8c53fcc59616 /src/components/auth/ChangeServer.js
parentSupport new recipe repository hierarchy (#492) (diff)
downloadferdium-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/auth/ChangeServer.js')
-rw-r--r--src/components/auth/ChangeServer.js80
1 files changed, 80 insertions, 0 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 @@
1import React, { Component } from 'react';
2import PropTypes from 'prop-types';
3import { observer } from 'mobx-react';
4import { defineMessages, intlShape } from 'react-intl';
5
6import Form from '../../lib/Form';
7import Input from '../ui/Input';
8import Button from '../ui/Button';
9
10const 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
25export 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}