您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

LobbyParticipantList.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // @flow
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { Text, View } from 'react-native';
  5. import { Button } from 'react-native-paper';
  6. import { useDispatch, useSelector } from 'react-redux';
  7. import { getLobbyState } from '../../../lobby/functions';
  8. import { admitAllKnockingParticipants } from '../../../video-menu/actions.any';
  9. import { LobbyParticipantItem } from './LobbyParticipantItem';
  10. import styles from './styles';
  11. export const LobbyParticipantList = () => {
  12. const {
  13. lobbyEnabled,
  14. knockingParticipants: participants
  15. } = useSelector(getLobbyState);
  16. const dispatch = useDispatch();
  17. const admitAll = useCallback(() =>
  18. dispatch(admitAllKnockingParticipants(participants, lobbyEnabled)),
  19. [ dispatch ]);
  20. const { t } = useTranslation();
  21. if (!lobbyEnabled || !participants.length) {
  22. return null;
  23. }
  24. return (
  25. <View style = { styles.lobbyList }>
  26. <View style = { styles.lobbyListDetails } >
  27. <Text style = { styles.lobbyListDescription }>
  28. {t('participantsPane.headings.waitingLobby',
  29. { count: participants.length })}
  30. </Text>
  31. <Button
  32. color = '#3D3D3D'
  33. labelStyle = { styles.admitAllParticipantsActionButtonLabel }
  34. mode = 'text'
  35. onPress = { admitAll }
  36. style = { styles.admitAllParticipantsActionButton }>
  37. {t('lobby.admitAll')}
  38. </Button>
  39. </View>
  40. {
  41. participants.map(p => (
  42. <LobbyParticipantItem
  43. key = { p.id }
  44. participant = { p } />)
  45. )
  46. }
  47. </View>
  48. );
  49. };