2021-05-19 10:08:30 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
|
2021-10-21 09:40:57 +00:00
|
|
|
import { hasRaisedHand } from '../../../base/participants';
|
2022-07-07 12:29:18 +00:00
|
|
|
import Button from '../../../base/react/components/native/Button';
|
|
|
|
import { BUTTON_TYPES } from '../../../base/react/constants';
|
2021-06-29 14:05:11 +00:00
|
|
|
import { approveKnockingParticipant } from '../../../lobby/actions.native';
|
2021-06-03 16:23:18 +00:00
|
|
|
import { showContextMenuReject } from '../../actions.native';
|
2021-06-29 14:05:11 +00:00
|
|
|
import { MEDIA_STATE } from '../../constants';
|
2021-05-19 10:08:30 +00:00
|
|
|
|
|
|
|
import ParticipantItem from './ParticipantItem';
|
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* Participant reference.
|
2021-05-19 10:08:30 +00:00
|
|
|
*/
|
|
|
|
participant: Object
|
|
|
|
};
|
|
|
|
|
|
|
|
export const LobbyParticipantItem = ({ participant: p }: Props) => {
|
|
|
|
const dispatch = useDispatch();
|
2021-06-29 14:05:11 +00:00
|
|
|
const admit = useCallback(() => dispatch(approveKnockingParticipant(p.id), [ dispatch ]));
|
2021-06-03 16:23:18 +00:00
|
|
|
const openContextMenuReject = useCallback(() => dispatch(showContextMenuReject(p), [ dispatch ]));
|
2021-05-19 10:08:30 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<ParticipantItem
|
2021-06-29 14:05:11 +00:00
|
|
|
audioMediaState = { MEDIA_STATE.NONE }
|
2021-07-12 15:14:38 +00:00
|
|
|
displayName = { p.name }
|
2021-06-09 12:41:00 +00:00
|
|
|
isKnockingParticipant = { true }
|
2021-07-12 15:14:38 +00:00
|
|
|
local = { p.local }
|
2021-06-03 16:23:18 +00:00
|
|
|
onPress = { openContextMenuReject }
|
2021-05-19 10:08:30 +00:00
|
|
|
participant = { p }
|
2021-07-12 15:14:38 +00:00
|
|
|
participantID = { p.id }
|
2021-10-21 09:40:57 +00:00
|
|
|
raisedHand = { hasRaisedHand(p) }
|
2021-06-29 14:05:11 +00:00
|
|
|
videoMediaState = { MEDIA_STATE.NONE }>
|
2021-06-03 16:23:18 +00:00
|
|
|
<Button
|
2022-07-07 12:29:18 +00:00
|
|
|
accessibilityLabel = 'lobby.admit'
|
|
|
|
label = 'lobby.admit'
|
2021-06-03 16:23:18 +00:00
|
|
|
onPress = { admit }
|
2022-07-07 12:29:18 +00:00
|
|
|
style = { styles.participantActionsButtonAdmit }
|
|
|
|
type = { BUTTON_TYPES.PRIMARY } />
|
2021-05-19 10:08:30 +00:00
|
|
|
</ParticipantItem>
|
|
|
|
);
|
|
|
|
};
|