bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx

73 lines
3.2 KiB
React
Raw Normal View History

import React, { useContext } from 'react';
import { Meteor } from 'meteor/meteor';
import { withTracker } from 'meteor/react-meteor-data';
2019-02-22 05:01:39 +08:00
import { injectIntl } from 'react-intl';
import getFromUserSettings from '/imports/ui/services/users-settings';
2018-11-13 06:09:04 +08:00
import Auth from '/imports/ui/services/auth';
2019-02-22 05:01:39 +08:00
import PresentationService from '/imports/ui/components/presentation/service';
import Presentations from '/imports/api/presentations';
import { UsersContext } from '../components-data/users-context/context';
import ActionsBar from './component';
import Service from './service';
import UserListService from '/imports/ui/components/user-list/service';
import ExternalVideoService from '/imports/ui/components/external-video-player/service';
import CaptionsService from '/imports/ui/components/captions/service';
2021-08-05 19:03:24 +08:00
import LayoutContext from '../layout/context';
import { isVideoBroadcasting } from '/imports/ui/components/screenshare/service';
2017-05-02 03:52:57 +08:00
import MediaService, {
getSwapLayout,
shouldEnableSwapLayout,
} from '../media/service';
const ActionsBarContainer = (props) => {
const usingUsersContext = useContext(UsersContext);
const { users } = usingUsersContext;
2021-08-05 19:03:24 +08:00
const layoutContext = useContext(LayoutContext);
const { layoutContextState, layoutContextDispatch } = layoutContext;
const { output } = layoutContextState;
const { actionBar: actionsBarStyle } = output;
2021-04-20 03:27:35 +08:00
const currentUser = { userId: Auth.userID, emoji: users[Auth.meetingID][Auth.userID].emoji };
return (
<ActionsBar {
...{
...props,
currentUser,
2021-08-05 19:03:24 +08:00
layoutContextDispatch,
actionsBarStyle,
}
}
/>
);
};
2019-09-05 02:32:58 +08:00
const POLLING_ENABLED = Meteor.settings.public.poll.enabled;
const PRESENTATION_DISABLED = Meteor.settings.public.layout.hidePresentation;
2021-03-20 02:52:03 +08:00
const SELECT_RANDOM_USER_ENABLED = Meteor.settings.public.selectRandomUser.enabled;
const RAISE_HAND_BUTTON_ENABLED = Meteor.settings.public.app.raiseHandActionButton.enabled;
2016-04-29 03:02:51 +08:00
2019-09-05 02:32:58 +08:00
export default withTracker(() => ({
amIPresenter: Service.amIPresenter(),
amIModerator: Service.amIModerator(),
2019-09-05 02:32:58 +08:00
stopExternalVideoShare: ExternalVideoService.stopWatching,
enableVideo: getFromUserSettings('bbb_enable_video', Meteor.settings.public.kurento.enableVideo),
2019-09-05 02:32:58 +08:00
isLayoutSwapped: getSwapLayout() && shouldEnableSwapLayout(),
toggleSwapLayout: MediaService.toggleSwapLayout,
handleTakePresenter: Service.takePresenterRole,
currentSlidHasContent: PresentationService.currentSlidHasContent(),
parseCurrentSlideContent: PresentationService.parseCurrentSlideContent,
isSharingVideo: Service.isSharingVideo(),
isCaptionsAvailable: CaptionsService.isCaptionsAvailable(),
isMeteorConnected: Meteor.status().connected,
isPollingEnabled: POLLING_ENABLED,
isPresentationDisabled: PRESENTATION_DISABLED,
2021-03-20 02:52:03 +08:00
isSelectRandomUserEnabled: SELECT_RANDOM_USER_ENABLED,
isRaiseHandButtonEnabled: RAISE_HAND_BUTTON_ENABLED,
2019-09-05 02:32:58 +08:00
isThereCurrentPresentation: Presentations.findOne({ meetingId: Auth.meetingID, current: true },
{ fields: {} }) || ExternalVideoService.getVideoUrl() || isVideoBroadcasting(),
allowExternalVideo: Meteor.settings.public.externalVideoPlayer.enabled,
setEmojiStatus: UserListService.setEmojiStatus,
2019-09-05 02:32:58 +08:00
}))(injectIntl(ActionsBarContainer));