about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/closed_registrations_modal/index.js
blob: cb91636cb810c76a16ed51aa89cf4e0dca54a412 (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
import React from 'react';
import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { domain } from 'flavours/glitch/initial_state';
import { fetchServer } from 'flavours/glitch/actions/server';

const mapStateToProps = state => ({
  message: state.getIn(['server', 'server', 'registrations', 'message']),
});

export default @connect(mapStateToProps)
class ClosedRegistrationsModal extends ImmutablePureComponent {

  componentDidMount () {
    const { dispatch } = this.props;
    dispatch(fetchServer());
  }

  render () {
    let closedRegistrationsMessage;

    if (this.props.message) {
      closedRegistrationsMessage = (
        <p
          className='prose'
          dangerouslySetInnerHTML={{ __html: this.props.message }}
        />
      );
    } else {
      closedRegistrationsMessage = (
        <p className='prose'>
          <FormattedMessage
            id='closed_registrations_modal.description'
            defaultMessage='Creating an account on {domain} is currently not possible, but please keep in mind that you do not need an account specifically on {domain} to use Mastodon.'
            values={{ domain: <strong>{domain}</strong> }}
          />
        </p>
      );
    }

    return (
      <div className='modal-root__modal interaction-modal'>
        <div className='interaction-modal__lead'>
          <h3><FormattedMessage id='closed_registrations_modal.title' defaultMessage='Signing up on Mastodon' /></h3>
          <p>
            <FormattedMessage
              id='closed_registrations_modal.preamble'
              defaultMessage='Mastodon is decentralized, so no matter where you create your account, you will be able to follow and interact with anyone on this server. You can even self-host it!'
            />
          </p>
        </div>

        <div className='interaction-modal__choices'>
          <div className='interaction-modal__choices__choice'>
            <h3><FormattedMessage id='interaction_modal.on_this_server' defaultMessage='On this server' /></h3>
            {closedRegistrationsMessage}
          </div>

          <div className='interaction-modal__choices__choice'>
            <h3><FormattedMessage id='interaction_modal.on_another_server' defaultMessage='On a different server' /></h3>
            <p className='prose'>
              <FormattedMessage
                id='closed_registrations.other_server_instructions'
                defaultMessage='Since Mastodon is decentralized, you can create an account on another server and still interact with this one.'
              />
            </p>
            <a href='https://joinmastodon.org/servers' className='button button--block'><FormattedMessage id='closed_registrations_modal.find_another_server' defaultMessage='Find another server' /></a>
          </div>
        </div>
      </div>
    );
  }

};