feat(conf/gifs/participants): created ParticipantsPaneFooter and updated comments

This commit is contained in:
Calin-Teodor 2022-07-08 11:27:27 +03:00 committed by Calinteodor
parent ba3cd53017
commit 077901cd2b
4 changed files with 72 additions and 46 deletions

View File

@ -4,6 +4,12 @@ import { Image, Text, View } from 'react-native';
import styles from './styles'; import styles from './styles';
/**
* Implements the gifs menu footer component.
*
* @returns { JSX.Element} - The gifs menu footer component.
*/
const GifsMenuFooter = (): JSX.Element => { const GifsMenuFooter = (): JSX.Element => {
const { t } = useTranslation(); const { t } = useTranslation();
@ -17,4 +23,4 @@ const GifsMenuFooter = (): JSX.Element => {
) )
}; };
export default GifsMenuFooter export default GifsMenuFooter;

View File

@ -1,16 +1,10 @@
// @flow // @flow
import React, { useCallback, useState } from 'react'; import React, { useState } from 'react';
import { View } from 'react-native'; import { useSelector } from 'react-redux';
import { useDispatch, useSelector } from 'react-redux';
import { openDialog, openSheet } from '../../../base/dialog';
import { IconHorizontalPoints } from '../../../base/icons';
import JitsiScreen from '../../../base/modal/components/JitsiScreen'; import JitsiScreen from '../../../base/modal/components/JitsiScreen';
import { isLocalParticipantModerator } from '../../../base/participants'; import { isLocalParticipantModerator } from '../../../base/participants';
import Button from '../../../base/react/components/native/Button';
import IconButton from '../../../base/react/components/native/IconButton';
import { BUTTON_TYPES } from '../../../base/react/constants';
import { equals } from '../../../base/redux'; import { equals } from '../../../base/redux';
import { import {
getBreakoutRooms, getBreakoutRooms,
@ -20,9 +14,6 @@ import {
isInBreakoutRoom isInBreakoutRoom
} from '../../../breakout-rooms/functions'; } from '../../../breakout-rooms/functions';
import { getKnockingParticipants } from '../../../lobby/functions'; import { getKnockingParticipants } from '../../../lobby/functions';
import MuteEveryoneDialog
from '../../../video-menu/components/native/MuteEveryoneDialog';
import { isMoreActionsVisible, isMuteAllVisible } from '../../functions';
import { import {
AddBreakoutRoomButton, AddBreakoutRoomButton,
AutoAssignButton, AutoAssignButton,
@ -30,23 +21,20 @@ import {
} from '../breakout-rooms/components/native'; } from '../breakout-rooms/components/native';
import { CollapsibleRoom } from '../breakout-rooms/components/native/CollapsibleRoom'; import { CollapsibleRoom } from '../breakout-rooms/components/native/CollapsibleRoom';
import { ContextMenuMore } from './ContextMenuMore';
import LobbyParticipantList from './LobbyParticipantList'; import LobbyParticipantList from './LobbyParticipantList';
import MeetingParticipantList from './MeetingParticipantList'; import MeetingParticipantList from './MeetingParticipantList';
import ParticipantsPaneFooter from './ParticipantsPaneFooter';
import styles from './styles'; import styles from './styles';
/** /**
* Participant pane. * Participants pane.
* *
* @returns {React$Element<any>} * @returns {React$Element<any>}
*/ */
const ParticipantsPane = () => { const ParticipantsPane = () => {
const dispatch = useDispatch();
const [ searchString, setSearchString ] = useState(''); const [ searchString, setSearchString ] = useState('');
const openMoreMenu = useCallback(() => dispatch(openSheet(ContextMenuMore)), [ dispatch ]);
const isLocalModerator = useSelector(isLocalParticipantModerator); const isLocalModerator = useSelector(isLocalParticipantModerator);
const muteAll = useCallback(() => dispatch(openDialog(MuteEveryoneDialog)),
[ dispatch ]);
const { conference } = useSelector(state => state['features/base/conference']); const { conference } = useSelector(state => state['features/base/conference']);
const _isBreakoutRoomsSupported = conference?.getBreakoutRooms()?.isSupported(); const _isBreakoutRoomsSupported = conference?.getBreakoutRooms()?.isSupported();
const currentRoomId = useSelector(getCurrentRoomId); const currentRoomId = useSelector(getCurrentRoomId);
@ -56,12 +44,12 @@ const ParticipantsPane = () => {
const inBreakoutRoom = useSelector(isInBreakoutRoom); const inBreakoutRoom = useSelector(isInBreakoutRoom);
const showAddBreakoutRoom = useSelector(isAddBreakoutRoomButtonVisible); const showAddBreakoutRoom = useSelector(isAddBreakoutRoomButtonVisible);
const showAutoAssign = useSelector(isAutoAssignParticipantsVisible); const showAutoAssign = useSelector(isAutoAssignParticipantsVisible);
const showMoreActions = useSelector(isMoreActionsVisible);
const showMuteAll = useSelector(isMuteAllVisible);
const lobbyParticipants = useSelector(getKnockingParticipants); const lobbyParticipants = useSelector(getKnockingParticipants);
return ( return (
<JitsiScreen style = { styles.participantsPaneContainer }> <JitsiScreen
footerComponent = { isLocalModerator && ParticipantsPaneFooter }
style = { styles.participantsPaneContainer }>
<LobbyParticipantList /> <LobbyParticipantList />
<MeetingParticipantList <MeetingParticipantList
breakoutRooms = { rooms } breakoutRooms = { rooms }
@ -85,29 +73,6 @@ const ParticipantsPane = () => {
{ {
showAddBreakoutRoom && <AddBreakoutRoomButton /> showAddBreakoutRoom && <AddBreakoutRoomButton />
} }
{
isLocalModerator
&& <View style = { styles.participantsPaneFooter }>
{
showMuteAll && (
<Button
accessibilityLabel = 'participantsPane.actions.muteAll'
label = 'participantsPane.actions.muteAll'
onPress = { muteAll }
type = { BUTTON_TYPES.SECONDARY } />
)
}
{
showMoreActions && (
<IconButton
onPress = { openMoreMenu }
src = { IconHorizontalPoints }
style = { styles.moreButton }
type = { BUTTON_TYPES.SECONDARY } />
)
}
</View>
}
</JitsiScreen> </JitsiScreen>
); );
}; };

View File

@ -0,0 +1,55 @@
import React, { useCallback } from 'react';
import { View } from 'react-native';
import { useDispatch, useSelector} from "react-redux";
import { openDialog, openSheet } from '../../../base/dialog';
import { IconHorizontalPoints } from '../../../base/icons';
import Button from '../../../base/react/components/native/Button';
import IconButton from '../../../base/react/components/native/IconButton';
import { BUTTON_TYPES } from '../../../base/react/constants';
import MuteEveryoneDialog
from '../../../video-menu/components/native/MuteEveryoneDialog';
import { isMoreActionsVisible, isMuteAllVisible } from '../../functions';
import { ContextMenuMore } from './ContextMenuMore';
import styles from './styles';
/**
* Implements the participants pane footer component.
*
* @returns { JSX.Element} - The participants pane footer component.
*/
const ParticipantsPaneFooter = (): JSX.Element => {
const dispatch = useDispatch();
const openMoreMenu = useCallback(() => dispatch(openSheet(ContextMenuMore)), [ dispatch ]);
const muteAll = useCallback(() => dispatch(openDialog(MuteEveryoneDialog)),
[ dispatch ]);
const showMoreActions = useSelector(isMoreActionsVisible);
const showMuteAll = useSelector(isMuteAllVisible);
return(
<View style = { styles.participantsPaneFooter }>
{
showMuteAll && (
<Button
accessibilityLabel = 'participantsPane.actions.muteAll'
label = 'participantsPane.actions.muteAll'
onPress = { muteAll }
type = { BUTTON_TYPES.SECONDARY } />
)
}
{
showMoreActions && (
<IconButton
onPress = { openMoreMenu }
src = { IconHorizontalPoints }
style = { styles.moreButton }
type = { BUTTON_TYPES.SECONDARY } />
)
}
</View>
)
};
export default ParticipantsPaneFooter;