import React, { Component, PropTypes } from 'react';
import { FormattedMessage } from 'react-intl';
import LoadingScreen from '../loading-screen/component';
import KickedScreen from '../kicked-screen/component';
import NotificationsBarContainer from '../notifications-bar/container';
import AudioNotificationContainer from '../audio-notification/container';
import Button from '../button/component';
import styles from './styles';
import cx from 'classnames';
const propTypes = {
navbar: PropTypes.element,
sidebar: PropTypes.element,
sidebarRight: PropTypes.element,
media: PropTypes.element,
actionsbar: PropTypes.element,
captions: PropTypes.element,
modal: PropTypes.element,
};
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
compactUserList: false, //TODO: Change this on userlist resize (?)
};
}
renderNavBar() {
const { navbar } = this.props;
if (navbar) {
return (
);
}
return false;
}
renderSidebar() {
const { sidebar } = this.props;
if (sidebar) {
return (
);
}
return false;
}
renderUserList() {
let { userList } = this.props;
const { compactUserList } = this.state;
let userListStyle = {};
userListStyle[styles.compact] = compactUserList;
if (userList) {
userList = React.cloneElement(userList, {
compact: compactUserList,
});
return (
);
}
return false;
}
renderChat() {
const { chat } = this.props;
if (chat) {
return (
);
}
return false;
}
renderMedia() {
const { media } = this.props;
if (media) {
return (
);
}
return false;
}
renderClosedCaptions() {
const { captions } = this.props;
if(captions && this.props.getCaptionsStatus()) {
return (
);
}
}
renderActionsBar() {
const { actionsbar } = this.props;
if (actionsbar) {
return (
);
}
return false;
}
renderAudioElement() {
return (
);
}
renderModal() {
const { modal } = this.props;
if (modal) {
return (
{modal}
);
}
return false;
}
render() {
if (this.props.wasKicked) {
return (
);
}
if (this.props.isLoading) {
return ;
}
return (
{this.renderUserList()}
{this.renderChat()}
{this.renderNavBar()}
{this.renderMedia()}
{this.renderActionsBar()}
{this.renderSidebar()}
{this.renderClosedCaptions()}
{this.renderAudioElement()}
{this.renderModal()}
);
}
}
App.propTypes = propTypes;