Files
jitsi-meet/react/features/overlay/components/ReloadButton.js
Lyubo Marinov dfebd692f3 eslint 4.8.0
ESLint 4.8.0 discovers a lot of error related to formatting. While I
tried to fix as many of them as possible, a portion of them actually go
against our coding style. In such a case, I've disabled the indent rule
which effectively leaves it as it was before ESLint 4.8.0.

Additionally, remove jshint because it's becoming a nuisance with its
lack of understanding of ES2015+.
2017-10-02 18:12:38 -05:00

91 lines
2.0 KiB
JavaScript

/* @flow */
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { translate } from '../../base/i18n';
import { _reloadNow } from '../actions';
/**
* Implements a React Component for button for the overlays that will reload
* the page.
*/
class ReloadButton extends Component {
/**
* PageReloadOverlay component's property types.
*
* @static
*/
static propTypes = {
/**
* Reloads the page.
*
* @type {Function}
*/
_reloadNow: PropTypes.func,
/**
* The function to translate human-readable text.
*
* @public
* @type {Function}
*/
t: PropTypes.func,
/**
* The translation key for the text in the button.
*
* @type {string}
*/
textKey: PropTypes.string.isRequired
};
/**
* Renders the button for relaod the page if necessary.
*
* @private
* @returns {ReactElement}
*/
render() {
const className
= 'button-control button-control_overlay button-control_center';
/* eslint-disable react/jsx-handler-names */
return (
<button
className = { className }
onClick = { this.props._reloadNow }>
{ this.props.t(this.props.textKey) }
</button>
);
/* eslint-enable react/jsx-handler-names */
}
}
/**
* Maps part of redux actions to component's props.
*
* @param {Function} dispatch - Redux's {@code dispatch} function.
* @private
* @returns {Object}
*/
function _mapDispatchToProps(dispatch: Function): Object {
return {
/**
* Dispatches the redux action to reload the page.
*
* @protected
* @returns {Object} Dispatched action.
*/
_reloadNow() {
dispatch(_reloadNow());
}
};
}
export default translate(connect(undefined, _mapDispatchToProps)(ReloadButton));