bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/audio/container.jsx
Oleksandr Zhurbenko 251bd22738 PR review fixes
2017-09-06 12:36:52 -07:00

42 lines
1.0 KiB
JavaScript

import React from 'react';
import { createContainer } from 'meteor/react-meteor-data';
import { withModalMounter } from '/imports/ui/components/modal/service';
import PropTypes from 'prop-types';
import Service from './service';
import Audio from './component';
import AudioModal from './audio-modal/component';
const propTypes = {
children: PropTypes.element,
};
const defaultProps = {
children: null,
};
const AudioContainer = props =>
(<Audio {...props}>
{props.children}
</Audio>
);
let didMountAutoJoin = false;
export default withModalMounter(createContainer(({ mountModal }) => {
const APP_CONFIG = Meteor.settings.public.app;
const { autoJoinAudio } = APP_CONFIG;
return {
init: () => {
Service.init();
if (!autoJoinAudio || didMountAutoJoin) return;
mountModal(<AudioModal handleJoinListenOnly={Service.joinListenOnly} />);
didMountAutoJoin = true;
},
};
}, AudioContainer));
AudioContainer.propTypes = propTypes;
AudioContainer.defaultProps = defaultProps;