Sfoglia il codice sorgente

feat(native-participants-pane) open/close pane native actions

master
Calin Chitu 4 anni fa
parent
commit
400f47963d

+ 26
- 0
react/features/participants-pane/actions.native.js Vedi File

1
 import { openDialog } from '../base/dialog';
1
 import { openDialog } from '../base/dialog';
2
 
2
 
3
+import { PARTICIPANTS_PANE_CLOSE, PARTICIPANTS_PANE_OPEN } from './actionTypes';
3
 import { ContextMenuLobbyParticipantReject, ContextMenuMeetingParticipantDetails } from './components/native';
4
 import { ContextMenuLobbyParticipantReject, ContextMenuMeetingParticipantDetails } from './components/native';
4
 
5
 
6
+
7
+/**
8
+ * Action to open the participants pane.
9
+ *
10
+ * @returns {Object}
11
+ */
12
+export function open() {
13
+    console.log(2);
14
+
15
+    return {
16
+        type: PARTICIPANTS_PANE_OPEN
17
+    };
18
+}
19
+
20
+/**
21
+ * Action to close the participants pane.
22
+ *
23
+ * @returns {Object}
24
+ */
25
+export function close() {
26
+    return {
27
+        type: PARTICIPANTS_PANE_CLOSE
28
+    };
29
+}
30
+
5
 /**
31
 /**
6
  * Displays the context menu for the selected lobby participant.
32
  * Displays the context menu for the selected lobby participant.
7
  *
33
  *

+ 36
- 5
react/features/participants-pane/components/native/ParticipantsPane.js Vedi File

4
 import { useTranslation } from 'react-i18next';
4
 import { useTranslation } from 'react-i18next';
5
 import { ScrollView, View } from 'react-native';
5
 import { ScrollView, View } from 'react-native';
6
 import { Button } from 'react-native-paper';
6
 import { Button } from 'react-native-paper';
7
-import { useDispatch, useSelector } from 'react-redux';
7
+import { useDispatch, useSelector, connect } from 'react-redux';
8
 
8
 
9
 import { hideDialog, openDialog } from '../../../base/dialog';
9
 import { hideDialog, openDialog } from '../../../base/dialog';
10
 import { Icon, IconClose, IconHorizontalPoints } from '../../../base/icons';
10
 import { Icon, IconClose, IconHorizontalPoints } from '../../../base/icons';
11
 import { JitsiModal } from '../../../base/modal';
11
 import { JitsiModal } from '../../../base/modal';
12
-import { isLocalParticipantModerator } from '../../../base/participants';
12
+import {
13
+    isLocalParticipantModerator
14
+} from '../../../base/participants';
13
 import MuteEveryoneDialog
15
 import MuteEveryoneDialog
14
     from '../../../video-menu/components/native/MuteEveryoneDialog';
16
     from '../../../video-menu/components/native/MuteEveryoneDialog';
17
+import { PARTICIPANTS_PANE_ID } from '../../constants';
15
 
18
 
16
 import { ContextMenuMore } from './ContextMenuMore';
19
 import { ContextMenuMore } from './ContextMenuMore';
17
 import { LobbyParticipantList } from './LobbyParticipantList';
20
 import { LobbyParticipantList } from './LobbyParticipantList';
18
 import { MeetingParticipantList } from './MeetingParticipantList';
21
 import { MeetingParticipantList } from './MeetingParticipantList';
19
 import styles from './styles';
22
 import styles from './styles';
20
 
23
 
24
+type Props = {
25
+
26
+    /**
27
+     * Is the participants pane open
28
+     */
29
+    _isOpen: boolean
30
+};
31
+
21
 /**
32
 /**
22
  * Participant pane.
33
  * Participant pane.
23
  *
34
  *
24
  * @returns {React$Element<any>}
35
  * @returns {React$Element<any>}
25
  */
36
  */
26
-function ParticipantsPane() {
37
+function ParticipantsPane({ _isOpen: paneOpen }: Props) {
27
     const dispatch = useDispatch();
38
     const dispatch = useDispatch();
28
     const openMoreMenu = useCallback(() => dispatch(openDialog(ContextMenuMore)), [ dispatch ]);
39
     const openMoreMenu = useCallback(() => dispatch(openDialog(ContextMenuMore)), [ dispatch ]);
29
     const closePane = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
40
     const closePane = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
33
     const { t } = useTranslation();
44
     const { t } = useTranslation();
34
 
45
 
35
     return (
46
     return (
36
-        <JitsiModal
47
+        paneOpen
48
+        && <JitsiModal
37
             hideHeaderWithNavigation = { true }
49
             hideHeaderWithNavigation = { true }
50
+            modalId = { PARTICIPANTS_PANE_ID }
38
             style = { styles.participantsPane }>
51
             style = { styles.participantsPane }>
39
             <View style = { styles.header }>
52
             <View style = { styles.header }>
40
                 <Button
53
                 <Button
80
     );
93
     );
81
 }
94
 }
82
 
95
 
96
+/**
97
+ * Maps (parts of) the redux state to {@link ParticipantsPane} React {@code Component}
98
+ * props.
99
+ *
100
+ * @param {Object} state - The redux store/state.
101
+ * @private
102
+ * @returns {{
103
+ *     _isOpen: boolean,
104
+ * }}
105
+ */
106
+function _mapStateToProps(state: Object) {
107
+    const { isOpen } = state['features/participants-pane'];
108
+
109
+    return {
110
+        _isOpen: isOpen
111
+    };
112
+}
113
+
83
 
114
 
84
-export default ParticipantsPane;
115
+export default connect(_mapStateToProps)(ParticipantsPane);

+ 2
- 4
react/features/participants-pane/components/native/ParticipantsPaneButton.js Vedi File

2
 
2
 
3
 import type { Dispatch } from 'redux';
3
 import type { Dispatch } from 'redux';
4
 
4
 
5
-import { openDialog } from '../../../base/dialog';
6
 import { translate } from '../../../base/i18n';
5
 import { translate } from '../../../base/i18n';
7
 import { IconParticipants } from '../../../base/icons';
6
 import { IconParticipants } from '../../../base/icons';
8
 import { connect } from '../../../base/redux';
7
 import { connect } from '../../../base/redux';
9
 import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
8
 import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
10
-
11
-import { ParticipantsPane } from './';
9
+import { open } from '../../actions.native';
12
 
10
 
13
 type Props = AbstractButtonProps & {
11
 type Props = AbstractButtonProps & {
14
 
12
 
34
      * @returns {void}
32
      * @returns {void}
35
      */
33
      */
36
     _handleClick() {
34
     _handleClick() {
37
-        this.props.dispatch(openDialog(ParticipantsPane));
35
+        this.props.dispatch(open());
38
     }
36
     }
39
 }
37
 }
40
 
38
 

+ 2
- 0
react/features/participants-pane/constants.js Vedi File

1
 // @flow
1
 // @flow
2
 
2
 
3
+export const PARTICIPANTS_PANE_ID = 'participantsPane';
4
+
3
 /**
5
 /**
4
  * Reducer key for the feature.
6
  * Reducer key for the feature.
5
  */
7
  */

Loading…
Annulla
Salva