You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.9 KiB

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