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

HangupButton.web.js 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // @flow
  2. import React from 'react';
  3. import PropTypes from 'prop-types';
  4. import { connect } from 'react-redux';
  5. import { disconnect } from '../../../base/connection';
  6. import { translate } from '../../../base/i18n';
  7. import AbstractHangupButton from './AbstractHangupButton';
  8. import ToolbarButtonV2 from '../ToolbarButtonV2';
  9. /**
  10. * Component that renders a toolbar button for leaving the current conference.
  11. *
  12. * @extends Component
  13. */
  14. export class HangupButton extends AbstractHangupButton {
  15. /**
  16. * Default values for {@code HangupButton} component's properties.
  17. *
  18. * @static
  19. */
  20. static defaultProps = {
  21. tooltipPosition: 'top'
  22. };
  23. /**
  24. * {@code HangupButton} component's property types.
  25. *
  26. * @static
  27. */
  28. static propTypes = {
  29. /**
  30. * Invoked to trigger conference leave.
  31. */
  32. dispatch: PropTypes.func,
  33. /**
  34. * Invoked to obtain translated strings.
  35. */
  36. t: PropTypes.func,
  37. /**
  38. * Where the tooltip should display, relative to the button.
  39. */
  40. tooltipPosition: PropTypes.string
  41. }
  42. /**
  43. * Implements React's {@link Component#render()}.
  44. *
  45. * @inheritdoc
  46. * @returns {ReactElement}
  47. */
  48. render() {
  49. const { t, tooltipPosition } = this.props;
  50. return (
  51. <ToolbarButtonV2
  52. iconName = 'icon-hangup'
  53. onClick = { this._onToolbarHangup }
  54. tooltip = { t('toolbar.hangup') }
  55. tooltipPosition = { tooltipPosition } />
  56. );
  57. }
  58. _onToolbarHangup: () => void;
  59. /**
  60. * Dispatches an action for leaving the current conference.
  61. *
  62. * @private
  63. * @returns {void}
  64. */
  65. _doHangup() {
  66. this.props.dispatch(disconnect(true));
  67. }
  68. }
  69. export default translate(connect()(HangupButton));