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.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // @flow
  2. import React, { Component } from 'react';
  3. // We need to reference these files directly to avoid loading things that are not available
  4. // in this environment (e.g. JitsiMeetJS or interfaceConfig)
  5. import { IconHangup } from '../base/icons';
  6. import type { Props } from '../base/toolbox/components/AbstractButton';
  7. import ToolbarButton from './ToolbarButton';
  8. const { api } = window.alwaysOnTop;
  9. /**
  10. * Stateless hangup button for the Always-on-Top windows.
  11. */
  12. export default class HangupButton extends Component<Props, *> {
  13. accessibilityLabel = 'Hangup';
  14. icon = IconHangup;
  15. /**
  16. * Initializes a new {@code HangupButton} instance.
  17. *
  18. * @param {Props} props - The React {@code Component} props to initialize
  19. * the new {@code HangupButton} instance with.
  20. */
  21. constructor(props: Props) {
  22. super(props);
  23. // Bind event handlers so they are only bound once per instance.
  24. this._onClick = this._onClick.bind(this);
  25. }
  26. _onClick: () => {};
  27. /**
  28. * Handles clicking / pressing the button, and disconnects the conference.
  29. *
  30. * @protected
  31. * @returns {void}
  32. */
  33. _onClick() {
  34. api.executeCommand('hangup');
  35. }
  36. /**
  37. * Implements React's {@link Component#render()}.
  38. *
  39. * @inheritdoc
  40. * @returns {ReactElement}
  41. */
  42. render() {
  43. return (<ToolbarButton
  44. accessibilityLabel = { this.accessibilityLabel }
  45. customClass = 'hangup-button'
  46. icon = { this.icon }
  47. onClick = { this._onClick } />);
  48. }
  49. }