bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/app/component.jsx

144 lines
2.5 KiB
React
Raw Normal View History

2016-04-29 03:02:51 +08:00
import React, { Component, PropTypes } from 'react';
import Loader from '../loader/component';
2016-05-03 06:42:54 +08:00
import styles from './styles';
2016-04-29 03:02:51 +08:00
const propTypes = {
navbar: PropTypes.element,
sidebar: PropTypes.element,
sidebarRight: PropTypes.element,
media: PropTypes.element,
actionsbar: PropTypes.element,
2016-05-07 01:46:14 +08:00
settings: PropTypes.element,
2016-04-29 03:02:51 +08:00
};
export default class App extends Component {
renderNavBar() {
2016-04-29 03:02:51 +08:00
const { navbar } = this.props;
2016-05-03 06:42:54 +08:00
if (navbar) {
2016-04-29 03:02:51 +08:00
return (
2016-05-03 06:42:54 +08:00
<header className={styles.navbar}>
2016-04-29 03:02:51 +08:00
{navbar}
</header>
);
}
return false;
}
renderSidebar() {
const { sidebar } = this.props;
2016-04-29 03:02:51 +08:00
2016-05-03 06:42:54 +08:00
if (sidebar) {
2016-04-29 03:02:51 +08:00
return (
<aside className={styles.sidebar}>
2016-04-29 03:02:51 +08:00
{sidebar}
</aside>
);
}
return false;
}
renderUserList() {
const { userList } = this.props;
if (userList) {
return (
<nav className={styles.userList}>
{userList}
</nav>
);
}
return false;
}
renderChat() {
const { chat } = this.props;
if (chat) {
return (
<section className={styles.chat} role="log">
{chat}
</section>
);
}
return false;
}
2016-04-29 03:02:51 +08:00
renderMedia() {
const { media } = this.props;
2016-05-03 06:42:54 +08:00
if (media) {
2016-04-29 03:02:51 +08:00
return (
2016-05-03 06:42:54 +08:00
<section className={styles.media}>
2016-04-29 03:02:51 +08:00
{media}
</section>
);
}
return false;
}
renderActionsBar() {
2016-04-29 03:02:51 +08:00
const { actionsbar } = this.props;
2016-05-03 06:42:54 +08:00
if (actionsbar) {
2016-04-29 03:02:51 +08:00
return (
2016-05-03 06:42:54 +08:00
<section className={styles.actionsbar}>
2016-04-29 03:02:51 +08:00
{actionsbar}
</section>
);
}
return false;
}
2016-05-07 01:46:14 +08:00
renderSettings() {
const { settings } = this.props;
if (settings) {
return (
<section>
{settings}
</section>
);
}
return false;
}
2016-05-12 04:43:07 +08:00
renderAudioElement() {
return (
<audio id="remote-media" autoPlay="autoplay"></audio>
2016-05-12 04:43:07 +08:00
);
}
2016-04-29 03:02:51 +08:00
render() {
if(this.props.isLoading) {
return <Loader/>;
}
2016-04-29 03:02:51 +08:00
return (
2016-05-03 06:42:54 +08:00
<main className={styles.main}>
<section className={styles.wrapper}>
{this.renderUserList()}
{this.renderChat()}
2016-05-03 06:42:54 +08:00
<div className={styles.content}>
{this.renderNavBar()}
2016-04-29 03:02:51 +08:00
{this.renderMedia()}
{this.renderActionsBar()}
2016-04-29 03:02:51 +08:00
</div>
{this.renderSidebar()}
2016-04-29 03:02:51 +08:00
</section>
2016-05-07 01:46:14 +08:00
{this.renderSettings()}
2016-05-12 04:43:07 +08:00
{this.renderAudioElement()}
2016-04-29 03:02:51 +08:00
</main>
);
}
}
App.propTypes = propTypes;