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

77 lines
3.3 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-09-11 04:48:52 +08:00
import { layoutSelectOutput, layoutDispatch } from '../layout/context';
import { isVideoBroadcasting } from '/imports/ui/components/screenshare/service';
import { isExternalVideoEnabled, isPollingEnabled } from '/imports/ui/services/features';
2017-05-02 03:52:57 +08:00
import MediaService, {
getSwapLayout,
shouldEnableSwapLayout,
} from '../media/service';
const ActionsBarContainer = (props) => {
2021-09-11 04:48:52 +08:00
const actionsBarStyle = layoutSelectOutput((i) => i.actionBar);
const layoutContextDispatch = layoutDispatch();
const usingUsersContext = useContext(UsersContext);
const { users } = usingUsersContext;
2021-04-20 03:27:35 +08:00
const currentUser = { userId: Auth.userID, emoji: users[Auth.meetingID][Auth.userID].emoji };
2021-11-24 00:04:45 +08:00
const amIPresenter = users[Auth.meetingID][Auth.userID].presenter;
return (
<ActionsBar {
...{
...props,
currentUser,
2021-08-05 19:03:24 +08:00
layoutContextDispatch,
actionsBarStyle,
2021-11-24 00:04:45 +08:00
amIPresenter,
}
}
/>
);
};
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;
const OLD_MINIMIZE_BUTTON_ENABLED = Meteor.settings.public.presentation.oldMinimizeButton;
2016-04-29 03:02:51 +08:00
2019-09-05 02:32:58 +08:00
export default withTracker(() => ({
amIModerator: Service.amIModerator(),
2019-09-05 02:32:58 +08:00
stopExternalVideoShare: ExternalVideoService.stopWatching,
enableVideo: getFromUserSettings('bbb_enable_video', Meteor.settings.public.kurento.enableVideo),
2021-11-24 00:04:45 +08:00
isLayoutSwapped: getSwapLayout() && shouldEnableSwapLayout(),
2019-09-05 02:32:58 +08:00
toggleSwapLayout: MediaService.toggleSwapLayout,
handleTakePresenter: Service.takePresenterRole,
currentSlidHasContent: PresentationService.currentSlidHasContent(),
parseCurrentSlideContent: PresentationService.parseCurrentSlideContent,
isSharingVideo: Service.isSharingVideo(),
hasScreenshare: isVideoBroadcasting(),
2019-09-05 02:32:58 +08:00
isCaptionsAvailable: CaptionsService.isCaptionsAvailable(),
isMeteorConnected: Meteor.status().connected,
2022-03-09 02:05:24 +08:00
isPollingEnabled: isPollingEnabled(),
isPresentationDisabled: PRESENTATION_DISABLED,
2021-03-20 02:52:03 +08:00
isSelectRandomUserEnabled: SELECT_RANDOM_USER_ENABLED,
isRaiseHandButtonEnabled: RAISE_HAND_BUTTON_ENABLED,
isOldMinimizeButtonEnabled: OLD_MINIMIZE_BUTTON_ENABLED,
2019-09-05 02:32:58 +08:00
isThereCurrentPresentation: Presentations.findOne({ meetingId: Auth.meetingID, current: true },
{ fields: {} }),
allowExternalVideo: isExternalVideoEnabled(),
setEmojiStatus: UserListService.setEmojiStatus,
2019-09-05 02:32:58 +08:00
}))(injectIntl(ActionsBarContainer));