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.

Landing.js 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. import React, { Component } from 'react';
  2. import { connect } from 'react-redux';
  3. import { Platform } from '../../base/react';
  4. import { appNavigate } from '../../app';
  5. import { landingIsShown } from '../actions';
  6. /**
  7. * The map of platforms to URLs at which the mobile app for the associated
  8. * platform is available for download.
  9. */
  10. const URLS = {
  11. android: 'https://play.google.com/store/apps/details?id=org.jitsi.meet',
  12. ios: 'https://itunes.apple.com/us/app/jitsi-meet/id1165103905'
  13. };
  14. /**
  15. * React component representing mobile landing page.
  16. *
  17. * @class Landing
  18. */
  19. class Landing extends Component {
  20. /**
  21. * Constructor of Landing component.
  22. *
  23. * @param {Object} props - The read-only React Component props with which
  24. * the new instance is to be initialized.
  25. */
  26. constructor(props) {
  27. super(props);
  28. // Bind methods
  29. this._onClickJoin = this._onClickJoin.bind(this);
  30. }
  31. /**
  32. * Landing component's property types.
  33. *
  34. * @static
  35. */
  36. static propTypes = {
  37. dispatch: React.PropTypes.func,
  38. room: React.PropTypes.string
  39. }
  40. /**
  41. * React lifecycle method triggered after component is mounted.
  42. *
  43. * @returns {void}
  44. */
  45. componentDidMount() {
  46. this.props.dispatch(landingIsShown());
  47. }
  48. /**
  49. * React lifecycle method triggered before component will mount.
  50. *
  51. * @returns {void}
  52. */
  53. componentWillMount() {
  54. const { room } = this.props;
  55. let btnText;
  56. let link = '';
  57. if (room) {
  58. btnText = 'Join the conversation';
  59. link += room;
  60. } else {
  61. btnText = 'Start a conference';
  62. }
  63. this.setState({
  64. btnText,
  65. link
  66. });
  67. }
  68. /**
  69. * Navigates to the next state of the app.
  70. *
  71. * @returns {void}
  72. * @private
  73. */
  74. _onClickJoin() {
  75. const { link } = this.state;
  76. this.props.dispatch(appNavigate(link));
  77. }
  78. /**
  79. * Renders landing component.
  80. *
  81. * @returns {ReactElement}
  82. */
  83. render() {
  84. const { btnText } = this.state;
  85. const primaryButtonClasses = 'landing__button landing__button_primary';
  86. return (
  87. <div className = 'landing'>
  88. <div className = 'landing__body'>
  89. <img
  90. className = 'landing__logo'
  91. src = '/images/logo-blue.svg' />
  92. <p className = 'landing__text'>
  93. You need <strong>Jitsi Meet</strong> to join a
  94. conversation on your mobile
  95. </p>
  96. <a href = { URLS[Platform.OS] }>
  97. <button className = { primaryButtonClasses }>
  98. Download the App
  99. </button>
  100. </a>
  101. <p className = 'landing__text landing__text_small'>
  102. or if you already have it
  103. <br />
  104. <strong>then</strong>
  105. </p>
  106. <button
  107. className = 'landing__button'
  108. onClick = { this._onClickJoin }>
  109. { btnText }
  110. </button>
  111. </div>
  112. </div>
  113. );
  114. }
  115. }
  116. /**
  117. * Maps (parts of) the Redux state to the associated Landing's props.
  118. *
  119. * @param {Object} state - Redux state.
  120. * @returns {{
  121. * room: string
  122. * }}
  123. */
  124. function mapStateToProps(state) {
  125. return {
  126. room: state['features/base/conference'].room
  127. };
  128. }
  129. export default connect(mapStateToProps)(Landing);