Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(participants-pane/native): updated accessibility label to match translations

Calin-Teodorae0024763234
diff --git a/react/features/participants-pane/components/native/ParticipantsPaneButton.tsx b/react/features/participants-pane/components/native/ParticipantsPaneButton.tsx
index 6c2ed2aaa2..d36bba9f9d 100644
--- a/react/features/participants-pane/components/native/ParticipantsPaneButton.tsx
+++ b/react/features/participants-pane/components/native/ParticipantsPaneButton.tsx
@@ -2,8 +2,10 @@ import React from 'react';
import { View, ViewStyle } from 'react-native';
import { connect } from 'react-redux';
+import { IReduxState } from '../../../app/types';
import { translate } from '../../../base/i18n/functions';
import { IconUsers } from '../../../base/icons/svg';
+import { getParticipantCount } from '../../../base/participants/functions';
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import { navigate }
from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
@@ -13,11 +15,21 @@ import ParticipantsCounter from './ParticipantsConter';
import styles from './styles';
+/**
+ * The type of the React {@code Component} props of {@link ParticipantsPaneButton}.
+ */
+interface IProps extends AbstractButtonProps {
+
+ /**
+ * Participants count.
+ */
+ _participantsCount: number;
+}
+
/**
* Implements an {@link AbstractButton} to open the participants panel.
*/
-class ParticipantsPaneButton extends AbstractButton<AbstractButtonProps> {
- accessibilityLabel = 'toolbar.accessibilityLabel.participants';
+class ParticipantsPaneButton extends AbstractButton<IProps> {
icon = IconUsers;
label = 'toolbar.participants';
@@ -31,21 +43,48 @@ class ParticipantsPaneButton extends AbstractButton<AbstractButtonProps> {
return navigate(screen.conference.participants);
}
+ /**
+ * Override the _getAccessibilityLabel method to incorporate the dynamic participant count.
+ *
+ * @override
+ * @returns {string}
+ */
+ _getAccessibilityLabel() {
+ const { t, _participantsCount } = this.props;
+
+ return t('toolbar.accessibilityLabel.participants', {
+ participantsCount: _participantsCount
+ });
+
+ }
+
/**
* Overrides AbstractButton's {@link Component#render()}.
*
* @override
* @protected
- * @returns {React$Node}
+ * @returns {React.ReactElement}
*/
render() {
return (
<View style = { styles.participantsButtonBadge as ViewStyle }>
- {super.render()}
+ { super.render() }
<ParticipantsCounter />
</View>
);
}
}
-export default translate(connect()(ParticipantsPaneButton));
+/**
+ * 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 {
+ _participantsCount: getParticipantCount(state)
+ };
+}
+
+export default translate(connect(mapStateToProps)(ParticipantsPaneButton));