From efc5c9dabed560021d4eaa9e7c0816e64fdbccf8 Mon Sep 17 00:00:00 2001 From: Calinteodor Date: Fri, 30 Jul 2021 12:48:06 +0300 Subject: [PATCH] feat(participants-pane) hide admit all if less than 2 participants - Fixed admitMultiple action for mobile - Added token color for button - Hide Admit all button if less than 2 knocking participants --- .../components/native/LobbyParticipantList.js | 37 +++++++++++++------ .../components/native/ParticipantsPane.js | 2 +- .../components/native/styles.js | 4 -- .../components/web/LobbyParticipantList.js | 10 +++-- 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/react/features/participants-pane/components/native/LobbyParticipantList.js b/react/features/participants-pane/components/native/LobbyParticipantList.js index fe935ac49..2e3765174 100644 --- a/react/features/participants-pane/components/native/LobbyParticipantList.js +++ b/react/features/participants-pane/components/native/LobbyParticipantList.js @@ -3,7 +3,7 @@ import React, { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import { Text, View } from 'react-native'; -import { Button } from 'react-native-paper'; +import { Button, withTheme } from 'react-native-paper'; import { useDispatch, useSelector } from 'react-redux'; import { admitMultiple } from '../../../lobby/actions.native'; @@ -12,17 +12,25 @@ import { getLobbyState } from '../../../lobby/functions'; import { LobbyParticipantItem } from './LobbyParticipantItem'; import styles from './styles'; -export const LobbyParticipantList = () => { +type Props = { + + /** + * Theme used for styles. + */ + theme: Object +}; + +const LobbyParticipantList = ({ theme }: Props) => { const { lobbyEnabled, knockingParticipants: participants } = useSelector(getLobbyState); - const dispatch = useDispatch(); const admitAll = useCallback(() => dispatch(admitMultiple(participants)), - [ dispatch ]); + [ dispatch, participants ]); const { t } = useTranslation(); + const { palette } = theme; if (!lobbyEnabled || !participants.length) { return null; @@ -35,14 +43,17 @@ export const LobbyParticipantList = () => { {t('participantsPane.headings.waitingLobby', { count: participants.length })} - + { + participants.length > 1 && ( + + ) + } { participants.map(p => ( @@ -54,3 +65,5 @@ export const LobbyParticipantList = () => { ); }; + +export default withTheme(LobbyParticipantList); diff --git a/react/features/participants-pane/components/native/ParticipantsPane.js b/react/features/participants-pane/components/native/ParticipantsPane.js index 9c07e636e..76e53562c 100644 --- a/react/features/participants-pane/components/native/ParticipantsPane.js +++ b/react/features/participants-pane/components/native/ParticipantsPane.js @@ -18,7 +18,7 @@ import MuteEveryoneDialog import { close } from '../../actions.native'; import { ContextMenuMore } from './ContextMenuMore'; -import { LobbyParticipantList } from './LobbyParticipantList'; +import LobbyParticipantList from './LobbyParticipantList'; import { MeetingParticipantList } from './MeetingParticipantList'; import styles from './styles'; diff --git a/react/features/participants-pane/components/native/styles.js b/react/features/participants-pane/components/native/styles.js index 2ae30d177..589318ad1 100644 --- a/react/features/participants-pane/components/native/styles.js +++ b/react/features/participants-pane/components/native/styles.js @@ -116,10 +116,6 @@ export default { textTransform: 'capitalize' }, - admitAllParticipantsActionButton: { - marginLeft: 'auto' - }, - participantContainer: { alignItems: 'center', borderBottomColor: BaseTheme.palette.field01Hover, diff --git a/react/features/participants-pane/components/web/LobbyParticipantList.js b/react/features/participants-pane/components/web/LobbyParticipantList.js index bad4365ce..2a5afc63f 100644 --- a/react/features/participants-pane/components/web/LobbyParticipantList.js +++ b/react/features/participants-pane/components/web/LobbyParticipantList.js @@ -53,9 +53,13 @@ export const LobbyParticipantList = () => {
{t('participantsPane.headings.lobby', { count: participants.length })}
-
{t('lobby.admitAll')}
+ { + participants.length > 1 && ( +
{t('lobby.admitAll')}
+ ) + }
{participants.map(p => (