index.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3. import { FormattedMessage } from 'react-intl';
  4. import ImmutablePureComponent from 'react-immutable-pure-component';
  5. import { domain } from 'mastodon/initial_state';
  6. import { fetchServer } from 'mastodon/actions/server';
  7. const mapStateToProps = state => ({
  8. message: state.getIn(['server', 'server', 'registrations', 'message']),
  9. });
  10. export default @connect(mapStateToProps)
  11. class ClosedRegistrationsModal extends ImmutablePureComponent {
  12. componentDidMount () {
  13. const { dispatch } = this.props;
  14. dispatch(fetchServer());
  15. }
  16. render () {
  17. let closedRegistrationsMessage;
  18. if (this.props.message) {
  19. closedRegistrationsMessage = (
  20. <p
  21. className='prose'
  22. dangerouslySetInnerHTML={{ __html: this.props.message }}
  23. />
  24. );
  25. } else {
  26. closedRegistrationsMessage = (
  27. <p className='prose'>
  28. <FormattedMessage
  29. id='closed_registrations_modal.description'
  30. 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.'
  31. values={{ domain: <strong>{domain}</strong> }}
  32. />
  33. </p>
  34. );
  35. }
  36. return (
  37. <div className='modal-root__modal interaction-modal'>
  38. <div className='interaction-modal__lead'>
  39. <h3><FormattedMessage id='closed_registrations_modal.title' defaultMessage='Signing up on Mastodon' /></h3>
  40. <p>
  41. <FormattedMessage
  42. id='closed_registrations_modal.preamble'
  43. 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!'
  44. />
  45. </p>
  46. </div>
  47. <div className='interaction-modal__choices'>
  48. <div className='interaction-modal__choices__choice'>
  49. <h3><FormattedMessage id='interaction_modal.on_this_server' defaultMessage='On this server' /></h3>
  50. {closedRegistrationsMessage}
  51. </div>
  52. <div className='interaction-modal__choices__choice'>
  53. <h3><FormattedMessage id='interaction_modal.on_another_server' defaultMessage='On a different server' /></h3>
  54. <p className='prose'>
  55. <FormattedMessage
  56. id='closed_registrations.other_server_instructions'
  57. defaultMessage='Since Mastodon is decentralized, you can create an account on another server and still interact with this one.'
  58. />
  59. </p>
  60. <a href='https://joinmastodon.org/servers' className='button button--block'><FormattedMessage id='closed_registrations_modal.find_another_server' defaultMessage='Find another server' /></a>
  61. </div>
  62. </div>
  63. </div>
  64. );
  65. }
  66. };