mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Add a tooltip to members button and badge with actual count
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
d6942a455d
commit
3788fde711
@ -266,6 +266,7 @@ module.exports = React.createClass({
|
|||||||
let inviteGroup;
|
let inviteGroup;
|
||||||
|
|
||||||
let membersBadge;
|
let membersBadge;
|
||||||
|
let membersTitle = _t('Members');
|
||||||
if ((this.state.phase == this.Phase.RoomMemberList || this.state.phase === this.Phase.RoomMemberInfo)
|
if ((this.state.phase == this.Phase.RoomMemberList || this.state.phase === this.Phase.RoomMemberInfo)
|
||||||
&& this.props.roomId
|
&& this.props.roomId
|
||||||
) {
|
) {
|
||||||
@ -273,10 +274,10 @@ module.exports = React.createClass({
|
|||||||
const room = cli.getRoom(this.props.roomId);
|
const room = cli.getRoom(this.props.roomId);
|
||||||
let userIsInRoom;
|
let userIsInRoom;
|
||||||
if (room) {
|
if (room) {
|
||||||
membersBadge = formatCount(room.getJoinedMembers().length);
|
const numMembers = room.getJoinedMembers().length;
|
||||||
userIsInRoom = room.hasMembershipState(
|
membersTitle = _t('%(numMembers)s Members', { numMembers });
|
||||||
this.context.matrixClient.credentials.userId, 'join',
|
membersBadge = <div title={membersTitle}>{ formatCount(numMembers) }</div>;
|
||||||
);
|
userIsInRoom = room.hasMembershipState(this.context.matrixClient.credentials.userId, 'join');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userIsInRoom) {
|
if (userIsInRoom) {
|
||||||
@ -298,7 +299,7 @@ module.exports = React.createClass({
|
|||||||
let headerButtons = [];
|
let headerButtons = [];
|
||||||
if (this.props.roomId) {
|
if (this.props.roomId) {
|
||||||
headerButtons = [
|
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)}
|
isHighlighted={[this.Phase.RoomMemberList, this.Phase.RoomMemberInfo].includes(this.state.phase)}
|
||||||
clickPhase={this.Phase.RoomMemberList}
|
clickPhase={this.Phase.RoomMemberList}
|
||||||
badge={membersBadge}
|
badge={membersBadge}
|
||||||
|
@ -158,6 +158,7 @@
|
|||||||
"Register": "Register",
|
"Register": "Register",
|
||||||
"Invite to this room": "Invite to this room",
|
"Invite to this room": "Invite to this room",
|
||||||
"Members": "Members",
|
"Members": "Members",
|
||||||
|
"%(numMembers)s Members": "%(numMembers)s Members",
|
||||||
"Files": "Files",
|
"Files": "Files",
|
||||||
"Notifications": "Notifications",
|
"Notifications": "Notifications",
|
||||||
"Rooms": "Rooms",
|
"Rooms": "Rooms",
|
||||||
|
Loading…
Reference in New Issue
Block a user