bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/audio/container.jsx

42 lines
1.0 KiB
React
Raw Normal View History

2017-08-04 20:24:57 +08:00
import React from 'react';
2017-03-28 04:40:44 +08:00
import { createContainer } from 'meteor/react-meteor-data';
2017-05-02 03:52:57 +08:00
import { withModalMounter } from '/imports/ui/components/modal/service';
2017-08-04 20:24:57 +08:00
import PropTypes from 'prop-types';
2017-05-02 03:52:57 +08:00
import Service from './service';
2017-03-28 04:40:44 +08:00
import Audio from './component';
2017-05-02 03:52:57 +08:00
import AudioModal from './audio-modal/component';
2017-03-28 04:40:44 +08:00
2017-08-04 20:24:57 +08:00
const propTypes = {
children: PropTypes.element,
};
const defaultProps = {
children: null,
};
2017-03-28 04:40:44 +08:00
2017-08-04 20:24:57 +08:00
const AudioContainer = props =>
(<Audio {...props}>
{props.children}
</Audio>
);
2017-08-15 03:19:35 +08:00
let didMountAutoJoin = false;
2017-05-02 03:52:57 +08:00
export default withModalMounter(createContainer(({ mountModal }) => {
2017-04-20 04:42:48 +08:00
const APP_CONFIG = Meteor.settings.public.app;
2017-03-28 04:40:44 +08:00
2017-08-04 20:24:57 +08:00
const { autoJoinAudio } = APP_CONFIG;
2017-03-28 04:40:44 +08:00
return {
2017-05-02 03:52:57 +08:00
init: () => {
Service.init();
2017-08-15 03:19:35 +08:00
if (!autoJoinAudio || didMountAutoJoin) return;
mountModal(<AudioModal handleJoinListenOnly={Service.joinListenOnly} />);
2017-08-15 03:19:35 +08:00
didMountAutoJoin = true;
2017-05-02 03:52:57 +08:00
},
2017-03-28 04:40:44 +08:00
};
2017-05-02 03:52:57 +08:00
}, AudioContainer));
2017-08-04 20:24:57 +08:00
AudioContainer.propTypes = propTypes;
AudioContainer.defaultProps = defaultProps;