Bladeren bron

feat(participants-pane): Add 'admit all' knocking participants button

master
Vlad Piersec 4 jaren geleden
bovenliggende
commit
913d7e89dd

+ 1
- 0
lang/main.json Bestand weergeven

@@ -957,6 +957,7 @@
957 957
     },
958 958
     "lobby": {
959 959
         "admit": "Admit",
960
+        "admitAll": "Admit all",
960 961
         "knockingParticipantList": "Knocking participant list",
961 962
         "allow": "Allow",
962 963
         "backToKnockModeButton": "No password, ask to join instead",

+ 14
- 0
react/features/base/styles/functions.web.js Bestand weergeven

@@ -24,3 +24,17 @@ export function getFixedPlatformStyle(style: StyleType): StyleType {
24 24
 
25 25
     return style;
26 26
 }
27
+
28
+/**
29
+ * Sets the line height of a CSS Object group in pixels.
30
+ * By default lineHeight is unitless in CSS, but not in RN.
31
+ *
32
+ * @param {Object} base - The base object containing the `lineHeight` property.
33
+ * @returns {Object}
34
+ */
35
+export function withPixelLineHeight(base: Object): Object {
36
+    return {
37
+        ...base,
38
+        lineHeight: `${base.lineHeight}px`
39
+    };
40
+}

+ 16
- 1
react/features/lobby/actions.web.js Bestand weergeven

@@ -129,6 +129,22 @@ export function setKnockingParticipantApproval(id: string, approved: boolean) {
129 129
     };
130 130
 }
131 131
 
132
+/**
133
+ * Action used to admit multiple participants in the conference.
134
+ *
135
+ * @param {Array<Object>} participants - A list of knocking participants.
136
+ * @returns {void}
137
+ */
138
+export function admitMultiple(participants: Array<Object>) {
139
+    return (dispatch: Function, getState: Function) => {
140
+        const conference = getCurrentConference(getState);
141
+
142
+        participants.forEach(p => {
143
+            conference.lobbyApproveAccess(p.id);
144
+        });
145
+    };
146
+}
147
+
132 148
 /**
133 149
  * Action to set the knocking state of the participant.
134 150
  *
@@ -198,4 +214,3 @@ export function startKnocking() {
198 214
         dispatch(setKnockingState(true));
199 215
     };
200 216
 }
201
-

+ 38
- 4
react/features/participants-pane/components/LobbyParticipantList.js Bestand weergeven

@@ -1,13 +1,35 @@
1 1
 // @flow
2 2
 
3
-import React from 'react';
3
+import { makeStyles } from '@material-ui/core/styles';
4
+import React, { useCallback } from 'react';
4 5
 import { useTranslation } from 'react-i18next';
5
-import { useSelector } from 'react-redux';
6
+import { useSelector, useDispatch } from 'react-redux';
6 7
 
8
+import { withPixelLineHeight } from '../../base/styles/functions.web';
9
+import { admitMultiple } from '../../lobby/actions.web';
7 10
 import { getLobbyState } from '../../lobby/functions';
8 11
 
9 12
 import { LobbyParticipantItem } from './LobbyParticipantItem';
10
-import { Heading } from './styled';
13
+
14
+const useStyles = makeStyles(theme => {
15
+    return {
16
+        headingContainer: {
17
+            alignItems: 'center',
18
+            display: 'flex',
19
+            justifyContent: 'space-between'
20
+        },
21
+        heading: {
22
+            ...withPixelLineHeight(theme.typography.heading7),
23
+            color: theme.palette.text02
24
+        },
25
+        link: {
26
+            ...withPixelLineHeight(theme.typography.labelBold),
27
+            color: theme.palette.link01,
28
+            cursor: 'pointer'
29
+        }
30
+    };
31
+});
32
+
11 33
 
12 34
 export const LobbyParticipantList = () => {
13 35
     const {
@@ -15,6 +37,11 @@ export const LobbyParticipantList = () => {
15 37
         knockingParticipants: participants
16 38
     } = useSelector(getLobbyState);
17 39
     const { t } = useTranslation();
40
+    const classes = useStyles();
41
+    const dispatch = useDispatch();
42
+    const admitAll = useCallback(() => {
43
+        dispatch(admitMultiple(participants));
44
+    }, [ dispatch, participants ]);
18 45
 
19 46
     if (!lobbyEnabled || !participants.length) {
20 47
         return null;
@@ -22,7 +49,14 @@ export const LobbyParticipantList = () => {
22 49
 
23 50
     return (
24 51
     <>
25
-        <Heading>{t('participantsPane.headings.lobby', { count: participants.length })}</Heading>
52
+        <div className = { classes.headingContainer }>
53
+            <div className = { classes.heading }>
54
+                {t('participantsPane.headings.lobby', { count: participants.length })}
55
+            </div>
56
+            <div
57
+                className = { classes.link }
58
+                onClick = { admitAll }>{t('lobby.admitAll')}</div>
59
+        </div>
26 60
         <div>
27 61
             {participants.map(p => (
28 62
                 <LobbyParticipantItem

Laden…
Annuleren
Opslaan