2021-04-07 03:58:11 +08:00
|
|
|
import React, { useContext } from 'react';
|
2019-06-13 02:40:58 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2019-02-22 05:01:39 +08:00
|
|
|
import { injectIntl } from 'react-intl';
|
2024-01-20 02:40:27 +08:00
|
|
|
import { useSubscription, useMutation } from '@apollo/client';
|
2018-09-14 02:09:30 +08:00
|
|
|
import getFromUserSettings from '/imports/ui/services/users-settings';
|
2018-11-13 06:09:04 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2016-05-20 21:46:30 +08:00
|
|
|
import ActionsBar from './component';
|
2016-11-08 02:19:00 +08:00
|
|
|
import Service from './service';
|
2019-05-17 04:11:10 +08:00
|
|
|
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';
|
2023-03-28 05:40:08 +08:00
|
|
|
import { isScreenBroadcasting, isCameraAsContentBroadcasting } from '/imports/ui/components/screenshare/service';
|
2023-09-19 19:39:52 +08:00
|
|
|
import { PluginsContext } from '/imports/ui/components/components-data/plugin-context/context';
|
2023-10-12 03:10:36 +08:00
|
|
|
import {
|
|
|
|
CURRENT_PRESENTATION_PAGE_SUBSCRIPTION,
|
|
|
|
} from '/imports/ui/components/whiteboard/queries';
|
2022-02-10 03:45:43 +08:00
|
|
|
import MediaService from '../media/service';
|
2023-11-29 21:22:59 +08:00
|
|
|
import useMeeting from '/imports/ui/core/hooks/useMeeting';
|
2023-11-30 19:08:16 +08:00
|
|
|
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
2024-01-20 02:40:27 +08:00
|
|
|
import { EXTERNAL_VIDEO_STOP } from '../external-video-player/mutations';
|
2018-12-15 04:16:15 +08:00
|
|
|
|
2021-04-07 03:58:11 +08:00
|
|
|
const ActionsBarContainer = (props) => {
|
2021-09-11 04:48:52 +08:00
|
|
|
const actionsBarStyle = layoutSelectOutput((i) => i.actionBar);
|
|
|
|
const layoutContextDispatch = layoutDispatch();
|
2021-09-10 04:49:15 +08:00
|
|
|
|
2023-10-12 03:10:36 +08:00
|
|
|
const { data: presentationPageData } = useSubscription(CURRENT_PRESENTATION_PAGE_SUBSCRIPTION);
|
|
|
|
const presentationPage = presentationPageData?.pres_page_curr[0] || {};
|
|
|
|
const isThereCurrentPresentation = !!presentationPage?.presentationId;
|
|
|
|
|
2023-11-29 21:22:59 +08:00
|
|
|
const { data: currentMeeting } = useMeeting((m) => ({
|
|
|
|
externalVideo: m.externalVideo,
|
|
|
|
}));
|
|
|
|
|
|
|
|
const isSharingVideo = !!currentMeeting?.externalVideo?.externalVideoUrl;
|
|
|
|
|
2023-09-19 19:39:52 +08:00
|
|
|
const {
|
2023-11-29 02:31:28 +08:00
|
|
|
pluginsExtensibleAreasAggregatedState,
|
2023-09-19 19:39:52 +08:00
|
|
|
} = useContext(PluginsContext);
|
|
|
|
let actionBarItems = [];
|
2023-11-29 02:31:28 +08:00
|
|
|
if (pluginsExtensibleAreasAggregatedState.actionsBarItems) {
|
2023-09-19 19:39:52 +08:00
|
|
|
actionBarItems = [
|
2023-11-29 02:31:28 +08:00
|
|
|
...pluginsExtensibleAreasAggregatedState.actionsBarItems,
|
2023-09-19 19:39:52 +08:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2023-11-30 19:08:16 +08:00
|
|
|
const { data: currentUserData } = useCurrentUser((user) => ({
|
|
|
|
presenter: user.presenter,
|
|
|
|
emoji: user.emoji,
|
2023-11-30 21:24:25 +08:00
|
|
|
isModerator: user.isModerator,
|
2023-11-30 19:08:16 +08:00
|
|
|
}));
|
2024-01-20 02:40:27 +08:00
|
|
|
|
|
|
|
const [stopExternalVideoShare] = useMutation(EXTERNAL_VIDEO_STOP);
|
2023-11-30 19:08:16 +08:00
|
|
|
const currentUser = { userId: Auth.userID, emoji: currentUserData?.emoji };
|
|
|
|
const amIPresenter = currentUserData?.presenter;
|
2023-11-30 21:24:25 +08:00
|
|
|
const amIModerator = currentUserData?.isModerator;
|
2021-11-24 00:04:45 +08:00
|
|
|
|
2022-07-30 03:02:31 +08:00
|
|
|
if (actionsBarStyle.display === false) return null;
|
|
|
|
|
2021-04-07 03:58:11 +08:00
|
|
|
return (
|
|
|
|
<ActionsBar {
|
|
|
|
...{
|
|
|
|
...props,
|
|
|
|
currentUser,
|
2023-11-30 21:24:25 +08:00
|
|
|
amIModerator,
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch,
|
2021-07-22 22:04:38 +08:00
|
|
|
actionsBarStyle,
|
2021-11-24 00:04:45 +08:00
|
|
|
amIPresenter,
|
2023-09-19 19:39:52 +08:00
|
|
|
actionBarItems,
|
2023-10-12 03:10:36 +08:00
|
|
|
isThereCurrentPresentation,
|
2023-11-29 21:22:59 +08:00
|
|
|
isSharingVideo,
|
2024-01-20 02:40:27 +08:00
|
|
|
stopExternalVideoShare,
|
2021-04-07 03:58:11 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-03-20 02:52:03 +08:00
|
|
|
const SELECT_RANDOM_USER_ENABLED = Meteor.settings.public.selectRandomUser.enabled;
|
2021-05-19 00:34:42 +08:00
|
|
|
const RAISE_HAND_BUTTON_ENABLED = Meteor.settings.public.app.raiseHandActionButton.enabled;
|
2023-04-29 01:10:27 +08:00
|
|
|
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 = () => {
|
2023-08-10 20:02:08 +08:00
|
|
|
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;
|
2023-08-10 20:02:08 +08:00
|
|
|
|
|
|
|
return USER_REACTIONS_ENABLED && REACTIONS_BUTTON_ENABLED;
|
2021-10-14 22:11:37 +08:00
|
|
|
};
|
2016-04-29 03:02:51 +08:00
|
|
|
|
2019-09-05 02:32:58 +08:00
|
|
|
export default withTracker(() => ({
|
2019-11-06 00:59:00 +08:00
|
|
|
enableVideo: getFromUserSettings('bbb_enable_video', Meteor.settings.public.kurento.enableVideo),
|
2022-02-11 22:30:35 +08:00
|
|
|
setPresentationIsOpen: MediaService.setPresentationIsOpen,
|
2023-02-17 23:44:36 +08:00
|
|
|
isSharedNotesPinned: Service.isSharedNotesPinned(),
|
2023-03-28 05:40:08 +08:00
|
|
|
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,
|
2021-05-19 00:34:42 +08:00
|
|
|
isRaiseHandButtonEnabled: RAISE_HAND_BUTTON_ENABLED,
|
2023-04-29 01:10:27 +08:00
|
|
|
isRaiseHandButtonCentered: RAISE_HAND_BUTTON_CENTERED,
|
2023-07-18 19:54:36 +08:00
|
|
|
isReactionsButtonEnabled: isReactionsButtonEnabled(),
|
2022-03-09 21:33:18 +08:00
|
|
|
allowExternalVideo: isExternalVideoEnabled(),
|
2019-09-05 02:32:58 +08:00
|
|
|
}))(injectIntl(ActionsBarContainer));
|