/* eslint-disable lines-around-comment */ import { withStyles } from '@material-ui/styles'; import React, { Component } from 'react'; import { WithTranslation } from 'react-i18next'; import { batch, connect } from 'react-redux'; // @ts-ignore import ContextMenu from '../../../base/components/context-menu/ContextMenu'; // @ts-ignore import ContextMenuItemGroup from '../../../base/components/context-menu/ContextMenuItemGroup'; import { isMobileBrowser } from '../../../base/environment/utils'; // @ts-ignore import { translate } from '../../../base/i18n'; import { IconHorizontalPoints } from '../../../base/icons/svg/index'; import { getLocalParticipant } from '../../../base/participants/functions'; // @ts-ignore import { Popover } from '../../../base/popover'; // @ts-ignore import { setParticipantContextMenuOpen } from '../../../base/responsive-ui/actions'; // @ts-ignore import { getHideSelfView } from '../../../base/settings'; // @ts-ignore import { getLocalVideoTrack } from '../../../base/tracks'; import Button from '../../../base/ui/components/web/Button'; // @ts-ignore import ConnectionIndicatorContent from '../../../connection-indicator/components/web/ConnectionIndicatorContent'; // @ts-ignore import { THUMBNAIL_TYPE } from '../../../filmstrip'; // @ts-ignore import { isStageFilmstripAvailable } from '../../../filmstrip/functions.web'; // @ts-ignore import { renderConnectionStatus } from '../../actions.web'; // @ts-ignore import ConnectionStatusButton from './ConnectionStatusButton'; // @ts-ignore import FlipLocalVideoButton from './FlipLocalVideoButton'; // @ts-ignore import HideSelfViewVideoButton from './HideSelfViewVideoButton'; // @ts-ignore import TogglePinToStageButton from './TogglePinToStageButton'; /** * The type of the React {@code Component} props of * {@link LocalVideoMenuTriggerButton}. */ interface Props extends WithTranslation { /** * The id of the local participant. */ _localParticipantId: string, /** * The position relative to the trigger the local video menu should display * from. Valid values are those supported by AtlasKit * {@code InlineDialog}. */ _menuPosition: string, /** * Whether to display the Popover as a drawer. */ _overflowDrawer: boolean, /** * Whether to render the connection info pane. */ _showConnectionInfo: boolean, /** * Whether to render the hide self view button. */ _showHideSelfViewButton: boolean, /** * Shows/hides the local video flip button. */ _showLocalVideoFlipButton: boolean, /** * Whether to render the pin to stage button. */ _showPinToStage: boolean, /** * Whether or not the button should be visible. */ buttonVisible: boolean, /** * An object containing the CSS classes. */ classes: any, /** * The redux dispatch function. */ dispatch: Function, /** * Hides popover. */ hidePopover: Function, /** * Whether the popover is visible or not. */ popoverVisible: boolean, /** * Shows popover. */ showPopover: Function /** * The type of the thumbnail. */ thumbnailType: string } const styles = () => { return { triggerButton: { padding: '3px !important', borderRadius: '4px' }, contextMenu: { position: 'relative', marginTop: 0, right: 'auto', padding: '0', minWidth: '200px' }, flipText: { marginLeft: '36px' } }; }; /** * React Component for displaying an icon associated with opening the * the video menu for the local participant. * * @augments {Component} */ class LocalVideoMenuTriggerButton extends Component { /** * Initializes a new LocalVideoMenuTriggerButton instance. * * @param {Object} props - The read-only React Component props with which * the new instance is to be initialized. */ constructor(props: Props) { super(props); this._onPopoverClose = this._onPopoverClose.bind(this); this._onPopoverOpen = this._onPopoverOpen.bind(this); } /** * Implements React's {@link Component#render()}. * * @inheritdoc * @returns {ReactElement} */ render() { const { _localParticipantId, _menuPosition, _overflowDrawer, _showConnectionInfo, _showHideSelfViewButton, _showLocalVideoFlipButton, _showPinToStage, buttonVisible, classes, hidePopover, popoverVisible, t } = this.props; const content = _showConnectionInfo ? : ( ); return ( isMobileBrowser() || _showLocalVideoFlipButton || _showHideSelfViewButton ? {!_overflowDrawer && buttonVisible && !isMobileBrowser() && (