mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-14 12:27:51 +00:00
Move visible logic inside each button Move click functionality inside each button Extract getButtons function from Toolbox components to functions file
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { connect } from 'react-redux';
|
|
|
|
import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
|
|
import { sendAnalytics } from '../../../analytics/functions';
|
|
import { IReduxState } from '../../../app/types';
|
|
import { openDialog } from '../../../base/dialog/actions';
|
|
import { translate } from '../../../base/i18n/functions';
|
|
import { isSpeakerStatsDisabled } from '../../functions';
|
|
import AbstractSpeakerStatsButton from '../AbstractSpeakerStatsButton';
|
|
|
|
import SpeakerStats from './SpeakerStats';
|
|
|
|
|
|
/**
|
|
* Implementation of a button for opening speaker stats dialog.
|
|
*/
|
|
class SpeakerStatsButton extends AbstractSpeakerStatsButton {
|
|
|
|
/**
|
|
* Handles clicking / pressing the button, and opens the appropriate dialog.
|
|
*
|
|
* @protected
|
|
* @returns {void}
|
|
*/
|
|
_handleClick() {
|
|
const { dispatch } = this.props;
|
|
|
|
sendAnalytics(createToolbarEvent('speaker.stats'));
|
|
dispatch(openDialog(SpeakerStats));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Function that maps parts of Redux state tree into component props.
|
|
*
|
|
* @param {Object} state - Redux state.
|
|
* @returns {Object}
|
|
*/
|
|
const mapStateToProps = (state: IReduxState) => {
|
|
return {
|
|
visible: !isSpeakerStatsDisabled(state)
|
|
};
|
|
};
|
|
|
|
export default translate(connect(mapStateToProps)(SpeakerStatsButton));
|