From 14a5c45fa3645c37dda61175ad8b4850c1e90aee Mon Sep 17 00:00:00 2001 From: Calin Chitu Date: Wed, 9 Jun 2021 18:35:58 +0300 Subject: [PATCH] feat(native-participants-pane) removed mock data --- .../ContextMenuLobbyParticipantReject.js | 4 +- .../ContextMenuMeetingParticipantDetails.js | 14 ++--- .../components/native/ContextMenuMore.js | 4 +- .../components/native/LobbyParticipantList.js | 29 +++++++--- .../native/MeetingParticipantList.js | 54 ++++++++++--------- .../components/native/ParticipantItem.js | 11 ++-- .../components/native/ParticipantsPane.js | 49 +++++++++-------- .../native/ParticipantsPaneButton.js | 5 ++ .../components/native/OverflowMenuButton.js | 4 +- 9 files changed, 103 insertions(+), 71 deletions(-) diff --git a/react/features/participants-pane/components/native/ContextMenuLobbyParticipantReject.js b/react/features/participants-pane/components/native/ContextMenuLobbyParticipantReject.js index 330229511..c27125001 100644 --- a/react/features/participants-pane/components/native/ContextMenuLobbyParticipantReject.js +++ b/react/features/participants-pane/components/native/ContextMenuLobbyParticipantReject.js @@ -39,7 +39,7 @@ export const ContextMenuLobbyParticipantReject = ({ participant: p }: Props) => + size = { 20 } /> { displayName } @@ -51,7 +51,7 @@ export const ContextMenuLobbyParticipantReject = ({ participant: p }: Props) => onPress = { reject } style = { styles.contextMenuItem }> { t('lobby.reject') } diff --git a/react/features/participants-pane/components/native/ContextMenuMeetingParticipantDetails.js b/react/features/participants-pane/components/native/ContextMenuMeetingParticipantDetails.js index 33b565eda..0f5ca0bcf 100644 --- a/react/features/participants-pane/components/native/ContextMenuMeetingParticipantDetails.js +++ b/react/features/participants-pane/components/native/ContextMenuMeetingParticipantDetails.js @@ -81,7 +81,7 @@ export const ContextMenuMeetingParticipantDetails = ({ participant: p }: Props) + size = { 20 } /> { displayName } @@ -95,7 +95,7 @@ export const ContextMenuMeetingParticipantDetails = ({ participant: p }: Props) onPress = { muteAudio } style = { styles.contextMenuItem }> @@ -109,7 +109,7 @@ export const ContextMenuMeetingParticipantDetails = ({ participant: p }: Props) onPress = { muteEveryoneElse } style = { styles.contextMenuItem }> @@ -125,7 +125,7 @@ export const ContextMenuMeetingParticipantDetails = ({ participant: p }: Props) onPress = { muteVideo } style = { styles.contextMenuItemSection }> @@ -140,7 +140,7 @@ export const ContextMenuMeetingParticipantDetails = ({ participant: p }: Props) onPress = { kickRemoteParticipant } style = { styles.contextMenuItem }> @@ -152,7 +152,7 @@ export const ContextMenuMeetingParticipantDetails = ({ participant: p }: Props) onPress = { sendPrivateMessage } style = { styles.contextMenuItem }> @@ -162,7 +162,7 @@ export const ContextMenuMeetingParticipantDetails = ({ participant: p }: Props) { t('participantsPane.actions.networkStats') } diff --git a/react/features/participants-pane/components/native/ContextMenuMore.js b/react/features/participants-pane/components/native/ContextMenuMore.js index 73e522997..d64b39ba6 100644 --- a/react/features/participants-pane/components/native/ContextMenuMore.js +++ b/react/features/participants-pane/components/native/ContextMenuMore.js @@ -45,14 +45,14 @@ export const ContextMenuMore = ({ exclude }: Props) => { onPress = { muteEveryoneVideo } style = { styles.contextMenuItem }> {t('participantsPane.actions.stopEveryonesVideo')} {t('participantsPane.actions.dontAllowUnmute')} diff --git a/react/features/participants-pane/components/native/LobbyParticipantList.js b/react/features/participants-pane/components/native/LobbyParticipantList.js index c64807e43..de6408543 100644 --- a/react/features/participants-pane/components/native/LobbyParticipantList.js +++ b/react/features/participants-pane/components/native/LobbyParticipantList.js @@ -4,19 +4,30 @@ import React, { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import { Text, View } from 'react-native'; import { Button } from 'react-native-paper'; -import { useDispatch } from 'react-redux'; +import { useDispatch, useSelector } from 'react-redux'; +import { getLobbyState } from '../../../lobby/functions'; import { admitAllKnockingParticipants } from '../../../video-menu/actions.any'; import { LobbyParticipantItem } from './LobbyParticipantItem'; -import { participants } from './participants'; import styles from './styles'; export const LobbyParticipantList = () => { + const { + lobbyEnabled, + knockingParticipants: participants + } = useSelector(getLobbyState); + const dispatch = useDispatch(); - const admitAll = useCallback(() => dispatch(admitAllKnockingParticipants()), [ dispatch ]); + const admitAll = useCallback(() => + dispatch(admitAllKnockingParticipants(participants, lobbyEnabled)), + [ dispatch ]); const { t } = useTranslation(); + if (!lobbyEnabled || !participants.length) { + return null; + } + return ( @@ -33,11 +44,13 @@ export const LobbyParticipantList = () => { {t('lobby.admitAll')} - { participants.map(p => ( - ) - )} + { + participants.map(p => ( + ) + ) + } ); }; diff --git a/react/features/participants-pane/components/native/MeetingParticipantList.js b/react/features/participants-pane/components/native/MeetingParticipantList.js index a641c1453..140d7969b 100644 --- a/react/features/participants-pane/components/native/MeetingParticipantList.js +++ b/react/features/participants-pane/components/native/MeetingParticipantList.js @@ -4,22 +4,23 @@ import React, { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import { Text, View } from 'react-native'; import { Button } from 'react-native-paper'; -import { useDispatch } from 'react-redux'; +import { useDispatch, useSelector, useStore } from 'react-redux'; -import { createToolbarEvent, sendAnalytics } from '../../../analytics'; import { Icon, IconInviteMore } from '../../../base/icons'; +import { getParticipants } from '../../../base/participants'; import { doInvitePeople } from '../../../invite/actions.native'; +import { shouldRenderInviteButton } from '../../functions'; import { MeetingParticipantItem } from './MeetingParticipantItem'; -import { participants } from './participants'; import styles from './styles'; export const MeetingParticipantList = () => { const dispatch = useDispatch(); - const onInvite = useCallback(() => { - sendAnalytics(createToolbarEvent('invite')); - dispatch(doInvitePeople()); - }, [ dispatch ]); + const onInvite = useCallback(() => dispatch(doInvitePeople()), [ dispatch ]); + const showInviteButton = useSelector(shouldRenderInviteButton); + const store = useStore(); + const state = store.getState(); + const participants = getParticipants(state); const { t } = useTranslation(); return ( @@ -28,23 +29,28 @@ export const MeetingParticipantList = () => { {t('participantsPane.headings.participantsList', { count: participants.length })} -