2023-05-09 12:10:46 +03:00
|
|
|
import { WithTranslation } from 'react-i18next';
|
2023-05-09 21:04:58 +03:00
|
|
|
import { connect } from 'react-redux';
|
2020-05-18 14:07:09 +02:00
|
|
|
|
2023-05-09 21:04:58 +03:00
|
|
|
import { IReduxState } from '../../../app/types';
|
2023-04-03 13:49:19 +03:00
|
|
|
import { translate } from '../../../base/i18n/functions';
|
2023-05-09 12:10:46 +03:00
|
|
|
import ExpandedLabel, { IProps as AbstractProps } from '../../../base/label/components/native/ExpandedLabel';
|
2023-05-09 21:04:58 +03:00
|
|
|
import getUnsafeRoomText from '../../../base/util/getUnsafeRoomText.native';
|
2020-05-18 14:07:09 +02:00
|
|
|
|
|
|
|
|
import { INSECURE_ROOM_NAME_LABEL_COLOR } from './styles';
|
|
|
|
|
|
2023-05-09 21:04:58 +03:00
|
|
|
interface IProps extends AbstractProps, WithTranslation {
|
|
|
|
|
getUnsafeRoomTextFn: Function;
|
|
|
|
|
}
|
2020-05-18 14:07:09 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A react {@code Component} that implements an expanded label as tooltip-like
|
|
|
|
|
* component to explain the meaning of the {@code InsecureRoomNameExpandedLabel}.
|
|
|
|
|
*/
|
2023-05-09 21:04:58 +03:00
|
|
|
class InsecureRoomNameExpandedLabel extends ExpandedLabel<IProps> {
|
2020-05-18 14:07:09 +02:00
|
|
|
/**
|
|
|
|
|
* Returns the color this expanded label should be rendered with.
|
|
|
|
|
*
|
|
|
|
|
* @returns {string}
|
|
|
|
|
*/
|
|
|
|
|
_getColor() {
|
|
|
|
|
return INSECURE_ROOM_NAME_LABEL_COLOR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the label specific text of this {@code ExpandedLabel}.
|
|
|
|
|
*
|
|
|
|
|
* @returns {string}
|
|
|
|
|
*/
|
|
|
|
|
_getLabel() {
|
2023-05-09 21:04:58 +03:00
|
|
|
return this.props.getUnsafeRoomTextFn(this.props.t);
|
2020-05-18 14:07:09 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-09 21:04:58 +03:00
|
|
|
/**
|
|
|
|
|
* Maps part of the Redux state to the props of this component.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
|
* @returns {IProps}
|
|
|
|
|
*/
|
|
|
|
|
function _mapStateToProps(state: IReduxState) {
|
|
|
|
|
return {
|
|
|
|
|
getUnsafeRoomTextFn: (t: Function) => getUnsafeRoomText(state, t, 'meeting')
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default translate(connect(_mapStateToProps)(InsecureRoomNameExpandedLabel));
|