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.

AbstractInsecureRoomNameLabel.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // @flow
  2. import { PureComponent } from 'react';
  3. import isInsecureRoomName from '../../base/util/isInsecureRoomName';
  4. type Props = {
  5. /**
  6. * True of the label should be visible.
  7. */
  8. _visible: boolean;
  9. /**
  10. * Function to be used to translate i18n labels.
  11. */
  12. t: Function
  13. }
  14. /**
  15. * Abstrsact class for the {@Code InsecureRoomNameLabel} component.
  16. */
  17. export default class AbstractInsecureRoomNameLabel extends PureComponent<Props> {
  18. /**
  19. * Implements {@code Component#render}.
  20. *
  21. * @inheritdoc
  22. */
  23. render() {
  24. if (!this.props._visible) {
  25. return null;
  26. }
  27. return this._render();
  28. }
  29. /**
  30. * Renders the platform dependant content.
  31. *
  32. * @returns {ReactElement}
  33. */
  34. _render: () => Object;
  35. }
  36. /**
  37. * Maps part of the Redux state to the props of this component.
  38. *
  39. * @param {Object} state - The Redux state.
  40. * @returns {Props}
  41. */
  42. export function _mapStateToProps(state: Object): $Shape<Props> {
  43. const { room } = state['features/base/conference'];
  44. return {
  45. _visible: room && isInsecureRoomName(room)
  46. };
  47. }