Skip to content

Commit f4d21f8

Browse files
committed
Add on a membership badge
1 parent a74cef0 commit f4d21f8

3 files changed

Lines changed: 30 additions & 5 deletions

File tree

‎src/skins/vector/css/organisms/MemberList.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ limitations under the License.
5252
color: #454545;
5353
margin-left: 3px;
5454
font-size: 16px;
55-
margin-bottom: 6px;
55+
margin-bottom: 8px;
5656
width: 180px;
5757
}
5858

‎src/skins/vector/css/organisms/RightPanel.css‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ limitations under the License.
5252
vertical-align: middle;
5353
padding-left: 8px;
5454
padding-right: 8px;
55+
position: relative;
5556
}
5657

5758
.mx_RightPanel_headerButton_highlight {
@@ -63,6 +64,20 @@ limitations under the License.
6364
background-color: #76cfa6;
6465
}
6566

67+
.mx_RightPanel_headerButton_badge {
68+
position: absolute;
69+
top: 5px;
70+
left: 21px;
71+
font-size: 12px;
72+
background-color: #76cfa6;
73+
color: #fff;
74+
font-weight: bold;
75+
border-radius: 20px;
76+
padding-left: 4px;
77+
padding-right: 4px;
78+
padding-top: 2px;
79+
}
80+
6681
.mx_RightPanel .mx_MemberList {
6782
-webkit-box-ordinal-group: 2;
6883
-moz-box-ordinal-group: 2;

‎src/skins/vector/views/organisms/RightPanel.js‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ limitations under the License.
1919
var React = require('react');
2020
var sdk = require('matrix-react-sdk')
2121
var dis = require('matrix-react-sdk/lib/dispatcher');
22+
var MatrixClientPeg = require("matrix-react-sdk/lib/MatrixClientPeg");
2223

2324
module.exports = React.createClass({
2425
displayName: 'RightPanel',
@@ -64,17 +65,26 @@ module.exports = React.createClass({
6465
}
6566
}
6667

68+
var membersBadge;
69+
if (this.state.phase == this.Phase.MemberList) {
70+
var cli = MatrixClientPeg.get();
71+
var room = cli.getRoom(this.props.roomId);
72+
// FIXME: presumably we need to subscribe to some event to refresh this count when it changes?
73+
membersBadge = <div className="mx_RightPanel_headerButton_badge">{ room.getJoinedMembers().length }</div>;
74+
}
75+
6776
if (this.props.roomId) {
6877
buttonGroup =
6978
<div className="mx_RightPanel_headerButtonGroup">
70-
<div className="mx_RightPanel_headerButton mx_RightPanel_filebutton">
71-
<img src="img/file.png" width="17" height="22" title="Files" alt="Files"/>
72-
{ filesHighlight }
73-
</div>
7479
<div className="mx_RightPanel_headerButton" onClick={ this.onMemberListButtonClick }>
7580
<img src="img/members.png" width="17" height="22" title="Members" alt="Members"/>
81+
{ membersBadge }
7682
{ membersHighlight }
7783
</div>
84+
<div className="mx_RightPanel_headerButton mx_RightPanel_filebutton">
85+
<img src="img/file.png" width="17" height="22" title="Files" alt="Files"/>
86+
{ filesHighlight }
87+
</div>
7888
</div>;
7989

8090
if (!this.props.collapsed && this.state.phase == this.Phase.MemberList) {

0 commit comments

Comments
 (0)