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.

LocalRecordingLabel.web.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // @flow
  2. import Tooltip from '@atlaskit/tooltip';
  3. import React, { Component } from 'react';
  4. import { translate } from '../../base/i18n/index';
  5. import { CircularLabel } from '../../base/label/index';
  6. import { connect } from '../../base/redux';
  7. /**
  8. * The type of the React {@code Component} props of {@link LocalRecordingLabel}.
  9. */
  10. type Props = {
  11. /**
  12. * Invoked to obtain translated strings.
  13. */
  14. t: Function,
  15. /**
  16. * Whether local recording is engaged or not.
  17. */
  18. isEngaged: boolean
  19. };
  20. /**
  21. * React Component for displaying a label when local recording is engaged.
  22. *
  23. * @extends Component
  24. */
  25. class LocalRecordingLabel extends Component<Props> {
  26. /**
  27. * Implements React's {@link Component#render()}.
  28. *
  29. * @inheritdoc
  30. * @returns {ReactElement}
  31. */
  32. render() {
  33. if (!this.props.isEngaged) {
  34. return null;
  35. }
  36. return (
  37. <Tooltip
  38. content = { this.props.t('localRecording.labelToolTip') }
  39. position = { 'left' }>
  40. <CircularLabel
  41. className = 'local-rec'
  42. label = { this.props.t('localRecording.label') } />
  43. </Tooltip>
  44. );
  45. }
  46. }
  47. /**
  48. * Maps (parts of) the Redux state to the associated props for the
  49. * {@code LocalRecordingLabel} component.
  50. *
  51. * @param {Object} state - The Redux state.
  52. * @private
  53. * @returns {{
  54. * }}
  55. */
  56. function _mapStateToProps(state) {
  57. const { isEngaged } = state['features/local-recording'];
  58. return {
  59. isEngaged
  60. };
  61. }
  62. export default translate(connect(_mapStateToProps)(LocalRecordingLabel));