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.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. import React, { Component } from 'react';
  2. import { connect } from 'react-redux';
  3. import { Link } from 'react-router';
  4. import { landingIsShown } from '../actions';
  5. const LINKS = {
  6. 'android': 'https://play.google.com/store/apps/details?id=org.jitsi.meet',
  7. 'ios': 'https://itunes.apple.com/us/app/jitsi-meet/id1165103905'
  8. };
  9. /**
  10. * React component representing mobile landing page.
  11. *
  12. * @class Landing
  13. */
  14. class Landing extends Component {
  15. static propTypes = {
  16. dispatch: React.PropTypes.func,
  17. platform: React.PropTypes.string,
  18. room: React.PropTypes.string
  19. }
  20. /**
  21. * React lifecycle method triggered after component is mounted.
  22. *
  23. * @returns {void}
  24. */
  25. componentDidMount() {
  26. this.props.dispatch(landingIsShown());
  27. }
  28. /**
  29. * React lifecycle method triggered before component will mount.
  30. *
  31. * @returns {void}
  32. */
  33. componentWillMount() {
  34. const { room } = this.props;
  35. let btnText;
  36. let link = '/';
  37. if (room) {
  38. btnText = 'Join the conversation';
  39. link += room;
  40. } else {
  41. btnText = 'Start a conference';
  42. }
  43. this.setState({
  44. btnText,
  45. link
  46. });
  47. }
  48. /**
  49. * Renders landing component.
  50. *
  51. * @returns {ReactElement}
  52. */
  53. render() {
  54. const { platform } = this.props;
  55. const { btnText, link } = this.state;
  56. const primaryButtonClasses = 'landing__button landing__button_primary';
  57. return (
  58. <div className = 'landing'>
  59. <div className = 'landing__body'>
  60. <img
  61. className = 'landing__logo'
  62. src = '/images/logo-blue.svg' />
  63. <p className = 'landing__text'>
  64. You need <strong>Jitsi Meet</strong> to join a
  65. conversation on your mobile
  66. </p>
  67. <a href = { LINKS[platform] }>
  68. <button
  69. className = { primaryButtonClasses }>
  70. Download the App
  71. </button>
  72. </a>
  73. <p className = 'landing__text landing__text_small'>
  74. or if you already have it
  75. <br /><strong>then</strong>
  76. </p>
  77. <Link to = { link }>
  78. <button
  79. className = 'landing__button'>{ btnText }</button>
  80. </Link>
  81. </div>
  82. </div>
  83. );
  84. }
  85. }
  86. /**
  87. * Maps (parts of) the Redux state to the associated Landing's props.
  88. *
  89. * @param {Object} state - Redux state.
  90. * @returns {{
  91. * platform: string,
  92. * room: string
  93. * }}
  94. */
  95. function mapStateToProps(state) {
  96. return {
  97. platform: state['features/app'].platform,
  98. room: state['features/base/conference'].room
  99. };
  100. }
  101. export default connect(mapStateToProps)(Landing);