您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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. interface IProps extends WithTranslation {
  6. /**
  7. * True of the label should be visible.
  8. */
  9. _visible: boolean;
  10. }
  11. /**
  12. * Abstract class for the {@Code InsecureRoomNameLabel} component.
  13. */
  14. export default class AbstractInsecureRoomNameLabel extends PureComponent<IProps> {
  15. /**
  16. * Implements {@code Component#render}.
  17. *
  18. * @inheritdoc
  19. */
  20. render() {
  21. if (!this.props._visible) {
  22. return null;
  23. }
  24. return this._render();
  25. }
  26. /**
  27. * Renders the platform dependent content.
  28. *
  29. * @returns {ReactElement}
  30. */
  31. _render() {
  32. return <></>;
  33. }
  34. }
  35. /**
  36. * Maps part of the Redux state to the props of this component.
  37. *
  38. * @param {Object} state - The Redux state.
  39. * @returns {IProps}
  40. */
  41. export function _mapStateToProps(state: IReduxState) {
  42. const { locked, room } = state['features/base/conference'];
  43. const { lobbyEnabled } = state['features/lobby'];
  44. const { enableInsecureRoomNameWarning = false } = state['features/base/config'];
  45. return {
  46. _visible: Boolean(enableInsecureRoomNameWarning
  47. && room && isInsecureRoomName(room)
  48. && !(lobbyEnabled || Boolean(locked)))
  49. };
  50. }