Browse Source

feat(native-participants-pane) implemented review remarks pt.4

master
Calin Chitu 4 years ago
parent
commit
b7389e1c31

+ 13
- 0
react/features/lobby/functions.js View File

9
 export function getLobbyState(state: any) {
9
 export function getLobbyState(state: any) {
10
     return state['features/lobby'];
10
     return state['features/lobby'];
11
 }
11
 }
12
+
13
+
14
+/**
15
+ * Selector to return lobby state.
16
+ *
17
+ * @param {any} state - State object.
18
+ * @returns {Array}
19
+ */
20
+export function getKnockingParticipantsById(state: any) {
21
+    const { knockingParticipants } = state['features/lobby'];
22
+
23
+    return knockingParticipants.map(participant => participant.id);
24
+}

+ 9
- 5
react/features/participants-pane/components/native/ContextMenuLobbyParticipantReject.js View File

4
 import { useTranslation } from 'react-i18next';
4
 import { useTranslation } from 'react-i18next';
5
 import { TouchableOpacity, View } from 'react-native';
5
 import { TouchableOpacity, View } from 'react-native';
6
 import { Divider, Text } from 'react-native-paper';
6
 import { Divider, Text } from 'react-native-paper';
7
-import { useDispatch } from 'react-redux';
7
+import { useDispatch, useSelector } from 'react-redux';
8
 
8
 
9
 import { Avatar } from '../../../base/avatar';
9
 import { Avatar } from '../../../base/avatar';
10
 import { hideDialog } from '../../../base/dialog';
10
 import { hideDialog } from '../../../base/dialog';
13
     Icon, IconClose
13
     Icon, IconClose
14
 } from '../../../base/icons';
14
 } from '../../../base/icons';
15
 import { setKnockingParticipantApproval } from '../../../lobby/actions.native';
15
 import { setKnockingParticipantApproval } from '../../../lobby/actions.native';
16
+import { getKnockingParticipantsById } from '../../../lobby/functions';
16
 
17
 
17
 import styles from './styles';
18
 import styles from './styles';
18
 type Props = {
19
 type Props = {
25
 
26
 
26
 export const ContextMenuLobbyParticipantReject = ({ participant: p }: Props) => {
27
 export const ContextMenuLobbyParticipantReject = ({ participant: p }: Props) => {
27
     const dispatch = useDispatch();
28
     const dispatch = useDispatch();
29
+    const knockParticipantsIDArr = useSelector(getKnockingParticipantsById);
30
+    const knockParticipantIsAvailable = knockParticipantsIDArr.find(knockPartId => knockPartId === p.id);
28
     const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
31
     const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
29
     const displayName = p.name;
32
     const displayName = p.name;
30
     const reject = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, false), [ dispatch ]));
33
     const reject = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, false), [ dispatch ]));
32
 
35
 
33
     return (
36
     return (
34
         <BottomSheet
37
         <BottomSheet
38
+            addScrollViewPadding = { false }
35
             onCancel = { cancel }
39
             onCancel = { cancel }
40
+            showSlidingView = { Boolean(knockParticipantIsAvailable) }
36
             style = { styles.contextMenuMore }>
41
             style = { styles.contextMenuMore }>
37
             <View
42
             <View
38
                 style = { styles.contextMenuItemSectionAvatar }>
43
                 style = { styles.contextMenuItemSectionAvatar }>
39
                 <Avatar
44
                 <Avatar
40
                     className = 'participant-avatar'
45
                     className = 'participant-avatar'
41
                     participantId = { p.id }
46
                     participantId = { p.id }
42
-                    size = { 30 } />
47
+                    size = { 20 } />
43
                 <View style = { styles.contextMenuItemAvatarText }>
48
                 <View style = { styles.contextMenuItemAvatarText }>
44
                     <Text style = { styles.contextMenuItemName }>
49
                     <Text style = { styles.contextMenuItemName }>
45
                         { displayName }
50
                         { displayName }
51
                 onPress = { reject }
56
                 onPress = { reject }
52
                 style = { styles.contextMenuItem }>
57
                 style = { styles.contextMenuItem }>
53
                 <Icon
58
                 <Icon
54
-                    size = { 24 }
55
-                    src = { IconClose }
56
-                    style = { styles.contextMenuItemIcon } />
59
+                    size = { 20 }
60
+                    src = { IconClose } />
57
                 <Text style = { styles.contextMenuItemText }>{ t('lobby.reject') }</Text>
61
                 <Text style = { styles.contextMenuItemText }>{ t('lobby.reject') }</Text>
58
             </TouchableOpacity>
62
             </TouchableOpacity>
59
         </BottomSheet>
63
         </BottomSheet>

+ 16
- 17
react/features/participants-pane/components/native/ContextMenuMeetingParticipantDetails.js View File

15
     IconMuteEveryoneElse, IconVideoOff
15
     IconMuteEveryoneElse, IconVideoOff
16
 } from '../../../base/icons';
16
 } from '../../../base/icons';
17
 import {
17
 import {
18
+    getParticipantsById,
18
     isLocalParticipantModerator
19
     isLocalParticipantModerator
19
 } from '../../../base/participants';
20
 } from '../../../base/participants';
20
 import { getIsParticipantVideoMuted } from '../../../base/tracks';
21
 import { getIsParticipantVideoMuted } from '../../../base/tracks';
39
 
40
 
40
 export const ContextMenuMeetingParticipantDetails = ({ participant: p }: Props) => {
41
 export const ContextMenuMeetingParticipantDetails = ({ participant: p }: Props) => {
41
     const dispatch = useDispatch();
42
     const dispatch = useDispatch();
43
+    const participantsIDArr = useSelector(getParticipantsById);
44
+    const participantIsAvailable = participantsIDArr.find(partId => partId === p.id);
42
     const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
45
     const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
43
     const displayName = p.name;
46
     const displayName = p.name;
44
     const isLocalModerator = useSelector(isLocalParticipantModerator);
47
     const isLocalModerator = useSelector(isLocalParticipantModerator);
45
     const isParticipantVideoMuted = useSelector(getIsParticipantVideoMuted(p));
48
     const isParticipantVideoMuted = useSelector(getIsParticipantVideoMuted(p));
46
-
47
     const kickRemoteParticipant = useCallback(() => {
49
     const kickRemoteParticipant = useCallback(() => {
48
         dispatch(openDialog(KickRemoteParticipantDialog, {
50
         dispatch(openDialog(KickRemoteParticipantDialog, {
49
             participantID: p.id
51
             participantID: p.id
73
 
75
 
74
     return (
76
     return (
75
         <BottomSheet
77
         <BottomSheet
78
+            addScrollViewPadding = { false }
76
             onCancel = { cancel }
79
             onCancel = { cancel }
80
+            showSlidingView = { Boolean(participantIsAvailable) }
77
             style = { styles.contextMenuMeetingParticipantDetails }>
81
             style = { styles.contextMenuMeetingParticipantDetails }>
78
             <View
82
             <View
79
                 style = { styles.contextMenuItemSectionAvatar }>
83
                 style = { styles.contextMenuItemSectionAvatar }>
80
                 <Avatar
84
                 <Avatar
81
                     className = 'participant-avatar'
85
                     className = 'participant-avatar'
82
                     participantId = { p.id }
86
                     participantId = { p.id }
83
-                    size = { 30 } />
87
+                    size = { 20 } />
84
                 <View style = { styles.contextMenuItemAvatarText }>
88
                 <View style = { styles.contextMenuItemAvatarText }>
85
                     <Text style = { styles.contextMenuItemName }>
89
                     <Text style = { styles.contextMenuItemName }>
86
                         { displayName }
90
                         { displayName }
94
                     onPress = { muteAudio }
98
                     onPress = { muteAudio }
95
                     style = { styles.contextMenuItem }>
99
                     style = { styles.contextMenuItem }>
96
                     <Icon
100
                     <Icon
97
-                        size = { 24 }
98
-                        src = { IconMicrophoneEmptySlash }
99
-                        style = { styles.contextMenuItemIcon } />
101
+                        size = { 20 }
102
+                        src = { IconMicrophoneEmptySlash } />
100
                     <Text style = { styles.contextMenuItemText }>
103
                     <Text style = { styles.contextMenuItemText }>
101
                         { t('participantsPane.actions.mute') }
104
                         { t('participantsPane.actions.mute') }
102
                     </Text>
105
                     </Text>
108
                     onPress = { muteEveryoneElse }
111
                     onPress = { muteEveryoneElse }
109
                     style = { styles.contextMenuItem }>
112
                     style = { styles.contextMenuItem }>
110
                     <Icon
113
                     <Icon
111
-                        size = { 24 }
112
-                        src = { IconMuteEveryoneElse }
113
-                        style = { styles.contextMenuItemIcon } />
114
+                        size = { 20 }
115
+                        src = { IconMuteEveryoneElse } />
114
                     <Text style = { styles.contextMenuItemText }>
116
                     <Text style = { styles.contextMenuItemText }>
115
                         { t('participantsPane.actions.muteEveryoneElse') }
117
                         { t('participantsPane.actions.muteEveryoneElse') }
116
                     </Text>
118
                     </Text>
124
                         onPress = { muteVideo }
126
                         onPress = { muteVideo }
125
                         style = { styles.contextMenuItemSection }>
127
                         style = { styles.contextMenuItemSection }>
126
                         <Icon
128
                         <Icon
127
-                            size = { 24 }
128
-                            src = { IconVideoOff }
129
-                            style = { styles.contextMenuItemIcon } />
129
+                            size = { 20 }
130
+                            src = { IconVideoOff } />
130
                         <Text style = { styles.contextMenuItemText }>
131
                         <Text style = { styles.contextMenuItemText }>
131
                             { t('participantsPane.actions.stopVideo') }
132
                             { t('participantsPane.actions.stopVideo') }
132
                         </Text>
133
                         </Text>
139
                     onPress = { kickRemoteParticipant }
140
                     onPress = { kickRemoteParticipant }
140
                     style = { styles.contextMenuItem }>
141
                     style = { styles.contextMenuItem }>
141
                     <Icon
142
                     <Icon
142
-                        size = { 24 }
143
-                        src = { IconCloseCircle }
144
-                        style = { styles.contextMenuItemIcon } />
143
+                        size = { 20 }
144
+                        src = { IconCloseCircle } />
145
                     <Text style = { styles.contextMenuItemText }>
145
                     <Text style = { styles.contextMenuItemText }>
146
                         { t('videothumbnail.kick') }
146
                         { t('videothumbnail.kick') }
147
                     </Text>
147
                     </Text>
151
                 onPress = { sendPrivateMessage }
151
                 onPress = { sendPrivateMessage }
152
                 style = { styles.contextMenuItem }>
152
                 style = { styles.contextMenuItem }>
153
                 <Icon
153
                 <Icon
154
-                    size = { 24 }
155
-                    src = { IconMessage }
156
-                    style = { styles.contextMenuItemIcon } />
154
+                    size = { 20 }
155
+                    src = { IconMessage } />
157
                 <Text style = { styles.contextMenuItemText }>
156
                 <Text style = { styles.contextMenuItemText }>
158
                     { t('toolbar.accessibilityLabel.privateMessage') }
157
                     { t('toolbar.accessibilityLabel.privateMessage') }
159
                 </Text>
158
                 </Text>

+ 11
- 3
react/features/participants-pane/components/native/ContextMenuMore.js View File

12
     Icon, IconMicDisabledHollow,
12
     Icon, IconMicDisabledHollow,
13
     IconVideoOff
13
     IconVideoOff
14
 } from '../../../base/icons';
14
 } from '../../../base/icons';
15
-import { getLocalParticipant } from '../../../base/participants';
15
+import {
16
+    getLocalParticipant,
17
+    getParticipantCount, isEveryoneModerator
18
+} from '../../../base/participants';
16
 import { BlockAudioVideoDialog } from '../../../video-menu';
19
 import { BlockAudioVideoDialog } from '../../../video-menu';
17
 import MuteEveryonesVideoDialog
20
 import MuteEveryonesVideoDialog
18
     from '../../../video-menu/components/native/MuteEveryonesVideoDialog';
21
     from '../../../video-menu/components/native/MuteEveryonesVideoDialog';
24
     const blockAudioVideo = useCallback(() => dispatch(openDialog(BlockAudioVideoDialog)), [ dispatch ]);
27
     const blockAudioVideo = useCallback(() => dispatch(openDialog(BlockAudioVideoDialog)), [ dispatch ]);
25
     const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
28
     const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
26
     const { id } = useSelector(getLocalParticipant);
29
     const { id } = useSelector(getLocalParticipant);
30
+    const everyoneModerator = useSelector(isEveryoneModerator);
31
+    const participantsCount = useSelector(getParticipantCount);
32
+    const showSlidingView = !everyoneModerator && participantsCount > 2;
27
     const muteAllVideo = useCallback(() =>
33
     const muteAllVideo = useCallback(() =>
28
         dispatch(openDialog(MuteEveryonesVideoDialog,
34
         dispatch(openDialog(MuteEveryonesVideoDialog,
29
             { exclude: [ id ] })),
35
             { exclude: [ id ] })),
32
 
38
 
33
     return (
39
     return (
34
         <BottomSheet
40
         <BottomSheet
41
+            addScrollViewPadding = { false }
35
             onCancel = { cancel }
42
             onCancel = { cancel }
43
+            showSlidingView = { showSlidingView }
36
             style = { styles.contextMenuMore }>
44
             style = { styles.contextMenuMore }>
37
             <TouchableOpacity
45
             <TouchableOpacity
38
                 onPress = { muteAllVideo }
46
                 onPress = { muteAllVideo }
39
                 style = { styles.contextMenuItem }>
47
                 style = { styles.contextMenuItem }>
40
                 <Icon
48
                 <Icon
41
-                    size = { 24 }
49
+                    size = { 20 }
42
                     src = { IconVideoOff } />
50
                     src = { IconVideoOff } />
43
                 <Text style = { styles.contextMenuItemText }>{t('participantsPane.actions.stopEveryonesVideo')}</Text>
51
                 <Text style = { styles.contextMenuItemText }>{t('participantsPane.actions.stopEveryonesVideo')}</Text>
44
             </TouchableOpacity>
52
             </TouchableOpacity>
46
                 onPress = { blockAudioVideo }
54
                 onPress = { blockAudioVideo }
47
                 style = { styles.contextMenuItem }>
55
                 style = { styles.contextMenuItem }>
48
                 <Icon
56
                 <Icon
49
-                    size = { 24 }
57
+                    size = { 20 }
50
                     src = { IconMicDisabledHollow }
58
                     src = { IconMicDisabledHollow }
51
                     style = { styles.contextMenuIcon } />
59
                     style = { styles.contextMenuIcon } />
52
                 <Text style = { styles.contextMenuItemText }>
60
                 <Text style = { styles.contextMenuItemText }>

+ 1
- 1
react/features/participants-pane/components/native/MeetingParticipantList.js View File

34
                     /* eslint-disable-next-line react/jsx-no-bind */
34
                     /* eslint-disable-next-line react/jsx-no-bind */
35
                     icon = { () =>
35
                     icon = { () =>
36
                         (<Icon
36
                         (<Icon
37
-                            size = { 24 }
37
+                            size = { 20 }
38
                             src = { IconInviteMore } />)
38
                             src = { IconInviteMore } />)
39
                     }
39
                     }
40
                     labelStyle = { styles.inviteLabel }
40
                     labelStyle = { styles.inviteLabel }

+ 2
- 2
react/features/participants-pane/components/native/ParticipantsPane.js View File

49
                     /* eslint-disable-next-line react/jsx-no-bind */
49
                     /* eslint-disable-next-line react/jsx-no-bind */
50
                     icon = { () =>
50
                     icon = { () =>
51
                         (<Icon
51
                         (<Icon
52
-                            size = { 24 }
52
+                            size = { 20 }
53
                             src = { IconClose } />)
53
                             src = { IconClose } />)
54
                     }
54
                     }
55
                     labelStyle = { styles.closeIcon }
55
                     labelStyle = { styles.closeIcon }
76
                             /* eslint-disable-next-line react/jsx-no-bind */
76
                             /* eslint-disable-next-line react/jsx-no-bind */
77
                             icon = { () =>
77
                             icon = { () =>
78
                                 (<Icon
78
                                 (<Icon
79
-                                    size = { 24 }
79
+                                    size = { 20 }
80
                                     src = { IconHorizontalPoints } />)
80
                                     src = { IconHorizontalPoints } />)
81
                             }
81
                             }
82
                             labelStyle = { styles.moreIcon }
82
                             labelStyle = { styles.moreIcon }

+ 14
- 21
react/features/participants-pane/components/native/styles.js View File

37
     backgroundColor: BaseTheme.palette.action02,
37
     backgroundColor: BaseTheme.palette.action02,
38
     borderRadius: BaseTheme.shape.borderRadius,
38
     borderRadius: BaseTheme.shape.borderRadius,
39
     display: 'flex',
39
     display: 'flex',
40
+    flexDirection: 'row',
41
+    justifyContent: 'center',
40
     minWidth: 0
42
     minWidth: 0
41
 };
43
 };
42
 
44
 
62
  */
64
  */
63
 const buttonContent = {
65
 const buttonContent = {
64
     ...BaseTheme.typography.labelButton,
66
     ...BaseTheme.typography.labelButton,
65
-    alignSelf: 'center',
67
+    alignContent: 'center',
66
     color: BaseTheme.palette.text01,
68
     color: BaseTheme.palette.text01,
69
+    display: 'flex',
67
     justifyContent: 'center'
70
     justifyContent: 'center'
68
 };
71
 };
69
 
72
 
71
  * The style of the context menu pane items.
74
  * The style of the context menu pane items.
72
  */
75
  */
73
 const contextMenuItem = {
76
 const contextMenuItem = {
77
+    alignItems: 'center',
78
+    display: 'flex',
74
     flexDirection: 'row',
79
     flexDirection: 'row',
75
-    paddingBottom: 16,
76
-    paddingTop: 16
80
+    height: BaseTheme.spacing[7],
81
+    marginLeft: BaseTheme.spacing[3],
82
+    marginTop: BaseTheme.spacing[2]
77
 };
83
 };
78
 
84
 
79
 /**
85
 /**
173
         backgroundColor: BaseTheme.palette.warning02,
179
         backgroundColor: BaseTheme.palette.warning02,
174
         borderRadius: BaseTheme.shape.borderRadius / 2,
180
         borderRadius: BaseTheme.shape.borderRadius / 2,
175
         height: BaseTheme.spacing[4],
181
         height: BaseTheme.spacing[4],
176
-        marginLeft: BaseTheme.spacing[1],
182
+        marginLeft: BaseTheme.spacing[2],
177
         width: BaseTheme.spacing[4]
183
         width: BaseTheme.spacing[4]
178
     },
184
     },
179
 
185
 
245
     closeIcon: {
251
     closeIcon: {
246
         ...buttonContent,
252
         ...buttonContent,
247
         height: BaseTheme.spacing[5],
253
         height: BaseTheme.spacing[5],
248
-        marginLeft: 'auto',
249
-        paddingTop: 12,
250
-        paddingBottom: 12,
251
-        paddingRight: BaseTheme.spacing[3],
252
-        paddingLeft: BaseTheme.spacing[3]
254
+        marginLeft: 'auto'
253
     },
255
     },
254
 
256
 
255
     inviteButton: {
257
     inviteButton: {
271
     moreIcon: {
273
     moreIcon: {
272
         ...buttonContent,
274
         ...buttonContent,
273
         height: BaseTheme.spacing[5],
275
         height: BaseTheme.spacing[5],
274
-        marginLeft: 'auto',
275
-        paddingTop: 12,
276
-        paddingBottom: 12,
277
-        paddingRight: BaseTheme.spacing[3],
278
-        paddingLeft: BaseTheme.spacing[3]
276
+        marginLeft: 'auto'
279
     },
277
     },
280
 
278
 
281
     contextMenuMore: {
279
     contextMenuMore: {
300
     muteAllLabel: {
298
     muteAllLabel: {
301
         ...BaseTheme.typography.labelButtonLarge,
299
         ...BaseTheme.typography.labelButtonLarge,
302
         color: BaseTheme.palette.text01,
300
         color: BaseTheme.palette.text01,
303
-        flexDirection: 'column',
304
         height: BaseTheme.spacing[7],
301
         height: BaseTheme.spacing[7],
305
         marginVertical: BaseTheme.spacing[0],
302
         marginVertical: BaseTheme.spacing[0],
306
         marginHorizontal: BaseTheme.spacing[0],
303
         marginHorizontal: BaseTheme.spacing[0],
322
 
319
 
323
     contextMenuItemSectionAvatar: {
320
     contextMenuItemSectionAvatar: {
324
         ...contextMenuItem,
321
         ...contextMenuItem,
325
-        marginLeft: BaseTheme.spacing[1]
322
+        marginLeft: BaseTheme.spacing[3]
326
     },
323
     },
327
 
324
 
328
     contextMenuItemAvatarText: {
325
     contextMenuItemAvatarText: {
329
         ...contextMenuItemText,
326
         ...contextMenuItemText,
330
-        marginLeft: BaseTheme.spacing[2]
327
+        marginLeft: BaseTheme.spacing[3]
331
     },
328
     },
332
 
329
 
333
     contextMenuItemText: {
330
     contextMenuItemText: {
335
         marginLeft: BaseTheme.spacing[3]
332
         marginLeft: BaseTheme.spacing[3]
336
     },
333
     },
337
 
334
 
338
-    contextMenuItemIcon: {
339
-        marginLeft: BaseTheme.spacing[1]
340
-    },
341
-
342
     contextMenuItemName: {
335
     contextMenuItemName: {
343
         ...BaseTheme.typography.bodyShortRegularLarge,
336
         ...BaseTheme.typography.bodyShortRegularLarge,
344
         color: BaseTheme.palette.text01
337
         color: BaseTheme.palette.text01

+ 2
- 3
react/features/video-menu/components/native/VolumeSlider.js View File

101
         return (
101
         return (
102
             <View style = { styles.volumeSliderContainer } >
102
             <View style = { styles.volumeSliderContainer } >
103
                 <Icon
103
                 <Icon
104
-                    size = { 24 }
105
-                    src = { IconVolumeEmpty }
106
-                    style = { styles.volumeIcon } />
104
+                    size = { 20 }
105
+                    src = { IconVolumeEmpty } />
107
                 <Slider
106
                 <Slider
108
                     maximumTrackTintColor = { palette.field02 }
107
                     maximumTrackTintColor = { palette.field02 }
109
                     maximumValue = { VOLUME_SLIDER_SCALE }
108
                     maximumValue = { VOLUME_SLIDER_SCALE }

+ 2
- 7
react/features/video-menu/components/native/styles.js View File

54
     volumeSliderContainer: {
54
     volumeSliderContainer: {
55
         alignItems: 'center',
55
         alignItems: 'center',
56
         flexDirection: 'row',
56
         flexDirection: 'row',
57
-        marginBottom: BaseTheme.spacing[3],
57
+        marginLeft: BaseTheme.spacing[3],
58
         marginTop: BaseTheme.spacing[3]
58
         marginTop: BaseTheme.spacing[3]
59
     },
59
     },
60
 
60
 
61
-    volumeIcon: {
62
-        marginLeft: BaseTheme.spacing[1],
63
-        minWidth: '5%'
64
-    },
65
-
66
     sliderContainer: {
61
     sliderContainer: {
67
         marginLeft: BaseTheme.spacing[3],
62
         marginLeft: BaseTheme.spacing[3],
68
-        minWidth: '90%'
63
+        minWidth: '84%'
69
     }
64
     }
70
 });
65
 });

Loading…
Cancel
Save