bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/nav-bar/options-dropdown/container.jsx

58 lines
2.3 KiB
React
Raw Normal View History

2019-03-12 00:21:12 +08:00
import React from 'react';
import { useContext } from 'react';
2019-03-12 00:21:12 +08:00
import { withTracker } from 'meteor/react-meteor-data';
import deviceInfo from '/imports/utils/deviceInfo';
import browserInfo from '/imports/utils/browserInfo';
import OptionsDropdown from './component';
import audioCaptionsService from '/imports/ui/components/audio/captions/service';
import FullscreenService from '/imports/ui/components/common/fullscreen-button/service';
2019-08-30 00:32:29 +08:00
import { meetingIsBreakout } from '/imports/ui/components/app/service';
2022-05-13 21:42:19 +08:00
import { layoutSelectInput, layoutSelect } from '../../layout/context';
import { SMALL_VIEWPORT_BREAKPOINT } from '../../layout/enums';
import { PluginsContext } from '/imports/ui/components/components-data/plugin-context/context';
2023-12-08 03:40:32 +08:00
import { USER_LEAVE_MEETING } from '/imports/ui/core/graphql/mutations/userMutations';
import { useMutation } from '@apollo/client';
const { isIphone } = deviceInfo;
const { isSafari, isValidSafariVersion } = browserInfo;
const noIOSFullscreen = !!(((isSafari && !isValidSafariVersion) || isIphone));
2019-09-05 02:32:58 +08:00
const OptionsDropdownContainer = (props) => {
const { width: browserWidth } = layoutSelectInput((i) => i.browser);
const isMobile = browserWidth <= SMALL_VIEWPORT_BREAKPOINT;
2022-05-13 21:42:19 +08:00
const isRTL = layoutSelect((i) => i.isRTL);
const { pluginsExtensibleAreasAggregatedState } = useContext(PluginsContext);
let optionsDropdownItems = [];
if (pluginsExtensibleAreasAggregatedState.optionsDropdownItems) {
optionsDropdownItems = [
...pluginsExtensibleAreasAggregatedState.optionsDropdownItems,
];
}
2023-12-08 03:40:32 +08:00
const [userLeaveMeeting] = useMutation(USER_LEAVE_MEETING);
return (
<OptionsDropdown {...{
2023-12-08 03:40:32 +08:00
isMobile, isRTL, optionsDropdownItems, userLeaveMeeting, ...props,
}}
/>
);
};
2019-03-12 00:21:12 +08:00
export default withTracker((props) => {
2019-07-27 00:48:51 +08:00
const handleToggleFullscreen = () => FullscreenService.toggleFullScreen();
2019-03-12 00:21:12 +08:00
return {
amIModerator: props.amIModerator,
audioCaptionsEnabled: audioCaptionsService.hasAudioCaptions(),
audioCaptionsActive: audioCaptionsService.getAudioCaptions(),
audioCaptionsSet: (value) => audioCaptionsService.setAudioCaptions(value),
isMobile: deviceInfo.isMobile,
2019-03-12 00:21:12 +08:00
handleToggleFullscreen,
noIOSFullscreen,
2019-06-27 00:29:34 +08:00
isMeteorConnected: Meteor.status().connected,
2019-08-30 00:32:29 +08:00
isBreakoutRoom: meetingIsBreakout(),
isDropdownOpen: Session.get('dropdownOpen'),
2019-03-12 00:21:12 +08:00
};
})(OptionsDropdownContainer);