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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import React, { PureComponent } from 'react';
  2. import { IReduxState } from '../../app/types';
  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. * Abstract 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 dependent content.
  31. *
  32. * @returns {ReactElement}
  33. */
  34. _render() {
  35. return <></>;
  36. }
  37. }
  38. /**
  39. * Maps part of the Redux state to the props of this component.
  40. *
  41. * @param {Object} state - The Redux state.
  42. * @returns {Props}
  43. */
  44. export function _mapStateToProps(state: IReduxState) {
  45. const { locked, room } = state['features/base/conference'];
  46. const { lobbyEnabled } = state['features/lobby'];
  47. const { enableInsecureRoomNameWarning = false } = state['features/base/config'];
  48. return {
  49. _visible: Boolean(enableInsecureRoomNameWarning
  50. && room && isInsecureRoomName(room)
  51. && !(lobbyEnabled || Boolean(locked)))
  52. };
  53. }