aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/auth
diff options
context:
space:
mode:
authorLibravatar haraldox <hnaumann+github@gmail.com>2018-02-02 11:01:38 +0100
committerLibravatar haraldox <hnaumann+github@gmail.com>2018-02-02 11:01:38 +0100
commitf74d47acb7ee470e24245667c9195604faa66a20 (patch)
tree1f441a5acbf1e8661f47a8cf5ca8bc30493d5724 /src/components/auth
parent[WIP] started work on infobox (diff)
downloadferdium-app-f74d47acb7ee470e24245667c9195604faa66a20.tar.gz
ferdium-app-f74d47acb7ee470e24245667c9195604faa66a20.tar.zst
ferdium-app-f74d47acb7ee470e24245667c9195604faa66a20.zip
got server callback and infobox working
Diffstat (limited to 'src/components/auth')
-rw-r--r--src/components/auth/Invite.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/components/auth/Invite.js b/src/components/auth/Invite.js
index 2776af05f..dbbe58900 100644
--- a/src/components/auth/Invite.js
+++ b/src/components/auth/Invite.js
@@ -52,6 +52,14 @@ export default class Invite extends Component {
52 intl: intlShape, 52 intl: intlShape,
53 }; 53 };
54 54
55 state = { showSuccessMessage: false };
56
57 handlers = {
58 onChange: (field) => {
59 this.setState({ showSuccessMessage: false })
60 }
61 };
62
55 form = new Form({ 63 form = new Form({
56 fields: { 64 fields: {
57 invite: [...Array(3).fill({ 65 invite: [...Array(3).fill({
@@ -59,10 +67,13 @@ export default class Invite extends Component {
59 name: { 67 name: {
60 label: this.context.intl.formatMessage(messages.nameLabel), 68 label: this.context.intl.formatMessage(messages.nameLabel),
61 placeholder: this.context.intl.formatMessage(messages.nameLabel), 69 placeholder: this.context.intl.formatMessage(messages.nameLabel),
70 handlers: this.handlers,
71 // related: ['invite.0.email'], // path accepted but does not work
62 }, 72 },
63 email: { 73 email: {
64 label: this.context.intl.formatMessage(messages.emailLabel), 74 label: this.context.intl.formatMessage(messages.emailLabel),
65 placeholder: this.context.intl.formatMessage(messages.emailLabel), 75 placeholder: this.context.intl.formatMessage(messages.emailLabel),
76 handlers: this.handlers,
66 validators: [email], 77 validators: [email],
67 }, 78 },
68 }, 79 },
@@ -81,8 +92,11 @@ export default class Invite extends Component {
81 invites: form.values().invite, 92 invites: form.values().invite,
82 from 93 from
83 }); 94 });
95
84 this.form.clear() 96 this.form.clear()
85 this.form.$('invite').$('0').focus() 97 // this.form.$('invite.0.name').focus() // path accepted but does not focus ;(
98 document.querySelector('input:first-child').focus()
99 this.setState({ showSuccessMessage: true })
86 }, 100 },
87 onError: () => {}, 101 onError: () => {},
88 }); 102 });
@@ -91,7 +105,7 @@ export default class Invite extends Component {
91 render() { 105 render() {
92 const { form } = this; 106 const { form } = this;
93 const { intl } = this.context; 107 const { intl } = this.context;
94 const { from, embed, success } = this.props; 108 const { from, embed, success, isInviteSuccessful } = this.props;
95 109
96 const atLeastOneEmailAddress = form.$('invite') 110 const atLeastOneEmailAddress = form.$('invite')
97 .map(invite => invite.$('email').value) 111 .map(invite => invite.$('email').value)
@@ -102,11 +116,9 @@ export default class Invite extends Component {
102 'invite__embed--button': embed, 116 'invite__embed--button': embed,
103 }); 117 });
104 118
105 console.log(success)
106
107 return ( 119 return (
108 <div> 120 <div>
109 {(success && <Appear> 121 {this.state.showSuccessMessage && isInviteSuccessful && (<Appear>
110 <Infobox 122 <Infobox
111 type="success" 123 type="success"
112 icon="checkbox-marked-circle-outline" 124 icon="checkbox-marked-circle-outline"