mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-12 06:23:56 +03:00
delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
3788fde711
commit
c68c54618f
1 changed files with 27 additions and 31 deletions
|
@ -24,7 +24,7 @@ import sdk from 'matrix-react-sdk';
|
||||||
import dis from 'matrix-react-sdk/lib/dispatcher';
|
import dis from 'matrix-react-sdk/lib/dispatcher';
|
||||||
import { MatrixClient } from 'matrix-js-sdk';
|
import { MatrixClient } from 'matrix-js-sdk';
|
||||||
import Analytics from 'matrix-react-sdk/lib/Analytics';
|
import Analytics from 'matrix-react-sdk/lib/Analytics';
|
||||||
import rate_limited_func from 'matrix-react-sdk/lib/ratelimitedfunc';
|
import RateLimitedFunc from 'matrix-react-sdk/lib/ratelimitedfunc';
|
||||||
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
|
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
|
||||||
import { showGroupInviteDialog, showGroupAddRoomDialog } from 'matrix-react-sdk/lib/GroupAddressPicker';
|
import { showGroupInviteDialog, showGroupAddRoomDialog } from 'matrix-react-sdk/lib/GroupAddressPicker';
|
||||||
import GroupStoreCache from 'matrix-react-sdk/lib/stores/GroupStoreCache';
|
import GroupStoreCache from 'matrix-react-sdk/lib/stores/GroupStoreCache';
|
||||||
|
@ -58,8 +58,8 @@ class HeaderButton extends React.Component {
|
||||||
<div className="mx_RightPanel_headerButton_badge">
|
<div className="mx_RightPanel_headerButton_badge">
|
||||||
{ this.props.badge ? this.props.badge : <span> </span> }
|
{ this.props.badge ? this.props.badge : <span> </span> }
|
||||||
</div>
|
</div>
|
||||||
<TintableSvg src={this.props.iconSrc} width="25" height="25"/>
|
<TintableSvg src={this.props.iconSrc} width="25" height="25" />
|
||||||
{ this.props.isHighlighted ? <div className="mx_RightPanel_headerButton_highlight"></div> : <div/> }
|
{ this.props.isHighlighted ? <div className="mx_RightPanel_headerButton_highlight" /> : <div /> }
|
||||||
|
|
||||||
</AccessibleButton>;
|
</AccessibleButton>;
|
||||||
}
|
}
|
||||||
|
@ -184,18 +184,17 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
onRoomStateMember: function(ev, state, member) {
|
onRoomStateMember: function(ev, state, member) {
|
||||||
// redraw the badge on the membership list
|
// redraw the badge on the membership list
|
||||||
if (this.state.phase == this.Phase.RoomMemberList && member.roomId === this.props.roomId) {
|
if (this.state.phase === this.Phase.RoomMemberList && member.roomId === this.props.roomId) {
|
||||||
this._delayedUpdate();
|
this._delayedUpdate();
|
||||||
}
|
} else if (this.state.phase === this.Phase.RoomMemberInfo && member.roomId === this.props.roomId &&
|
||||||
else if (this.state.phase === this.Phase.RoomMemberInfo && member.roomId === this.props.roomId &&
|
|
||||||
member.userId === this.state.member.userId) {
|
member.userId === this.state.member.userId) {
|
||||||
// refresh the member info (e.g. new power level)
|
// refresh the member info (e.g. new power level)
|
||||||
this._delayedUpdate();
|
this._delayedUpdate();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_delayedUpdate: new rate_limited_func(function() {
|
_delayedUpdate: new RateLimitedFunc(function() {
|
||||||
this.forceUpdate();
|
this.forceUpdate(); // eslint-disable-line babel/no-invalid-this
|
||||||
}, 500),
|
}, 500),
|
||||||
|
|
||||||
onAction: function(payload) {
|
onAction: function(payload) {
|
||||||
|
@ -267,7 +266,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
let membersBadge;
|
let membersBadge;
|
||||||
let membersTitle = _t('Members');
|
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
|
||||||
) {
|
) {
|
||||||
const cli = this.context.matrixClient;
|
const cli = this.context.matrixClient;
|
||||||
|
@ -282,7 +281,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
if (userIsInRoom) {
|
if (userIsInRoom) {
|
||||||
inviteGroup =
|
inviteGroup =
|
||||||
<AccessibleButton className="mx_RightPanel_invite" onClick={ this.onInviteButtonClick } >
|
<AccessibleButton className="mx_RightPanel_invite" onClick={this.onInviteButtonClick}>
|
||||||
<div className="mx_RightPanel_icon" >
|
<div className="mx_RightPanel_icon" >
|
||||||
<TintableSvg src="img/icon-invite-people.svg" width="35" height="35" />
|
<TintableSvg src="img/icon-invite-people.svg" width="35" height="35" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -293,7 +292,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
const isPhaseGroup = [
|
const isPhaseGroup = [
|
||||||
this.Phase.GroupMemberInfo,
|
this.Phase.GroupMemberInfo,
|
||||||
this.Phase.GroupMemberList
|
this.Phase.GroupMemberList,
|
||||||
].includes(this.state.phase);
|
].includes(this.state.phase);
|
||||||
|
|
||||||
let headerButtons = [];
|
let headerButtons = [];
|
||||||
|
@ -337,54 +336,54 @@ module.exports = React.createClass({
|
||||||
// button on these 2 screens or you won't be able to re-expand the panel.
|
// button on these 2 screens or you won't be able to re-expand the panel.
|
||||||
headerButtons.push(
|
headerButtons.push(
|
||||||
<div className="mx_RightPanel_headerButton mx_RightPanel_collapsebutton" key="_minimizeButton"
|
<div className="mx_RightPanel_headerButton mx_RightPanel_collapsebutton" key="_minimizeButton"
|
||||||
title={ _t("Hide panel") } aria-label={ _t("Hide panel") } onClick={ this.onCollapseClick }
|
title={_t("Hide panel")} aria-label={_t("Hide panel")} onClick={this.onCollapseClick}
|
||||||
>
|
>
|
||||||
<TintableSvg src="img/minimise.svg" width="10" height="16"/>
|
<TintableSvg src="img/minimise.svg" width="10" height="16" />
|
||||||
</div>,
|
</div>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let panel = <div />;
|
let panel = <div />;
|
||||||
if (!this.props.collapsed) {
|
if (!this.props.collapsed) {
|
||||||
if (this.props.roomId && this.state.phase == this.Phase.RoomMemberList) {
|
if (this.props.roomId && this.state.phase === this.Phase.RoomMemberList) {
|
||||||
panel = <MemberList roomId={this.props.roomId} key={this.props.roomId} />;
|
panel = <MemberList roomId={this.props.roomId} key={this.props.roomId} />;
|
||||||
} else if (this.props.groupId && this.state.phase == this.Phase.GroupMemberList) {
|
} else if (this.props.groupId && this.state.phase === this.Phase.GroupMemberList) {
|
||||||
panel = <GroupMemberList groupId={this.props.groupId} key={this.props.groupId} />;
|
panel = <GroupMemberList groupId={this.props.groupId} key={this.props.groupId} />;
|
||||||
} else if (this.state.phase === this.Phase.GroupRoomList) {
|
} else if (this.state.phase === this.Phase.GroupRoomList) {
|
||||||
panel = <GroupRoomList groupId={this.props.groupId} key={this.props.groupId} />;
|
panel = <GroupRoomList groupId={this.props.groupId} key={this.props.groupId} />;
|
||||||
} else if (this.state.phase == this.Phase.RoomMemberInfo) {
|
} else if (this.state.phase === this.Phase.RoomMemberInfo) {
|
||||||
panel = <MemberInfo member={this.state.member} key={this.props.roomId || this.state.member.userId} />;
|
panel = <MemberInfo member={this.state.member} key={this.props.roomId || this.state.member.userId} />;
|
||||||
} else if (this.state.phase == this.Phase.GroupMemberInfo) {
|
} else if (this.state.phase === this.Phase.GroupMemberInfo) {
|
||||||
panel = <GroupMemberInfo
|
panel = <GroupMemberInfo
|
||||||
groupMember={this.state.member}
|
groupMember={this.state.member}
|
||||||
groupId={this.props.groupId}
|
groupId={this.props.groupId}
|
||||||
key={this.state.member.user_id} />;
|
key={this.state.member.user_id} />;
|
||||||
} else if (this.state.phase == this.Phase.GroupRoomInfo) {
|
} else if (this.state.phase === this.Phase.GroupRoomInfo) {
|
||||||
panel = <GroupRoomInfo
|
panel = <GroupRoomInfo
|
||||||
groupRoomId={this.state.groupRoomId}
|
groupRoomId={this.state.groupRoomId}
|
||||||
groupId={this.props.groupId}
|
groupId={this.props.groupId}
|
||||||
key={this.state.groupRoomId} />;
|
key={this.state.groupRoomId} />;
|
||||||
} else if (this.state.phase == this.Phase.NotificationPanel) {
|
} else if (this.state.phase === this.Phase.NotificationPanel) {
|
||||||
panel = <NotificationPanel />;
|
panel = <NotificationPanel />;
|
||||||
} else if (this.state.phase == this.Phase.FilePanel) {
|
} else if (this.state.phase === this.Phase.FilePanel) {
|
||||||
panel = <FilePanel roomId={this.props.roomId} />;
|
panel = <FilePanel roomId={this.props.roomId} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!panel) {
|
if (!panel) {
|
||||||
panel = <div className="mx_RightPanel_blank"></div>;
|
panel = <div className="mx_RightPanel_blank" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.groupId && this.state.isUserPrivilegedInGroup) {
|
if (this.props.groupId && this.state.isUserPrivilegedInGroup) {
|
||||||
inviteGroup = isPhaseGroup ? (
|
inviteGroup = isPhaseGroup ? (
|
||||||
<AccessibleButton className="mx_RightPanel_invite" onClick={ this.onInviteButtonClick } >
|
<AccessibleButton className="mx_RightPanel_invite" onClick={this.onInviteButtonClick}>
|
||||||
<div className="mx_RightPanel_icon" >
|
<div className="mx_RightPanel_icon" >
|
||||||
<TintableSvg src="img/icon-invite-people.svg" width="35" height="35" />
|
<TintableSvg src="img/icon-invite-people.svg" width="35" height="35" />
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_RightPanel_message">{ _t('Invite to this community') }</div>
|
<div className="mx_RightPanel_message">{ _t('Invite to this community') }</div>
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
) : (
|
) : (
|
||||||
<AccessibleButton className="mx_RightPanel_invite" onClick={ this.onInviteButtonClick } >
|
<AccessibleButton className="mx_RightPanel_invite" onClick={this.onInviteButtonClick}>
|
||||||
<div className="mx_RightPanel_icon" >
|
<div className="mx_RightPanel_icon" >
|
||||||
<TintableSvg src="img/icons-room-add.svg" width="35" height="35" />
|
<TintableSvg src="img/icons-room-add.svg" width="35" height="35" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -393,19 +392,16 @@ module.exports = React.createClass({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let classes = classNames(
|
const classes = classNames("mx_RightPanel", "mx_fadable", {
|
||||||
"mx_RightPanel", "mx_fadable",
|
"collapsed": this.props.collapsed,
|
||||||
{
|
"mx_fadable_faded": this.props.disabled,
|
||||||
"collapsed": this.props.collapsed,
|
});
|
||||||
"mx_fadable_faded": this.props.disabled,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside className={classes}>
|
<aside className={classes}>
|
||||||
<div className="mx_RightPanel_header">
|
<div className="mx_RightPanel_header">
|
||||||
<div className="mx_RightPanel_headerButtonGroup">
|
<div className="mx_RightPanel_headerButtonGroup">
|
||||||
{headerButtons}
|
{ headerButtons }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{ panel }
|
{ panel }
|
||||||
|
|
Loading…
Reference in a new issue