選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

VisitorsItem.tsx 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import React, { useCallback } from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { useDispatch } from 'react-redux';
  4. import { makeStyles } from 'tss-react/mui';
  5. import Button from '../../../base/ui/components/web/Button';
  6. import { BUTTON_TYPES } from '../../../base/ui/constants.web';
  7. import { approveRequest, denyRequest } from '../../../visitors/actions';
  8. import { IPromotionRequest } from '../../../visitors/types';
  9. import { ACTION_TRIGGER, MEDIA_STATE } from '../../constants';
  10. import ParticipantItem from './ParticipantItem';
  11. interface IProps {
  12. /**
  13. * Promotion request reference.
  14. */
  15. request: IPromotionRequest;
  16. }
  17. const useStyles = makeStyles()(theme => {
  18. return {
  19. button: {
  20. marginRight: theme.spacing(2)
  21. },
  22. moreButton: {
  23. paddingRight: '6px',
  24. paddingLeft: '6px',
  25. marginRight: theme.spacing(2)
  26. },
  27. contextMenu: {
  28. position: 'fixed',
  29. top: 'auto',
  30. marginRight: '8px'
  31. }
  32. };
  33. });
  34. export const VisitorsItem = ({
  35. request: r
  36. }: IProps) => {
  37. const { from, nick } = r;
  38. const { t } = useTranslation();
  39. const { classes: styles } = useStyles();
  40. const dispatch = useDispatch();
  41. const admit = useCallback(() => dispatch(approveRequest(r)), [ dispatch, r ]);
  42. const reject = useCallback(() => dispatch(denyRequest(r)), [ dispatch, r ]);
  43. return (
  44. <ParticipantItem
  45. actionsTrigger = { ACTION_TRIGGER.PERMANENT }
  46. audioMediaState = { MEDIA_STATE.NONE }
  47. displayName = { nick }
  48. participantID = { from }
  49. raisedHand = { true }
  50. videoMediaState = { MEDIA_STATE.NONE }
  51. youText = { t('chat.you') }>
  52. {<>
  53. <Button
  54. accessibilityLabel = { `${t('participantsPane.actions.reject')} ${r.nick}` }
  55. className = { styles.button }
  56. labelKey = 'participantsPane.actions.reject'
  57. onClick = { reject }
  58. size = 'small'
  59. testId = { `reject-${from}` }
  60. type = { BUTTON_TYPES.DESTRUCTIVE } />
  61. <Button
  62. accessibilityLabel = { `${t('participantsPane.actions.admit')} ${r.nick}` }
  63. className = { styles.button }
  64. labelKey = 'participantsPane.actions.admit'
  65. onClick = { admit }
  66. size = 'small'
  67. testId = { `admit-${from}` } />
  68. </>
  69. }
  70. </ParticipantItem>
  71. );
  72. };