You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HangupButton.web.js 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 ToolbarButton from '../ToolbarButton';
  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. <ToolbarButton
  52. accessibilityLabel = 'Hangup'
  53. iconName = 'icon-hangup'
  54. onClick = { this._onToolbarHangup }
  55. tooltip = { t('toolbar.hangup') }
  56. tooltipPosition = { tooltipPosition } />
  57. );
  58. }
  59. _onToolbarHangup: () => void;
  60. /**
  61. * Dispatches an action for leaving the current conference.
  62. *
  63. * @private
  64. * @returns {void}
  65. */
  66. _doHangup() {
  67. this.props.dispatch(disconnect(true));
  68. }
  69. }
  70. export default translate(connect()(HangupButton));