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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import React, { PureComponent } from 'react';
  2. import { WithTranslation } from 'react-i18next';
  3. import { IReduxState } from '../../app/types';
  4. import isInsecureRoomName from '../../base/util/isInsecureRoomName';
  5. import { isUnsafeRoomWarningEnabled } from '../../prejoin/functions';
  6. interface IProps extends WithTranslation {
  7. /**
  8. * True of the label should be visible.
  9. */
  10. _visible: boolean;
  11. }
  12. /**
  13. * Abstract class for the {@Code InsecureRoomNameLabel} component.
  14. */
  15. export default class AbstractInsecureRoomNameLabel extends PureComponent<IProps> {
  16. /**
  17. * Implements {@code Component#render}.
  18. *
  19. * @inheritdoc
  20. */
  21. render() {
  22. if (!this.props._visible) {
  23. return null;
  24. }
  25. return this._render();
  26. }
  27. /**
  28. * Renders the platform dependent content.
  29. *
  30. * @returns {ReactElement}
  31. */
  32. _render() {
  33. return <></>;
  34. }
  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 {IProps}
  41. */
  42. export function _mapStateToProps(state: IReduxState) {
  43. const { locked, room } = state['features/base/conference'];
  44. const { lobbyEnabled } = state['features/lobby'];
  45. return {
  46. _visible: Boolean(isUnsafeRoomWarningEnabled(state)
  47. && room && isInsecureRoomName(room)
  48. && !(lobbyEnabled || Boolean(locked)))
  49. };
  50. }