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 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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': ''
  8. };
  9. /**
  10. * React component representing mobile landing page.
  11. *
  12. * @class Landing
  13. */
  14. class Landing extends Component {
  15. /**
  16. * React lifecycle method triggered after
  17. * component is mount.
  18. *
  19. * @returns {void}
  20. */
  21. componentDidMount() {
  22. this.props.dispatch(landingIsShown());
  23. }
  24. static propTypes = {
  25. dispatch: React.PropTypes.func,
  26. platform: React.PropTypes.string,
  27. room: React.PropTypes.string
  28. };
  29. /**
  30. * React lifecycle method triggered before
  31. * component will mount.
  32. *
  33. * @returns {void}
  34. */
  35. componentWillMount() {
  36. const { room } = this.props;
  37. let btnText;
  38. let link = '/';
  39. if (room) {
  40. btnText = 'Join the conversation';
  41. link += room;
  42. } else {
  43. btnText = 'Start a conference';
  44. }
  45. this.setState({
  46. btnText,
  47. link
  48. });
  49. }
  50. /**
  51. * Renders landing component.
  52. *
  53. * @returns {ReactElement}
  54. */
  55. render() {
  56. const { platform } = this.props;
  57. const { btnText, link } = this.state;
  58. const primaryButtonClasses = 'landing__button landing__button_primary';
  59. return (
  60. <div className = 'landing'>
  61. <div className = 'landing__body'>
  62. <img
  63. className = 'landing__logo'
  64. src = '/images/logo-blue.svg' />
  65. <p className = 'landing__text'>
  66. You need <strong>Meet Jitsi</strong> to
  67. join a conversation on your mobile
  68. </p>
  69. <a href = { links[platform] }>
  70. <button
  71. className = { primaryButtonClasses }>
  72. Download the App
  73. </button>
  74. </a>
  75. <p className = 'landing__text landing__text_small'>
  76. or if you already have it
  77. <br /><strong>then</strong>
  78. </p>
  79. <Link to = { link }>
  80. <button
  81. className = 'landing__button'>{ btnText }</button>
  82. </Link>
  83. </div>
  84. </div>
  85. );
  86. }
  87. }
  88. const mapStateToProps = state => {
  89. return {
  90. platform: state['features/app'].platform,
  91. room: state['features/base/conference'].room
  92. };
  93. };
  94. export default connect(mapStateToProps)(Landing);