Ver código fonte

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

master
Vlad Piersec 4 anos atrás
pai
commit
913d7e89dd

+ 1
- 0
lang/main.json Ver arquivo

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

+ 14
- 0
react/features/base/styles/functions.web.js Ver arquivo

24
 
24
 
25
     return style;
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 Ver arquivo

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
  * Action to set the knocking state of the participant.
149
  * Action to set the knocking state of the participant.
134
  *
150
  *
198
         dispatch(setKnockingState(true));
214
         dispatch(setKnockingState(true));
199
     };
215
     };
200
 }
216
 }
201
-

+ 38
- 4
react/features/participants-pane/components/LobbyParticipantList.js Ver arquivo

1
 // @flow
1
 // @flow
2
 
2
 
3
-import React from 'react';
3
+import { makeStyles } from '@material-ui/core/styles';
4
+import React, { useCallback } from 'react';
4
 import { useTranslation } from 'react-i18next';
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
 import { getLobbyState } from '../../lobby/functions';
10
 import { getLobbyState } from '../../lobby/functions';
8
 
11
 
9
 import { LobbyParticipantItem } from './LobbyParticipantItem';
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
 export const LobbyParticipantList = () => {
34
 export const LobbyParticipantList = () => {
13
     const {
35
     const {
15
         knockingParticipants: participants
37
         knockingParticipants: participants
16
     } = useSelector(getLobbyState);
38
     } = useSelector(getLobbyState);
17
     const { t } = useTranslation();
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
     if (!lobbyEnabled || !participants.length) {
46
     if (!lobbyEnabled || !participants.length) {
20
         return null;
47
         return null;
22
 
49
 
23
     return (
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
         <div>
60
         <div>
27
             {participants.map(p => (
61
             {participants.map(p => (
28
                 <LobbyParticipantItem
62
                 <LobbyParticipantItem

Carregando…
Cancelar
Salvar