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

86 lines
3.8 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';
2023-05-11 04:03:20 +08:00
import TimerService from '/imports/ui/components/timer/service';
2021-09-11 04:48:52 +08:00
import { layoutSelectOutput, layoutDispatch } from '../layout/context';
2023-02-24 23:52:01 +08:00
import { isExternalVideoEnabled, isPollingEnabled, isPresentationEnabled } from '/imports/ui/services/features';
import { isScreenBroadcasting, isCameraAsContentBroadcasting } from '/imports/ui/components/screenshare/service';
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;
const RAISE_HAND_BUTTON_CENTERED = Meteor.settings.public.app.raiseHandActionButton.centered;
2016-04-29 03:02:51 +08:00
2023-07-18 19:54:36 +08:00
const isReactionsButtonEnabled = () => {
const USER_REACTIONS_ENABLED = Meteor.settings.public.userReaction.enabled;
2023-07-18 19:54:36 +08:00
const REACTIONS_BUTTON_ENABLED = Meteor.settings.public.app.reactionsButton.enabled;
return USER_REACTIONS_ENABLED && REACTIONS_BUTTON_ENABLED;
};
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),
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: isScreenBroadcasting(),
hasCameraAsContent: isCameraAsContentBroadcasting(),
2019-09-05 02:32:58 +08:00
isCaptionsAvailable: CaptionsService.isCaptionsAvailable(),
2023-05-11 04:03:20 +08:00
isTimerActive: TimerService.isActive(),
isTimerEnabled: TimerService.isEnabled(),
2019-09-05 02:32:58 +08:00
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,
isRaiseHandButtonCentered: RAISE_HAND_BUTTON_CENTERED,
2023-07-18 19:54:36 +08:00
isReactionsButtonEnabled: isReactionsButtonEnabled(),
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));