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.

OverflowMenuLiveStreamingItem.js 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import Tooltip from '@atlaskit/tooltip';
  2. import PropTypes from 'prop-types';
  3. import React, { Component } from 'react';
  4. import { translate } from '../../../base/i18n';
  5. /**
  6. * React {@code Component} for starting or stopping a live streaming of the
  7. * current conference and displaying the current state of live streaming.
  8. *
  9. * @extends Component
  10. */
  11. class OverflowMenuLiveStreamingItem extends Component {
  12. /**
  13. * Default values for {@code OverflowMenuLiveStreamingItem}
  14. * component's properties.
  15. *
  16. * @static
  17. */
  18. static defaultProps = {
  19. tooltipPosition: 'left',
  20. disabled: false
  21. };
  22. /**
  23. * The type of the React {@code Component} props of
  24. * {@link OverflowMenuLiveStreamingItem}.
  25. */
  26. static propTypes = {
  27. /**
  28. * Whether menu item is disabled or not.
  29. */
  30. disabled: PropTypes.bool,
  31. /**
  32. * The callback to invoke when {@code OverflowMenuLiveStreamingItem} is
  33. * clicked.
  34. */
  35. onClick: Function,
  36. /**
  37. * The current live streaming session, if any.
  38. */
  39. session: PropTypes.object,
  40. /**
  41. * Invoked to obtain translated strings.
  42. */
  43. t: Function,
  44. /**
  45. * The text to display in the tooltip.
  46. */
  47. tooltip: PropTypes.string,
  48. /**
  49. * From which direction the tooltip should appear, relative to the
  50. * button.
  51. */
  52. tooltipPosition: PropTypes.string
  53. };
  54. /**
  55. * Implements React's {@link Component#render()}.
  56. *
  57. * @inheritdoc
  58. * @returns {ReactElement}
  59. */
  60. render() {
  61. const { disabled, onClick, session, t, tooltip, tooltipPosition }
  62. = this.props;
  63. const translationKey = session
  64. ? 'dialog.stopLiveStreaming'
  65. : 'dialog.startLiveStreaming';
  66. let className = 'overflow-menu-item';
  67. className += disabled ? ' disabled' : '';
  68. const button = (// eslint-disable-line no-extra-parens
  69. <span>
  70. <span className = 'profile-text'>
  71. { t(translationKey) }
  72. </span>
  73. <span className = 'beta-tag'>
  74. { t('recording.beta') }
  75. </span>
  76. </span>
  77. );
  78. return (
  79. <li
  80. aria-label = { t('dialog.accessibilityLabel.liveStreaming') }
  81. className = { className }
  82. onClick = { disabled ? null : onClick }>
  83. <span className = 'overflow-menu-item-icon'>
  84. <i className = 'icon-public' />
  85. </span>
  86. { tooltip
  87. ? <Tooltip
  88. content = { tooltip }
  89. position = { tooltipPosition }>
  90. { button }
  91. </Tooltip>
  92. : button }
  93. </li>
  94. );
  95. }
  96. }
  97. export default translate(OverflowMenuLiveStreamingItem);