jiti-meet/react/features/unsupported-browser/components/UnsupportedMobileBrowser.js

145 lines
4.0 KiB
JavaScript
Raw Normal View History

2016-12-23 16:21:51 +00:00
import React, { Component } from 'react';
import { connect } from 'react-redux';
2017-01-13 22:37:53 +00:00
import { Platform } from '../../base/react';
/**
* The map of platforms to URLs at which the mobile app for the associated
* platform is available for download.
*/
const URLS = {
android: 'https://play.google.com/store/apps/details?id=org.jitsi.meet',
ios: 'https://itunes.apple.com/us/app/jitsi-meet/id1165103905'
2016-12-23 16:21:51 +00:00
};
/**
2017-01-19 15:47:22 +00:00
* React component representing mobile browser page.
2016-12-23 16:21:51 +00:00
*
2017-01-25 22:11:44 +00:00
* @class UnsupportedMobileBrowser
2016-12-23 16:21:51 +00:00
*/
2017-01-25 22:11:44 +00:00
class UnsupportedMobileBrowser extends Component {
/**
* Mobile browser page component's property types.
*
* @static
*/
static propTypes = {
/**
* The name of the conference room to be joined upon clicking the
* respective button.
*
* @private
* @type {string}
*/
_room: React.PropTypes.string
2017-01-25 22:11:44 +00:00
}
2017-01-18 12:21:30 +00:00
/**
2017-01-25 22:11:44 +00:00
* Constructor of UnsupportedMobileBrowser component.
2017-01-18 12:21:30 +00:00
*
* @param {Object} props - The read-only React Component props with which
* the new instance is to be initialized.
*/
constructor(props) {
super(props);
// Bind methods
this._onJoinClick = this._onJoinClick.bind(this);
2016-12-23 16:21:51 +00:00
}
/**
2017-01-13 22:37:53 +00:00
* React lifecycle method triggered before component will mount.
2016-12-23 16:21:51 +00:00
*
* @returns {void}
*/
componentWillMount() {
const joinButtonText
= this.props._room ? 'Join the conversation' : 'Start a conference';
2016-12-23 16:21:51 +00:00
this.setState({
joinButtonText
2016-12-23 16:21:51 +00:00
});
}
/**
2017-01-19 15:47:22 +00:00
* Renders component.
2016-12-23 16:21:51 +00:00
*
* @returns {ReactElement}
*/
render() {
2017-01-25 22:11:44 +00:00
const ns = 'unsupported-mobile-browser';
const downloadButtonClassName = `${ns}__button ${ns}__button_primary`;
2016-12-23 16:21:51 +00:00
return (
2017-01-25 22:11:44 +00:00
<div className = { ns }>
<div className = { `${ns}__body` }>
2016-12-23 16:21:51 +00:00
<img
2017-01-25 22:11:44 +00:00
className = { `${ns}__logo` }
2016-12-23 16:21:51 +00:00
src = '/images/logo-blue.svg' />
2017-01-25 22:11:44 +00:00
<p className = { `${ns}__text` }>
You need <strong>Jitsi Meet</strong> to join a
conversation on your mobile
2016-12-23 16:21:51 +00:00
</p>
<a href = { URLS[Platform.OS] }>
<button className = { downloadButtonClassName }>
2016-12-23 16:21:51 +00:00
Download the App
</button>
</a>
2017-01-25 22:11:44 +00:00
<p className = { `${ns}__text ${ns}__text_small` }>
or if you already have it
<br />
<strong>then</strong>
2016-12-23 16:21:51 +00:00
</p>
2017-01-18 12:21:30 +00:00
<button
2017-01-25 22:11:44 +00:00
className = { `${ns}__button` }
onClick = { this._onJoinClick }>
2017-01-25 22:11:44 +00:00
{
this.state.joinButtonText
2017-01-25 22:11:44 +00:00
}
2017-01-18 12:21:30 +00:00
</button>
2016-12-23 16:21:51 +00:00
</div>
</div>
);
}
2017-01-25 22:11:44 +00:00
/**
* Handles clicks on the button that joins the local participant in a
* conference.
2017-01-25 22:11:44 +00:00
*
* @private
* @returns {void}
*/
_onJoinClick() {
// If the user installed the app while this Component was displayed
// (e.g. the user clicked the Download the App button), then we would
// like to open the current URL in the mobile app.
// TODO The only way to do it appears to be a link with an app-specific
// scheme, not a Universal Link.
2017-01-25 22:11:44 +00:00
}
2016-12-23 16:21:51 +00:00
}
2017-01-13 22:37:53 +00:00
/**
2017-01-25 22:11:44 +00:00
* Maps (parts of) the Redux state to the associated UnsupportedMobileBrowser's
* props.
2017-01-13 22:37:53 +00:00
*
* @param {Object} state - Redux state.
* @returns {{
* _room: string
2017-01-13 22:37:53 +00:00
* }}
*/
function mapStateToProps(state) {
return {
/**
* The name of the conference room to be joined upon clicking the
* respective button.
*
* @private
* @type {string}
*/
_room: state['features/base/conference'].room
};
2017-01-13 22:37:53 +00:00
}
2017-01-25 22:11:44 +00:00
export default connect(mapStateToProps)(UnsupportedMobileBrowser);