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.

UnsupportedMobileBrowser.js 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. import React, { Component } from 'react';
  2. import { connect } from 'react-redux';
  3. import { appNavigate } from '../../app';
  4. import { Platform } from '../../base/react';
  5. import { mobileBrowserPageIsShown } 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 browser page.
  16. *
  17. * @class UnsupportedMobileBrowser
  18. */
  19. class UnsupportedMobileBrowser extends Component {
  20. /**
  21. * Mobile browser page component's property types.
  22. *
  23. * @static
  24. */
  25. static propTypes = {
  26. dispatch: React.PropTypes.func,
  27. room: React.PropTypes.string
  28. }
  29. /**
  30. * Constructor of UnsupportedMobileBrowser component.
  31. *
  32. * @param {Object} props - The read-only React Component props with which
  33. * the new instance is to be initialized.
  34. */
  35. constructor(props) {
  36. super(props);
  37. // Bind methods
  38. this._onClickJoin = this._onClickJoin.bind(this);
  39. }
  40. /**
  41. * React lifecycle method triggered after component is mounted.
  42. *
  43. * @returns {void}
  44. */
  45. componentDidMount() {
  46. this.props.dispatch(mobileBrowserPageIsShown());
  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. link = '';
  63. }
  64. this.setState({
  65. btnText,
  66. link
  67. });
  68. }
  69. /**
  70. * Renders component.
  71. *
  72. * @returns {ReactElement}
  73. */
  74. render() {
  75. const ns = 'unsupported-mobile-browser';
  76. const primaryButtonClasses
  77. = `${ns}__button ${ns}__button_primary`;
  78. return (
  79. <div className = { ns }>
  80. <div className = { `${ns}__body` }>
  81. <img
  82. className = { `${ns}__logo` }
  83. src = '/images/logo-blue.svg' />
  84. <p className = { `${ns}__text` }>
  85. You need <strong>Jitsi Meet</strong> to join a
  86. conversation on your mobile
  87. </p>
  88. <a href = { URLS[Platform.OS] }>
  89. <button className = { primaryButtonClasses }>
  90. Download the App
  91. </button>
  92. </a>
  93. <p className = { `${ns}__text ${ns}__text_small` }>
  94. or if you already have it
  95. <br />
  96. <strong>then</strong>
  97. </p>
  98. <button
  99. className = { `${ns}__button` }
  100. onClick = { this._onClickJoin }>
  101. {
  102. this.state.btnText
  103. }
  104. </button>
  105. </div>
  106. </div>
  107. );
  108. }
  109. /**
  110. * Navigates to the next state of the app.
  111. *
  112. * @private
  113. * @returns {void}
  114. */
  115. _onClickJoin() {
  116. this.props.dispatch(appNavigate(this.state.link));
  117. }
  118. }
  119. /**
  120. * Maps (parts of) the Redux state to the associated UnsupportedMobileBrowser's
  121. * props.
  122. *
  123. * @param {Object} state - Redux state.
  124. * @returns {{
  125. * room: string
  126. * }}
  127. */
  128. function mapStateToProps(state) {
  129. return {
  130. room: state['features/base/conference'].room
  131. };
  132. }
  133. export default connect(mapStateToProps)(UnsupportedMobileBrowser);