jiti-meet/react/features/video-menu/components/web/MuteButton.js

65 lines
1.8 KiB
JavaScript
Raw Normal View History

/* @flow */
2019-01-05 16:49:21 +00:00
import React from 'react';
2018-12-19 18:40:17 +00:00
import { translate } from '../../../base/i18n';
import { IconMicSlash } from '../../../base/icons';
2019-03-21 16:38:29 +00:00
import { connect } from '../../../base/redux';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
2019-01-05 16:49:21 +00:00
import AbstractMuteButton, {
type Props,
_mapStateToProps
2019-01-05 16:49:21 +00:00
} from '../AbstractMuteButton';
/**
* 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.
*/
2019-01-05 16:49:21 +00:00
class MuteButton extends AbstractMuteButton {
/**
2019-01-05 16:49:21 +00:00
* Instantiates a new {@code Component}.
*
2019-01-05 16:49:21 +00:00
* @inheritdoc
*/
constructor(props: Props) {
super(props);
2019-01-05 16:49:21 +00:00
this._handleClick = this._handleClick.bind(this);
}
/**
* Implements React's {@link Component#render()}.
*
* @inheritdoc
* @returns {ReactElement}
*/
render() {
const { _audioTrackMuted, t } = this.props;
if (_audioTrackMuted) {
return null;
}
return (
<ContextMenuItem
accessibilityLabel = { t('dialog.muteParticipantButton') }
className = 'mutelink'
icon = { IconMicSlash }
2019-01-05 16:49:21 +00:00
// eslint-disable-next-line react/jsx-handler-names
onClick = { this._handleClick }
text = { t('dialog.muteParticipantButton') } />
);
}
2021-11-04 21:10:43 +00:00
_handleClick: () => void;
}
2019-01-05 16:49:21 +00:00
export default translate(connect(_mapStateToProps)(MuteButton));