@@ -338,19 +338,26 @@ class InvitesSend extends React.Component {
340 render() {
340 render() {
342+ const dif = (this.state.status === STATUS.DONE)
343+ ? this.state.targets.length
341 const invitesAvailable = this.state.invitesAvailable.matchWith({
346 const invitesAvailable = this.state.invitesAvailable.matchWith({
342 Nothing: () => 'Loading...',
347 Nothing: () => 'Loading...',
343 Just: (invites) => {
348 Just: (invites) => {
349+ const dia = dif ? `(-${dif})` : '';
344− return `You currently have ${invites.value} invitations left.`;
350+ return `You currently have ${invites.value}${dia} invitations left.`;
348 const invitesSent = this.state.invited.matchWith({
354 const invitesSent = this.state.invited.matchWith({
349 Nothing: () => (<>{'Loading...'}</>),
355 Nothing: () => (<>{'Loading...'}</>),
350 Just: (invited) => {
356 Just: (invited) => {
357+ const dit = dif ? `(+${dif})` : '';
351 return (<>
358 return (<>
352 {'Out of the '}
359 {'Out of the '}
353− {invited.value.total}
360+ {invited.value.total + dit}
354 {' invites you sent, '}
361 {' invites you sent, '}
355 {invited.value.accepted}
362 {invited.value.accepted}
356 {' have been accepted.'}
363 {' have been accepted.'}
@@ -373,31 +380,88 @@ class InvitesSend extends React.Component {
373 Just: msg => (<Warning className={'mt-8'}>{msg.value}</Warning>)
380 Just: msg => (<Warning className={'mt-8'}>{msg.value}</Warning>)
376− //TODO don't render inputs at all if STATUS.DONE
383+ let inputs;
384+ if (this.state.status === STATUS.DONE) {
385+ //TODO proper clickable router thing
386+ inputs = '<- Back to Home';
378− const inputDisabled = (this.state.status !== STATUS.INPUT);
389+ const inputDisabled = (this.state.status !== STATUS.INPUT);
391+ const lessButton = (
393+ prop-size={'s narrow'}
395+ disabled={inputDisabled || this.state.targets.length === 1}
396+ onClick={this.removeTarget}
402+ const moreButton = (
404+ prop-size={'s narrow'}
408+ this.state.invitesAvailable.matchWith({
409+ Nothing: () => true,
410+ Just: (inv) => (inv.value <= this.state.targets.length)
413+ onClick={this.addTarget}
380− let targetInputs = [];
419+ let targetInputs = [];
381− for (let i = 0; i < this.state.targets.length; i++) {
420+ for (let i = 0; i < this.state.targets.length; i++) {
382− const target = this.state.targets[i];
421+ const target = this.state.targets[i];
383− let progress = target.status.matchWith({
422+ let progress = target.status.matchWith({
384− Nothing: () => '',
423+ Nothing: () => '',
385− Just: status => status.value
424+ Just: status => status.value
387− targetInputs.push(<>
426+ targetInputs.push(<>
389− value={ target.email }
428+ value={ target.email }
390− onChange={ (value) => { this.handleEmailInput(i, value); } }
429+ onChange={ (value) => { this.handleEmailInput(i, value); } }
391− placeholder={'Email address'}
430+ placeholder={'Email address'}
392− disabled={ inputDisabled }>
431+ disabled={ inputDisabled }>
393− </Input>
432+ </Input>
395− target.hasReceived.matchWith({
434+ target.hasReceived.matchWith({
396− Nothing: () => null,
435+ Nothing: () => null,
397− Just: (has) => has.value ? <span>{'×'}</span> : <span>{'°'}</span>
436+ Just: (has) => has.value ? <span>{'×'}</span> : <span>{'°'}</span>
400− { progress }
439+ { progress }
443+ const submitButton = (
445+ prop-size={'xl wide'}
447+ disabled={ (inputDisabled && (this.state.status !== STATUS.CAN_SEND))
448+ || !this.canSend() }
450+ if (this.state.status === STATUS.INPUT)
451+ this.generateInvites();
452+ if (this.state.status === STATUS.CAN_SEND)
456+ { this.state.status }
@@ -415,46 +479,7 @@ class InvitesSend extends React.Component {
416 { fundingMessage }
480 { fundingMessage }
418− <Button
482+ { inputs }
419− prop-size={'s narrow'}
421− disabled={inputDisabled || this.state.targets.length === 1}
422− onClick={this.removeTarget}
428− prop-size={'s narrow'}
432− this.state.invitesAvailable.matchWith({
433− Nothing: () => true,
434− Just: (inv) => (inv.value <= this.state.targets.length)
437− onClick={this.addTarget}
445− prop-size={'xl wide'}
447− disabled={ (inputDisabled && (this.state.status !== STATUS.CAN_SEND))
448− || !this.canSend() }
450− if (this.state.status === STATUS.INPUT)
451− this.generateInvites();
452− if (this.state.status === STATUS.CAN_SEND)
456− { this.state.status }