Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

InsecureRoomNameExpandedLabel.tsx 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { WithTranslation } from 'react-i18next';
  2. import { connect } from 'react-redux';
  3. import { IReduxState } from '../../../app/types';
  4. import { translate } from '../../../base/i18n/functions';
  5. import ExpandedLabel, { IProps as AbstractProps } from '../../../base/label/components/native/ExpandedLabel';
  6. import getUnsafeRoomText from '../../../base/util/getUnsafeRoomText.native';
  7. import { INSECURE_ROOM_NAME_LABEL_COLOR } from './styles';
  8. interface IProps extends AbstractProps, WithTranslation {
  9. getUnsafeRoomTextFn: Function;
  10. }
  11. /**
  12. * A react {@code Component} that implements an expanded label as tooltip-like
  13. * component to explain the meaning of the {@code InsecureRoomNameExpandedLabel}.
  14. */
  15. class InsecureRoomNameExpandedLabel extends ExpandedLabel<IProps> {
  16. /**
  17. * Returns the color this expanded label should be rendered with.
  18. *
  19. * @returns {string}
  20. */
  21. _getColor() {
  22. return INSECURE_ROOM_NAME_LABEL_COLOR;
  23. }
  24. /**
  25. * Returns the label specific text of this {@code ExpandedLabel}.
  26. *
  27. * @returns {string}
  28. */
  29. _getLabel() {
  30. return this.props.getUnsafeRoomTextFn(this.props.t);
  31. }
  32. }
  33. /**
  34. * Maps part of the Redux state to the props of this component.
  35. *
  36. * @param {Object} state - The Redux state.
  37. * @returns {IProps}
  38. */
  39. function _mapStateToProps(state: IReduxState) {
  40. return {
  41. getUnsafeRoomTextFn: (t: Function) => getUnsafeRoomText(state, t, 'meeting')
  42. };
  43. }
  44. export default translate(connect(_mapStateToProps)(InsecureRoomNameExpandedLabel));