2017-01-31 20:58:48 +00:00
|
|
|
/* global $, APP */
|
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
|
|
|
/**
|
2017-02-19 00:42:11 +00:00
|
|
|
* Implements an abstract React Component for overlay - the components which are
|
|
|
|
* displayed on top of the application covering the whole screen.
|
2017-01-31 20:58:48 +00:00
|
|
|
*
|
|
|
|
* @abstract
|
|
|
|
*/
|
|
|
|
export default class AbstractOverlay extends Component {
|
|
|
|
/**
|
|
|
|
* Initializes a new AbstractOverlay instance.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The read-only properties with which the new
|
|
|
|
* instance is to be initialized.
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
/**
|
2017-02-19 00:42:11 +00:00
|
|
|
* Indicates the CSS style of the overlay. If true, then ighter;
|
|
|
|
* darker, otherwise.
|
|
|
|
*
|
2017-01-31 20:58:48 +00:00
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
isLightOverlay: false
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method is executed when comonent is mounted.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
componentDidMount() {
|
|
|
|
// XXX Temporary solution until we add React translation.
|
|
|
|
APP.translation.translateElement($('#overlay'));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement|null}
|
|
|
|
*/
|
|
|
|
render() {
|
2017-02-19 00:42:11 +00:00
|
|
|
const containerClass
|
|
|
|
= this.state.isLightOverlay
|
|
|
|
? 'overlay__container-light'
|
|
|
|
: 'overlay__container';
|
2017-01-31 20:58:48 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className = { containerClass }
|
|
|
|
id = 'overlay'>
|
|
|
|
<div className = 'overlay__content'>
|
2017-02-19 00:42:11 +00:00
|
|
|
{
|
|
|
|
this._renderOverlayContent()
|
|
|
|
}
|
2017-01-31 20:58:48 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-02-19 00:42:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Reloads the page.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
* @protected
|
|
|
|
*/
|
|
|
|
_reconnectNow() {
|
|
|
|
// FIXME: In future we should dispatch an action here that will result
|
|
|
|
// in reload.
|
|
|
|
APP.ConferenceUrl.reload();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract method which should be used by subclasses to provide the overlay
|
|
|
|
* content.
|
|
|
|
*
|
|
|
|
* @returns {ReactElement|null}
|
|
|
|
* @protected
|
|
|
|
*/
|
|
|
|
_renderOverlayContent() {
|
|
|
|
return null;
|
|
|
|
}
|
2017-01-31 20:58:48 +00:00
|
|
|
}
|