Add a tooltip to members button and badge with actual count

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/5929/head
Michael Telatynski 2018-01-05 23:16:21 +00:00
parent d6942a455d
commit 3788fde711
2 changed files with 7 additions and 5 deletions

View File

@ -266,6 +266,7 @@ module.exports = React.createClass({
let inviteGroup;
let membersBadge;
let membersTitle = _t('Members');
if ((this.state.phase == this.Phase.RoomMemberList || this.state.phase === this.Phase.RoomMemberInfo)
&& this.props.roomId
) {
@ -273,10 +274,10 @@ module.exports = React.createClass({
const room = cli.getRoom(this.props.roomId);
let userIsInRoom;
if (room) {
membersBadge = formatCount(room.getJoinedMembers().length);
userIsInRoom = room.hasMembershipState(
this.context.matrixClient.credentials.userId, 'join',
);
const numMembers = room.getJoinedMembers().length;
membersTitle = _t('%(numMembers)s Members', { numMembers });
membersBadge = <div title={membersTitle}>{ formatCount(numMembers) }</div>;
userIsInRoom = room.hasMembershipState(this.context.matrixClient.credentials.userId, 'join');
}
if (userIsInRoom) {
@ -298,7 +299,7 @@ module.exports = React.createClass({
let headerButtons = [];
if (this.props.roomId) {
headerButtons = [
<HeaderButton key="_membersButton" title={_t('Members')} iconSrc="img/icons-people.svg"
<HeaderButton key="_membersButton" title={membersTitle} iconSrc="img/icons-people.svg"
isHighlighted={[this.Phase.RoomMemberList, this.Phase.RoomMemberInfo].includes(this.state.phase)}
clickPhase={this.Phase.RoomMemberList}
badge={membersBadge}

View File

@ -158,6 +158,7 @@
"Register": "Register",
"Invite to this room": "Invite to this room",
"Members": "Members",
"%(numMembers)s Members": "%(numMembers)s Members",
"Files": "Files",
"Notifications": "Notifications",
"Rooms": "Rooms",