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, rn): add count badge to participants buttons (#13667)

Gabriel Borleafaea112f5e19
diff --git a/react/features/participants-pane/components/native/ParticipantsConter.tsx b/react/features/participants-pane/components/native/ParticipantsConter.tsx
new file mode 100644
index 0000000000..0fa1b13fdb
--- /dev/null
+++ b/react/features/participants-pane/components/native/ParticipantsConter.tsx
@@ -0,0 +1,15 @@
+import React from 'react';
+import { Text } from 'react-native';
+import { useSelector } from 'react-redux';
+
+import { getParticipantCount } from '../../../base/participants/functions';
+
+import styles from './styles';
+
+const ParticipantsCounter = () => {
+ const participantsCount = useSelector(getParticipantCount);
+
+ return <Text style = { styles.participantsBadge }>{participantsCount}</Text>;
+};
+
+export default ParticipantsCounter;
diff --git a/react/features/participants-pane/components/native/ParticipantsPaneButton.tsx b/react/features/participants-pane/components/native/ParticipantsPaneButton.tsx
index e644d04601..6c2ed2aaa2 100644
--- a/react/features/participants-pane/components/native/ParticipantsPaneButton.tsx
+++ b/react/features/participants-pane/components/native/ParticipantsPaneButton.tsx
@@ -1,3 +1,5 @@
+import React from 'react';
+import { View, ViewStyle } from 'react-native';
import { connect } from 'react-redux';
import { translate } from '../../../base/i18n/functions';
@@ -7,6 +9,9 @@ import { navigate }
from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
import { screen } from '../../../mobile/navigation/routes';
+import ParticipantsCounter from './ParticipantsConter';
+import styles from './styles';
+
/**
* Implements an {@link AbstractButton} to open the participants panel.
@@ -25,6 +30,22 @@ class ParticipantsPaneButton extends AbstractButton<AbstractButtonProps> {
_handleClick() {
return navigate(screen.conference.participants);
}
+
+ /**
+ * Overrides AbstractButton's {@link Component#render()}.
+ *
+ * @override
+ * @protected
+ * @returns {React$Node}
+ */
+ render() {
+ return (
+ <View style = { styles.participantsButtonBadge as ViewStyle }>
+ {super.render()}
+ <ParticipantsCounter />
+ </View>
+ );
+ }
}
export default translate(connect()(ParticipantsPaneButton));
diff --git a/react/features/participants-pane/components/native/styles.ts b/react/features/participants-pane/components/native/styles.ts
index 3dd6cb5979..0d7224e4f5 100644
--- a/react/features/participants-pane/components/native/styles.ts
+++ b/react/features/participants-pane/components/native/styles.ts
@@ -73,6 +73,26 @@ export default {
marginTop: 14
},
+ participantsBadge: {
+ backgroundColor: BaseTheme.palette.ui03,
+ borderRadius: BaseTheme.spacing[2],
+ borderColor: 'white',
+ overflow: 'hidden',
+ height: BaseTheme.spacing[3],
+ minWidth: BaseTheme.spacing[3],
+ color: BaseTheme.palette.text01,
+ ...BaseTheme.typography.labelBold,
+ position: 'absolute',
+ right: -3,
+ top: -3,
+ textAlign: 'center'
+ },
+
+ participantsButtonBadge: {
+ display: 'flex',
+ position: 'relative'
+ },
+
participantContainer: {
alignItems: 'center',
display: 'flex',