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

JoinQuickActionButton.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // @flow
  2. import { makeStyles } from '@material-ui/styles';
  3. import React, { useCallback } from 'react';
  4. import { useTranslation } from 'react-i18next';
  5. import { useDispatch } from 'react-redux';
  6. import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
  7. import { QuickActionButton } from '../../../base/components';
  8. import { moveToRoom } from '../../actions';
  9. type Props = {
  10. /**
  11. * The room to join.
  12. */
  13. room: Object
  14. }
  15. const useStyles = makeStyles(theme => {
  16. return {
  17. button: {
  18. marginRight: `${theme.spacing(2)}px`
  19. }
  20. };
  21. });
  22. const JoinActionButton = ({ room }: Props) => {
  23. const styles = useStyles();
  24. const { t } = useTranslation();
  25. const dispatch = useDispatch();
  26. const onJoinRoom = useCallback(e => {
  27. e.stopPropagation();
  28. sendAnalytics(createBreakoutRoomsEvent('join'));
  29. dispatch(moveToRoom(room.jid));
  30. }, [ dispatch, room ]);
  31. return (<QuickActionButton
  32. accessibilityLabel = { t('breakoutRooms.actions.join') }
  33. className = { styles.button }
  34. onClick = { onJoinRoom }
  35. testId = { `join-room-${room.id}` }>
  36. {t('breakoutRooms.actions.join')}
  37. </QuickActionButton>
  38. );
  39. };
  40. export default JoinActionButton;