|
@@ -1,19 +1,16 @@
|
1
|
|
-import Button from '@atlaskit/button';
|
2
|
1
|
import PropTypes from 'prop-types';
|
3
|
2
|
import React, { Component } from 'react';
|
4
|
3
|
import { connect } from 'react-redux';
|
5
|
4
|
|
6
|
5
|
import { translate } from '../../base/i18n';
|
7
|
6
|
import { getAvatarURL, getParticipants } from '../../base/participants';
|
8
|
|
-import { openInviteDialog } from '../../invite';
|
9
|
7
|
|
10
|
8
|
import ContactListItem from './ContactListItem';
|
11
|
9
|
|
12
|
10
|
declare var interfaceConfig: Object;
|
13
|
11
|
|
14
|
12
|
/**
|
15
|
|
- * React component for showing a list of current conference participants, the
|
16
|
|
- * current conference lock state, and a button to open the invite dialog.
|
|
13
|
+ * React component for showing a list of current conference participants.
|
17
|
14
|
*
|
18
|
15
|
* @extends Component
|
19
|
16
|
*/
|
|
@@ -24,20 +21,15 @@ class ContactListPanel extends Component {
|
24
|
21
|
* @static
|
25
|
22
|
*/
|
26
|
23
|
static propTypes = {
|
27
|
|
- /**
|
28
|
|
- * Whether or not the conference is currently locked with a password.
|
29
|
|
- */
|
30
|
|
- _locked: PropTypes.bool,
|
31
|
|
-
|
32
|
24
|
/**
|
33
|
25
|
* The participants to show in the contact list.
|
34
|
26
|
*/
|
35
|
27
|
_participants: PropTypes.array,
|
36
|
28
|
|
37
|
29
|
/**
|
38
|
|
- * Invoked to open an invite dialog.
|
|
30
|
+ * Whether or not participant avatars should be displayed.
|
39
|
31
|
*/
|
40
|
|
- dispatch: PropTypes.func,
|
|
32
|
+ _showAvatars: PropTypes.bool,
|
41
|
33
|
|
42
|
34
|
/**
|
43
|
35
|
* Invoked to obtain translated strings.
|
|
@@ -45,46 +37,18 @@ class ContactListPanel extends Component {
|
45
|
37
|
t: PropTypes.func
|
46
|
38
|
};
|
47
|
39
|
|
48
|
|
- /**
|
49
|
|
- * Initializes a new {@code ContactListPanel} instance.
|
50
|
|
- *
|
51
|
|
- * @param {Object} props - The read-only properties with which the new
|
52
|
|
- * instance is to be initialized.
|
53
|
|
- */
|
54
|
|
- constructor(props) {
|
55
|
|
- super(props);
|
56
|
|
-
|
57
|
|
- // Bind event handler so it is only bound once for every instance.
|
58
|
|
- this._onOpenInviteDialog = this._onOpenInviteDialog.bind(this);
|
59
|
|
- }
|
60
|
|
-
|
61
|
40
|
/**
|
62
|
41
|
* Implements React's {@link Component#render()}.
|
63
|
42
|
*
|
64
|
43
|
* @inheritdoc
|
65
|
44
|
*/
|
66
|
45
|
render() {
|
67
|
|
- const { _locked, _participants, t } = this.props;
|
|
46
|
+ const { _participants, t } = this.props;
|
68
|
47
|
|
69
|
48
|
return (
|
70
|
49
|
<div className = 'contact-list-panel'>
|
71
|
50
|
<div className = 'title'>
|
72
|
|
- { t('contactlist', { pcount: _participants.length }) }
|
73
|
|
- </div>
|
74
|
|
- <div className = 'sideToolbarBlock first'>
|
75
|
|
- <Button
|
76
|
|
- appearance = 'primary'
|
77
|
|
- className = 'contact-list-panel-invite-button'
|
78
|
|
- id = 'addParticipantsBtn'
|
79
|
|
- onClick = { this._onOpenInviteDialog }
|
80
|
|
- type = 'button'>
|
81
|
|
- { t('addParticipants') }
|
82
|
|
- </Button>
|
83
|
|
- <div>
|
84
|
|
- { _locked
|
85
|
|
- ? this._renderLockedMessage()
|
86
|
|
- : this._renderUnlockedMessage() }
|
87
|
|
- </div>
|
|
51
|
+ { t('contactlist', { count: _participants.length }) }
|
88
|
52
|
</div>
|
89
|
53
|
<ul id = 'contacts'>
|
90
|
54
|
{ this._renderContacts() }
|
|
@@ -93,16 +57,6 @@ class ContactListPanel extends Component {
|
93
|
57
|
);
|
94
|
58
|
}
|
95
|
59
|
|
96
|
|
- /**
|
97
|
|
- * Dispatches an action to open an invite dialog.
|
98
|
|
- *
|
99
|
|
- * @private
|
100
|
|
- * @returns {void}
|
101
|
|
- */
|
102
|
|
- _onOpenInviteDialog() {
|
103
|
|
- this.props.dispatch(openInviteDialog());
|
104
|
|
- }
|
105
|
|
-
|
106
|
60
|
/**
|
107
|
61
|
* Renders React Elements for displaying information about each participant
|
108
|
62
|
* in the contact list.
|
|
@@ -116,7 +70,7 @@ class ContactListPanel extends Component {
|
116
|
70
|
|
117
|
71
|
return (
|
118
|
72
|
<ContactListItem
|
119
|
|
- avatarURI = { interfaceConfig.SHOW_CONTACTLIST_AVATARS
|
|
73
|
+ avatarURI = { this.props._showAvatars
|
120
|
74
|
? getAvatarURL(participant) : null }
|
121
|
75
|
id = { id }
|
122
|
76
|
key = { id }
|
|
@@ -124,41 +78,6 @@ class ContactListPanel extends Component {
|
124
|
78
|
);
|
125
|
79
|
});
|
126
|
80
|
}
|
127
|
|
-
|
128
|
|
- /**
|
129
|
|
- * Renders a React Element for informing the conference is currently locked.
|
130
|
|
- *
|
131
|
|
- * @private
|
132
|
|
- * @returns {ReactElement}
|
133
|
|
- */
|
134
|
|
- _renderLockedMessage() {
|
135
|
|
- return (
|
136
|
|
- <p
|
137
|
|
- className = 'form-control__hint form-control_full-width'
|
138
|
|
- id = 'contactListroomLocked'>
|
139
|
|
- <span className = 'icon-security-locked' />
|
140
|
|
- <span>{ this.props.t('roomLocked') }</span>
|
141
|
|
- </p>
|
142
|
|
- );
|
143
|
|
- }
|
144
|
|
-
|
145
|
|
- /**
|
146
|
|
- * Renders a React Element for informing the conference is currently not
|
147
|
|
- * locked.
|
148
|
|
- *
|
149
|
|
- * @private
|
150
|
|
- * @returns {ReactElement}
|
151
|
|
- */
|
152
|
|
- _renderUnlockedMessage() {
|
153
|
|
- return (
|
154
|
|
- <p
|
155
|
|
- className = 'form-control__hint form-control_full-width'
|
156
|
|
- id = 'contactListroomUnlocked'>
|
157
|
|
- <span className = 'icon-security' />
|
158
|
|
- <span>{ this.props.t('roomUnlocked') }</span>
|
159
|
|
- </p>
|
160
|
|
- );
|
161
|
|
- }
|
162
|
81
|
}
|
163
|
82
|
|
164
|
83
|
/**
|
|
@@ -174,8 +93,8 @@ class ContactListPanel extends Component {
|
174
|
93
|
*/
|
175
|
94
|
function _mapStateToProps(state) {
|
176
|
95
|
return {
|
177
|
|
- _locked: state['features/base/conference'].locked,
|
178
|
|
- _participants: getParticipants(state)
|
|
96
|
+ _participants: getParticipants(state),
|
|
97
|
+ _showAvatars: interfaceConfig.SHOW_CONTACTLIST_AVATARS
|
179
|
98
|
};
|
180
|
99
|
}
|
181
|
100
|
|