diff --git a/src/skins/vector/css/molecules/MemberInfo.css b/src/skins/vector/css/molecules/MemberInfo.css index 52c48a79..31440e9e 100644 --- a/src/skins/vector/css/molecules/MemberInfo.css +++ b/src/skins/vector/css/molecules/MemberInfo.css @@ -14,3 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ +.mx_MemberInfo { + height: 100%; +} + +.mx_MemberInfo_cancel { + float: right; +} \ No newline at end of file diff --git a/src/skins/vector/css/organisms/RightPanel.css b/src/skins/vector/css/organisms/RightPanel.css index 85ed24d5..bf473a44 100644 --- a/src/skins/vector/css/organisms/RightPanel.css +++ b/src/skins/vector/css/organisms/RightPanel.css @@ -78,7 +78,8 @@ limitations under the License. padding-top: 2px; } -.mx_RightPanel .mx_MemberList { +.mx_RightPanel .mx_MemberList, +.mx_RightPanel .mx_MemberInfo { -webkit-box-ordinal-group: 2; -moz-box-ordinal-group: 2; -ms-flex-order: 2; diff --git a/src/skins/vector/views/molecules/MemberInfo.js b/src/skins/vector/views/molecules/MemberInfo.js index cc9a8f2d..030fb990 100644 --- a/src/skins/vector/views/molecules/MemberInfo.js +++ b/src/skins/vector/views/molecules/MemberInfo.js @@ -19,46 +19,66 @@ limitations under the License. var React = require('react'); var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); +var sdk = require('matrix-react-sdk') +var dis = require('matrix-react-sdk/lib/dispatcher'); var MemberInfoController = require('matrix-react-sdk/lib/controllers/molecules/MemberInfo') +// FIXME: this should probably be an organism, to match with MemberList, not a molecule + module.exports = React.createClass({ displayName: 'MemberInfo', mixins: [MemberInfoController], + onCancel: function(e) { + dis.dispatch({ + action: "view_user", + member: null + }); + }, + render: function() { var interactButton, kickButton, banButton, muteButton, giveModButton; if (this.props.member.userId === MatrixClientPeg.get().credentials.userId) { - interactButton =
Leave room
; + interactButton =
Leave room
; } else { - interactButton =
Start chat
; + interactButton =
Start chat
; } if (this.state.can.kick) { - kickButton =
+ kickButton =
Kick
; } if (this.state.can.ban) { - banButton =
+ banButton =
Ban
; } if (this.state.can.mute) { var muteLabel = this.state.muted ? "Unmute" : "Mute"; - muteButton =
+ muteButton =
{muteLabel}
; } if (this.state.can.modifyLevel) { var giveOpLabel = this.state.isTargetMod ? "Revoke Mod" : "Make Mod"; - giveModButton =
+ giveModButton =
{giveOpLabel}
} + var MemberAvatar = sdk.getComponent('atoms.MemberAvatar'); return ( -
+
+ +
+ +
+

{ this.props.member.name }

+
+ { this.props.member.userId } +
{interactButton} {muteButton} {kickButton} diff --git a/src/skins/vector/views/molecules/MemberTile.js b/src/skins/vector/views/molecules/MemberTile.js index 82facf6d..25ba3db9 100644 --- a/src/skins/vector/views/molecules/MemberTile.js +++ b/src/skins/vector/views/molecules/MemberTile.js @@ -20,7 +20,7 @@ var React = require('react'); var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); var sdk = require('matrix-react-sdk') -var ContextualMenu = require('../../../../ContextualMenu'); +var dis = require('matrix-react-sdk/lib/dispatcher'); var MemberTileController = require('matrix-react-sdk/lib/controllers/molecules/MemberTile') // The Lato WOFF doesn't include sensible combining diacritics, so Chrome chokes on rendering them. @@ -58,16 +58,9 @@ module.exports = React.createClass({ }, onClick: function(e) { - var self = this; - self.setState({ 'menu': true }); - var MemberInfo = sdk.getComponent('molecules.MemberInfo'); - ContextualMenu.createMenu(MemberInfo, { - member: self.props.member, - right: window.innerWidth - e.pageX, - top: e.pageY, - onFinished: function() { - self.setState({ 'menu': false }); - } + dis.dispatch({ + action: 'view_user', + member: this.props.member, }); }, @@ -134,7 +127,7 @@ module.exports = React.createClass({ } } mainClassName += presenceClass; - if (this.state.hover || this.state.menu) { + if (this.state.hover) { mainClassName += " mx_MemberTile_hover"; } @@ -148,7 +141,7 @@ module.exports = React.createClass({ } var nameEl; - if (this.state.hover || this.state.menu) { + if (this.state.hover) { var presence; // FIXME: make presence data update whenever User.presence changes... var active = this.props.member.user ? ((Date.now() - (this.props.member.user.lastPresenceTs - this.props.member.user.lastActiveAgo)) || -1) : -1; diff --git a/src/skins/vector/views/organisms/RightPanel.js b/src/skins/vector/views/organisms/RightPanel.js index bf104259..43e79327 100644 --- a/src/skins/vector/views/organisms/RightPanel.js +++ b/src/skins/vector/views/organisms/RightPanel.js @@ -27,14 +27,17 @@ module.exports = React.createClass({ Phase : { MemberList: 'MemberList', FileList: 'FileList', + MemberInfo: 'MemberInfo', }, componentWillMount: function() { + this.dispatcherRef = dis.register(this.onAction); var cli = MatrixClientPeg.get(); cli.on("RoomState.members", this.onRoomStateMember); }, componentWillUnmount: function() { + dis.unregister(this.dispatcherRef); if (MatrixClientPeg.get()) { MatrixClientPeg.get().removeListener("RoomState.members", this.onRoomStateMember); } @@ -67,6 +70,22 @@ module.exports = React.createClass({ } }, + onAction: function(payload) { + if (payload.action === "view_user") { + if (payload.member) { + this.setState({ + phase: this.Phase.MemberInfo, + member: payload.member, + }); + } + else { + this.setState({ + phase: this.Phase.MemberList + }); + } + } + }, + render: function() { var MemberList = sdk.getComponent('organisms.MemberList'); var buttonGroup; @@ -75,7 +94,7 @@ module.exports = React.createClass({ var filesHighlight; var membersHighlight; if (!this.props.collapsed) { - if (this.state.phase == this.Phase.MemberList) { + if (this.state.phase == this.Phase.MemberList || this.state.phase === this.Phase.MemberInfo) { membersHighlight =
; } else if (this.state.phase == this.Phase.FileList) { @@ -84,7 +103,7 @@ module.exports = React.createClass({ } var membersBadge; - if (this.state.phase == this.Phase.MemberList && this.props.roomId) { + if ((this.state.phase == this.Phase.MemberList || this.state.phase === this.Phase.MemberInfo) && this.props.roomId) { var cli = MatrixClientPeg.get(); var room = cli.getRoom(this.props.roomId); if (room) { @@ -106,9 +125,16 @@ module.exports = React.createClass({
; - if (!this.props.collapsed && this.state.phase == this.Phase.MemberList) { - panel = + if (!this.props.collapsed) { + if(this.state.phase == this.Phase.MemberList) { + panel = + } + else if(this.state.phase == this.Phase.MemberInfo) { + var MemberInfo = sdk.getComponent('molecules.MemberInfo'); + panel = + } } + } var classes = "mx_RightPanel";