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.tsx 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import React, { Component } from 'react';
  2. // We need to reference these files directly to avoid loading things that are not available
  3. // in this environment (e.g. JitsiMeetJS or interfaceConfig)
  4. import { IconHangup } from '../base/icons/svg';
  5. import { IProps } from '../base/toolbox/components/AbstractButton';
  6. import ToolbarButton from './ToolbarButton';
  7. const { api } = window.alwaysOnTop;
  8. type Props = Partial<IProps>;
  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 {IProps} 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. /**
  27. * Handles clicking / pressing the button, and disconnects the conference.
  28. *
  29. * @protected
  30. * @returns {void}
  31. */
  32. _onClick() {
  33. api.executeCommand('hangup');
  34. }
  35. /**
  36. * Implements React's {@link Component#render()}.
  37. *
  38. * @inheritdoc
  39. * @returns {ReactElement}
  40. */
  41. render() {
  42. return (
  43. <ToolbarButton
  44. accessibilityLabel = { this.accessibilityLabel }
  45. customClass = 'hangup-button'
  46. icon = { this.icon }
  47. onClick = { this._onClick } />
  48. );
  49. }
  50. }