/* eslint-disable lines-around-comment */ import React, { PureComponent } from 'react'; import { Text, View } from 'react-native'; // @ts-ignore import { Avatar } from '../../../base/avatar'; // @ts-ignore import { BottomSheet, hideSheet } from '../../../base/dialog'; // @ts-ignore import { bottomSheetStyles } from '../../../base/dialog/components/native/styles'; // @ts-ignore import { translate } from '../../../base/i18n'; import { connect } from '../../../base/redux/functions'; // @ts-ignore import { getBreakoutRooms } from '../../../breakout-rooms/functions'; // @ts-ignore import SendToBreakoutRoom from '../../../video-menu/components/native/SendToBreakoutRoom'; // @ts-ignore import styles from '../../../video-menu/components/native/styles'; /** * Size of the rendered avatar in the menu. */ const AVATAR_SIZE = 24; type Props = { /** * The list of all breakout rooms. */ _rooms: Array, /** * The Redux dispatch function. */ dispatch: Function, /** * The jid of the selected participant. */ participantJid: string, /** * The display name of the selected participant. */ participantName: string, /** * The room the participant is in. */ room: any, /** * Translation function. */ t: Function } /** * Class to implement a popup menu that opens upon long pressing a thumbnail. */ class RoomParticipantMenu extends PureComponent { /** * Constructor of the component. * * @inheritdoc */ constructor(props: Props) { super(props); this._onCancel = this._onCancel.bind(this); this._renderMenuHeader = this._renderMenuHeader.bind(this); } /** * Implements {@code Component#render}. * * @inheritdoc */ render() { const { _rooms, participantJid, room, t } = this.props; const buttonProps = { afterClick: this._onCancel, showLabel: true, participantID: participantJid, styles: bottomSheetStyles.buttons }; return ( {t('breakoutRooms.actions.sendToBreakoutRoom')} {_rooms.map(r => room.id !== r.id && ())} ); } /** * Callback to hide the {@code RemoteVideoMenu}. * * @private * @returns {boolean} */ _onCancel() { this.props.dispatch(hideSheet()); } /** * Function to render the menu's header. * * @returns {React$Element} */ _renderMenuHeader() { const { participantName } = this.props; return ( { participantName } ); } } /** * Function that maps parts of Redux state tree into component props. * * @param {Object} state - Redux state. * @private * @returns {Props} */ function _mapStateToProps(state: any) { return { _rooms: Object.values(getBreakoutRooms(state)) }; } export default translate(connect(_mapStateToProps)(RoomParticipantMenu));