aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers/settings/InviteScreen.js
blob: 923f080698d6d19c18302cd53f9c2fa73c2d3945 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { inject, observer } from 'mobx-react';
import Invite from '../../components/auth/Invite';
import { gaPage } from '../../lib/analytics';
import { defineMessages, intlShape } from 'react-intl';

const messages = defineMessages({
  headline: {
    id: 'settings.invite.headline',
    defaultMessage: '!!!Invite Friends',
  },
});

@inject('stores', 'actions') @observer
export default class InviteScreen extends Component {
  static contextTypes = {
    intl: intlShape,
  };

  componentDidMount() {
    gaPage('Settings/Invite');
  }

  render() {
    const {
      actions,
      location,
    } = this.props;

    return (
      <div className="settings__main">
        <div className="settings__header">
          <h1>{this.context.intl.formatMessage(messages.headline)}</h1>
        </div>
        <div className="settings__body invite__form">
          <Invite
            onSubmit={actions.user.invite}
            from={location.query.from}
            embed={true}
            success={location.query.success}
          />
        </div>
      </div>
    );
  }
}

InviteScreen.wrappedComponent.propTypes = {
  actions: PropTypes.shape({
    user: PropTypes.shape({
      invite: PropTypes.func.isRequired,
    }).isRequired,
  }).isRequired,
  location: PropTypes.shape({
    query: PropTypes.shape({
      from: PropTypes.string,
    }),
  }).isRequired,
};