aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/auth/Pricing.js
blob: 13a1e235141d83714d9a5e2df227cedfec3a4e16 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { observer, PropTypes as MobxPropTypes } from 'mobx-react';
import { defineMessages, intlShape } from 'react-intl';
// import { Link } from 'react-router';

// import Button from '../ui/Button';
import Loader from '../ui/Loader';
import Appear from '../ui/effects/Appear';
import SubscriptionForm from '../../containers/subscription/SubscriptionFormScreen';

const messages = defineMessages({
  headline: {
    id: 'pricing.headline',
    defaultMessage: '!!!Support Ferdi',
  },
  monthlySupportLabel: {
    id: 'pricing.support.label',
    defaultMessage: '!!!Select your support plan',
  },
  submitButtonLabel: {
    id: 'pricing.submit.label',
    defaultMessage: '!!!Support the development of Ferdi',
  },
  skipPayment: {
    id: 'pricing.link.skipPayment',
    defaultMessage: '!!!I don\'t want to support the development of Ferdi.',
  },
});

export default @observer class Signup extends Component {
  static propTypes = {
    donor: MobxPropTypes.objectOrObservableObject.isRequired,
    isLoading: PropTypes.bool.isRequired,
    isLoadingUser: PropTypes.bool.isRequired,
    onCloseSubscriptionWindow: PropTypes.func.isRequired,
    skipAction: PropTypes.func.isRequired,
  };

  static contextTypes = {
    intl: intlShape,
  };

  render() {
    const {
      donor,
      isLoading,
      isLoadingUser,
      onCloseSubscriptionWindow,
      skipAction,
    } = this.props;
    const { intl } = this.context;

    return (
      <div className="auth__scroll-container">
        <div className="auth__container auth__container--signup">
          <form className="Ferdi-form auth__form">
            <img
              src="./assets/images/sm.png"
              className="auth__logo auth__logo--sm"
              alt=""
            />
            <h1>{intl.formatMessage(messages.headline)}</h1>
            <div className="auth__letter">
              {isLoadingUser && (
                <p>Loading</p>
              )}
              {!isLoadingUser && (
                donor.amount ? (
                  <span>
                    <p>
                      Thank you so much for your previous donation of
                      {' '}
                      <strong>
                        $
                        {donor.amount}
                      </strong>
                      .
                      <br />
                      Your support allowed us to get where we are today.
                      <br />
                    </p>
                    <p>
                      As an early supporter, you get
                      {' '}
                      <strong>a lifetime premium supporter license</strong>
                      {' '}
                      without any
                      additional charges.
                    </p>
                    <p>
                      However, If you want to keep supporting us, you are more than welcome to subscribe to a plan.
                      <br />
                      <br />
                    </p>
                  </span>
                ) : (
                  <span>
                    <p>
                      We built Ferdi with a lot of effort, manpower and love,
                      to bring you the best messaging experience.
                      <br />
                    </p>
                    <p>
                      Getting a Ferdi Premium Supporter License will allow us to keep improving Ferdi for you.
                    </p>
                  </span>
                )
              )}
              <p>
                Thanks for being a hero.
              </p>
              <p>
                <strong>Stefan Malzner</strong>
              </p>
            </div>
            <Loader loaded={!isLoading}>
              <Appear transitionName="slideDown">
                <span className="label">{intl.formatMessage(messages.monthlySupportLabel)}</span>
                <SubscriptionForm
                  onCloseWindow={onCloseSubscriptionWindow}
                  showSkipOption
                  skipAction={skipAction}
                  hideInfo={Boolean(donor.amount)}
                  skipButtonLabel={intl.formatMessage(messages.skipPayment)}
                />
              </Appear>
            </Loader>
          </form>
        </div>
      </div>
    );
  }
}