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

78 lines
3.4 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';
2023-02-24 23:52:01 +08:00
import { isExternalVideoEnabled, isPollingEnabled, isPresentationEnabled } from '/imports/ui/services/features';
2017-05-02 03:52:57 +08:00
import MediaService 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;
if (actionsBarStyle.display === false) return null;
return (
<ActionsBar {
...{
...props,
currentUser,
2021-08-05 19:03:24 +08:00
layoutContextDispatch,
actionsBarStyle,
2021-11-24 00:04:45 +08:00
amIPresenter,
}
}
/>
);
};
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
2022-01-07 02:24:21 +08:00
const isInteractionsButtonEnabled = () => {
const INTERACTIONS_BUTTON_ENABLED = Meteor.settings.public.app.interactionsButton.enabled;
2022-01-07 02:24:21 +08:00
return getFromMeetingSettingsAsBoolean('enable-interactions-button', INTERACTIONS_BUTTON_ENABLED);
};
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),
setPresentationIsOpen: MediaService.setPresentationIsOpen,
2019-09-05 02:32:58 +08:00
handleTakePresenter: Service.takePresenterRole,
currentSlidHasContent: PresentationService.currentSlidHasContent(),
parseCurrentSlideContent: PresentationService.parseCurrentSlideContent,
isSharingVideo: Service.isSharingVideo(),
isSharedNotesPinned: Service.isSharedNotesPinned(),
hasScreenshare: isVideoBroadcasting(),
2019-09-05 02:32:58 +08:00
isCaptionsAvailable: CaptionsService.isCaptionsAvailable(),
isMeteorConnected: Meteor.status().connected,
2023-02-24 23:52:01 +08:00
isPollingEnabled: isPollingEnabled() && isPresentationEnabled(),
2021-03-20 02:52:03 +08:00
isSelectRandomUserEnabled: SELECT_RANDOM_USER_ENABLED,
isRaiseHandButtonEnabled: RAISE_HAND_BUTTON_ENABLED,
2022-01-07 02:24:21 +08:00
isInteractionsButtonEnabled: isInteractionsButtonEnabled(),
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));