bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/breakout-join-confirmation/container.jsx

52 lines
1.7 KiB
React
Raw Normal View History

2021-11-24 00:41:37 +08:00
import React, { useContext } from 'react';
2018-07-07 01:38:14 +08:00
import { withTracker } from 'meteor/react-meteor-data';
import Breakouts from '/imports/api/breakouts';
2018-07-07 01:38:14 +08:00
import Auth from '/imports/ui/services/auth';
import { makeCall } from '/imports/ui/services/api';
import breakoutService from '/imports/ui/components/breakout-room/service';
2019-07-26 22:35:20 +08:00
import AudioManager from '/imports/ui/services/audio-manager';
2018-07-07 01:38:14 +08:00
import BreakoutJoinConfirmationComponent from './component';
2021-11-24 00:41:37 +08:00
import { UsersContext } from '/imports/ui/components/components-data/users-context/context';
2018-07-07 01:38:14 +08:00
2021-11-24 00:41:37 +08:00
const BreakoutJoinConfirmationContrainer = (props) => {
const usingUsersContext = useContext(UsersContext);
const { users } = usingUsersContext;
const amIPresenter = users[Auth.meetingID][Auth.userID].presenter;
return <BreakoutJoinConfirmationComponent
{...props}
2021-11-24 00:41:37 +08:00
amIPresenter={amIPresenter}
/>
2021-11-24 00:41:37 +08:00
};
2018-07-07 01:38:14 +08:00
const getURL = (breakoutId) => {
const currentUserId = Auth.userID;
const breakout = Breakouts.findOne({ breakoutId }, { fields: { [`url_${currentUserId}`]: 1 } });
const breakoutUrlData = (breakout && breakout[`url_${currentUserId}`]) ? breakout[`url_${currentUserId}`] : null;
if (breakoutUrlData) return breakoutUrlData.redirectToHtml5JoinURL;
2018-07-07 01:38:14 +08:00
return '';
};
const requestJoinURL = (breakoutId) => {
makeCall('requestJoinURL', {
breakoutId,
});
};
export default withTracker(({ breakout, mountModal, breakoutName }) => {
const isFreeJoin = breakout.freeJoin;
const { breakoutId } = breakout;
const url = getURL(breakoutId);
return {
isFreeJoin,
mountModal,
breakoutName,
breakoutURL: url,
breakouts: breakoutService.getBreakouts(),
2018-07-07 01:38:14 +08:00
requestJoinURL,
getURL,
2019-07-26 22:35:20 +08:00
voiceUserJoined: AudioManager.isUsingAudio(),
2018-07-07 01:38:14 +08:00
};
})(BreakoutJoinConfirmationContrainer);