// @flow import React, { useCallback, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import { Button } from 'react-native-paper'; import { useDispatch, useSelector } from 'react-redux'; import { openDialog, openSheet } from '../../../base/dialog'; import JitsiScreen from '../../../base/modal/components/JitsiScreen'; import { isLocalParticipantModerator } from '../../../base/participants'; import { equals } from '../../../base/redux'; import { getBreakoutRooms, getCurrentRoomId, isAddBreakoutRoomButtonVisible, isAutoAssignParticipantsVisible, isInBreakoutRoom } from '../../../breakout-rooms/functions'; import { getKnockingParticipants } from '../../../lobby/functions'; import MuteEveryoneDialog from '../../../video-menu/components/native/MuteEveryoneDialog'; import { isMoreActionsVisible, isMuteAllVisible } from '../../functions'; import { AddBreakoutRoomButton, AutoAssignButton, LeaveBreakoutRoomButton } from '../breakout-rooms/components/native'; import { CollapsibleRoom } from '../breakout-rooms/components/native/CollapsibleRoom'; import { ContextMenuMore } from './ContextMenuMore'; import HorizontalDotsIcon from './HorizontalDotsIcon'; import LobbyParticipantList from './LobbyParticipantList'; import MeetingParticipantList from './MeetingParticipantList'; import styles from './styles'; /** * Participant pane. * * @returns {React$Element} */ const ParticipantsPane = () => { const dispatch = useDispatch(); const [ searchString, setSearchString ] = useState(''); const openMoreMenu = useCallback(() => dispatch(openSheet(ContextMenuMore)), [ dispatch ]); const isLocalModerator = useSelector(isLocalParticipantModerator); const muteAll = useCallback(() => dispatch(openDialog(MuteEveryoneDialog)), [ dispatch ]); const { t } = useTranslation(); const { conference } = useSelector(state => state['features/base/conference']); const _isBreakoutRoomsSupported = conference?.getBreakoutRooms()?.isSupported(); const currentRoomId = useSelector(getCurrentRoomId); const rooms: Array = Object.values(useSelector(getBreakoutRooms, equals)) .filter((room: Object) => room.id !== currentRoomId) .sort((p1: Object, p2: Object) => (p1?.name || '').localeCompare(p2?.name || '')); const inBreakoutRoom = useSelector(isInBreakoutRoom); const showAddBreakoutRoom = useSelector(isAddBreakoutRoomButtonVisible); const showAutoAssign = useSelector(isAutoAssignParticipantsVisible); const showMoreActions = useSelector(isMoreActionsVisible); const showMuteAll = useSelector(isMuteAllVisible); const lobbyParticipants = useSelector(getKnockingParticipants); return ( { showAutoAssign && } { inBreakoutRoom && } { _isBreakoutRoomsSupported && rooms.map(room => ()) } { showAddBreakoutRoom && } { isLocalModerator && { showMuteAll && (