2018-10-30 05:02:23 +00:00
|
|
|
/* @flow */
|
|
|
|
|
2019-01-05 16:49:21 +00:00
|
|
|
import React from 'react';
|
2017-05-31 15:42:50 +00:00
|
|
|
|
2018-12-19 18:40:17 +00:00
|
|
|
import { translate } from '../../../base/i18n';
|
2022-11-08 10:24:32 +00:00
|
|
|
import { IconMicSlash } from '../../../base/icons';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2022-10-06 10:09:40 +00:00
|
|
|
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
|
2019-01-05 16:49:21 +00:00
|
|
|
import AbstractMuteButton, {
|
2022-09-27 07:10:28 +00:00
|
|
|
type Props,
|
|
|
|
_mapStateToProps
|
2019-01-05 16:49:21 +00:00
|
|
|
} from '../AbstractMuteButton';
|
2018-10-30 05:02:23 +00:00
|
|
|
|
|
|
|
|
2017-05-31 15:42:50 +00:00
|
|
|
/**
|
|
|
|
* Implements a React {@link Component} which displays a button for audio muting
|
|
|
|
* a participant in the conference.
|
|
|
|
*
|
2019-01-05 16:49:21 +00:00
|
|
|
* NOTE: At the time of writing this is a button that doesn't use the
|
|
|
|
* {@code AbstractButton} base component, but is inherited from the same
|
|
|
|
* super class ({@code AbstractMuteButton} that extends {@code AbstractButton})
|
|
|
|
* for the sake of code sharing between web and mobile. Once web uses the
|
|
|
|
* {@code AbstractButton} base component, this can be fully removed.
|
2017-05-31 15:42:50 +00:00
|
|
|
*/
|
2019-01-05 16:49:21 +00:00
|
|
|
class MuteButton extends AbstractMuteButton {
|
2017-08-14 15:02:58 +00:00
|
|
|
/**
|
2019-01-05 16:49:21 +00:00
|
|
|
* Instantiates a new {@code Component}.
|
2017-08-14 15:02:58 +00:00
|
|
|
*
|
2019-01-05 16:49:21 +00:00
|
|
|
* @inheritdoc
|
2017-08-14 15:02:58 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
constructor(props: Props) {
|
2017-08-14 15:02:58 +00:00
|
|
|
super(props);
|
|
|
|
|
2019-01-05 16:49:21 +00:00
|
|
|
this._handleClick = this._handleClick.bind(this);
|
2017-08-14 15:02:58 +00:00
|
|
|
}
|
|
|
|
|
2017-05-31 15:42:50 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2021-12-15 13:18:41 +00:00
|
|
|
const { _audioTrackMuted, t } = this.props;
|
|
|
|
|
|
|
|
if (_audioTrackMuted) {
|
|
|
|
return null;
|
|
|
|
}
|
2017-05-31 15:42:50 +00:00
|
|
|
|
|
|
|
return (
|
2021-12-15 13:18:41 +00:00
|
|
|
<ContextMenuItem
|
|
|
|
accessibilityLabel = { t('dialog.muteParticipantButton') }
|
|
|
|
className = 'mutelink'
|
2022-11-08 10:24:32 +00:00
|
|
|
icon = { IconMicSlash }
|
2019-01-05 16:49:21 +00:00
|
|
|
// eslint-disable-next-line react/jsx-handler-names
|
2021-12-15 13:18:41 +00:00
|
|
|
onClick = { this._handleClick }
|
|
|
|
text = { t('dialog.muteParticipantButton') } />
|
2017-05-31 15:42:50 +00:00
|
|
|
);
|
|
|
|
}
|
2017-08-14 15:02:58 +00:00
|
|
|
|
2021-11-04 21:10:43 +00:00
|
|
|
_handleClick: () => void;
|
2017-05-31 15:42:50 +00:00
|
|
|
}
|
|
|
|
|
2019-01-05 16:49:21 +00:00
|
|
|
export default translate(connect(_mapStateToProps)(MuteButton));
|