2021-06-03 16:23:18 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { TouchableOpacity, View } from 'react-native';
|
|
|
|
import { Text } from 'react-native-paper';
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
|
|
|
|
import { Avatar } from '../../../base/avatar';
|
|
|
|
import { hideDialog } from '../../../base/dialog';
|
|
|
|
import BottomSheet from '../../../base/dialog/components/native/BottomSheet';
|
|
|
|
import {
|
|
|
|
Icon, IconClose
|
|
|
|
} from '../../../base/icons';
|
|
|
|
import { setKnockingParticipantApproval } from '../../../lobby/actions.native';
|
|
|
|
|
|
|
|
import styles from './styles';
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Participant reference
|
|
|
|
*/
|
|
|
|
participant: Object
|
|
|
|
};
|
|
|
|
|
2021-06-04 15:07:18 +00:00
|
|
|
export const ContextMenuLobbyParticipantReject = ({ participant: p }: Props) => {
|
2021-06-03 16:23:18 +00:00
|
|
|
const dispatch = useDispatch();
|
|
|
|
const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
|
|
|
|
const displayName = p.name;
|
|
|
|
const reject = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, false), [ dispatch ]));
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<BottomSheet
|
|
|
|
onCancel = { cancel }
|
|
|
|
style = { styles.contextMenuMore }>
|
|
|
|
<View
|
2021-06-04 15:07:18 +00:00
|
|
|
style = { styles.contextMenuItemSection }>
|
2021-06-03 16:23:18 +00:00
|
|
|
<Avatar
|
|
|
|
className = 'participant-avatar'
|
|
|
|
participantId = { p.id }
|
2021-06-07 15:19:01 +00:00
|
|
|
size = { 24 } />
|
2021-06-03 16:23:18 +00:00
|
|
|
<View style = { styles.contextMenuItemText }>
|
2021-06-04 15:07:18 +00:00
|
|
|
<Text style = { styles.contextMenuItemName }>
|
2021-06-03 16:23:18 +00:00
|
|
|
{ displayName }
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<TouchableOpacity
|
|
|
|
onPress = { reject }
|
2021-06-04 15:07:18 +00:00
|
|
|
style = { styles.contextMenuItem }>
|
2021-06-03 16:23:18 +00:00
|
|
|
<Icon
|
|
|
|
size = { 24 }
|
2021-06-04 15:07:18 +00:00
|
|
|
src = { IconClose }
|
|
|
|
style = { styles.contextMenuItemIcon } />
|
2021-06-03 16:23:18 +00:00
|
|
|
<Text style = { styles.contextMenuItemText }>{ t('lobby.reject') }</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
</BottomSheet>
|
|
|
|
);
|
|
|
|
};
|