@@ -4,7 +4,7 @@ import * as azimuth from 'azimuth-js'
44
55import { BRIDGE_ERROR } from '../lib/error'
66import { hasReceived, sendMail } from '../lib/inviteMail'
7−import { Row, Col, Button, Input } from '../components/Base'
7+import { Row, Col, Button, Input, H3, Warning } from '../components/Base'
88import { addressFromSecp256k1Public } from '../lib/wallet'
99
1010// for wallet generation
@@ -48,6 +48,7 @@ class InvitesSend extends React.Component {
4848 invited: Nothing(),
4949 targets: [{ email: '', hasReceived: Nothing(), status: Nothing() }],
5050 status: STATUS.INPUT,
51+ errors: Nothing(),
5152 //
5253 invites: []
5354 }
@@ -206,21 +207,24 @@ class InvitesSend extends React.Component {
206207 this.setEmailStatus(i, EMAIL_STATUS.DONE);
207208 } else {
208209 console.log('email send failed');
209− //TODO tell user to manually send email
210+ this.addError(
211+ 'Invite email failed to send for ' + invite.recipient +
212+ '. Please give them this ticket: ' + invite.ticket
213+ );
210214 //TODO but this doesn't catch sender-side failures... we may
211215 // just need really good monitoring for that...
212216 this.setEmailStatus(i, EMAIL_STATUS.FAIL);
213217 }
214218 } else {
215219 console.log('invite tx rejected');
216− //TODO properly inform user?
220+ this.addError('Invite transaction failed for ' + invite.recipient);
217221 this.setEmailStatus(i, EMAIL_STATUS.FAIL);
218222 }
219223 });
220224 })
221225 .catch(err => {
222226 console.error('invite tx sending failed', err);
223− //TODO properly inform user?
227+ this.addError('Invite transaction not sent for ' + invite.recipient);
224228 this.setEmailStatus(i, EMAIL_STATUS.FAIL);
225229 });
226230 }
@@ -234,6 +238,14 @@ class InvitesSend extends React.Component {
234238 this.setState({ targets });
235239 }
236240
241+ addError(error) {
242+ const newError = this.state.errors.matchWith({
243+ Nothing: () => [error],
244+ Just: errs => errs.value.push(error)
245+ });
246+ this.setState({ errors: Just(newError) });
247+ }
248+
237249 askForFunding(address, minBalance, balance) {
238250 this.setState({ message: Just(
239251 `Please make sure ${address} has at least ${minBalance} wei,` +
@@ -309,6 +321,16 @@ class InvitesSend extends React.Component {
309321 }
310322 });
311323
324+ let error = this.state.errors.matchWith({
325+ Nothing: () => null,
326+ Just: (errors) => (<Warning className={'mt-8'}>
327+ <H3 style={{marginTop: 0, paddingTop: 0}}>
328+ { 'Something went wrong!' }
329+ </H3>
330+ { errors.value.map(err => (<p>{err}</p>)) }
331+ </Warning>)
332+ });
333+
312334 //TODO don't render inputs at all if STATUS.DONE
313335
314336 const inputDisabled = (this.state.status !== STATUS.INPUT);
@@ -347,6 +369,8 @@ class InvitesSend extends React.Component {
347369
348370 <ul>{ invitesSent }</ul>
349371
372+ { error }
373+
350374 <Button
351375 prop-size={'s narrow'}
352376 className={'mt-8'}