From 3ce29622ed7db9c7a66384f71ebc5134f6a9aa9b Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 26 Nov 2015 17:49:55 +0000 Subject: [PATCH] Move and merge MemberInfo to React SDK --- src/skins/vector/skindex.js | 2 +- .../vector/views/molecules/MemberInfo.js | 101 ------------------ .../vector/views/organisms/RightPanel.js | 2 +- src/skins/vector/views/pages/MatrixChat.js | 2 +- 4 files changed, 3 insertions(+), 104 deletions(-) delete mode 100644 src/skins/vector/views/molecules/MemberInfo.js diff --git a/src/skins/vector/skindex.js b/src/skins/vector/skindex.js index 31622830..ad990a66 100644 --- a/src/skins/vector/skindex.js +++ b/src/skins/vector/skindex.js @@ -39,6 +39,7 @@ skin['elements.EditableText'] = require('matrix-react-sdk/lib/components/views/e skin['elements.ProgressBar'] = require('matrix-react-sdk/lib/components/views/elements/ProgressBar'); skin['elements.UserSelector'] = require('matrix-react-sdk/lib/components/views/elements/UserSelector'); skin['messages.MessageComposer'] = require('matrix-react-sdk/lib/components/views/messages/MessageComposer'); +skin['rooms.MemberInfo'] = require('matrix-react-sdk/lib/components/views/rooms/MemberInfo'); skin['create_room.CreateRoomButton'] = require('matrix-react-sdk/lib/components/views/create_room/CreateRoomButton'); skin['create_room.Presets'] = require('matrix-react-sdk/lib/components/views/create_room/Presets'); skin['create_room.RoomAlias'] = require('matrix-react-sdk/lib/components/views/create_room/RoomAlias'); @@ -61,7 +62,6 @@ skin['molecules.MRoomMemberTile'] = require('./views/molecules/MRoomMemberTile') skin['molecules.MTextTile'] = require('./views/molecules/MTextTile'); skin['molecules.MVideoTile'] = require('./views/molecules/MVideoTile'); skin['molecules.MatrixToolbar'] = require('./views/molecules/MatrixToolbar'); -skin['molecules.MemberInfo'] = require('./views/molecules/MemberInfo'); skin['molecules.MemberTile'] = require('./views/molecules/MemberTile'); skin['molecules.MessageContextMenu'] = require('./views/molecules/MessageContextMenu'); skin['molecules.MessageTile'] = require('./views/molecules/MessageTile'); diff --git a/src/skins/vector/views/molecules/MemberInfo.js b/src/skins/vector/views/molecules/MemberInfo.js deleted file mode 100644 index 5a35410c..00000000 --- a/src/skins/vector/views/molecules/MemberInfo.js +++ /dev/null @@ -1,101 +0,0 @@ -/* -Copyright 2015 OpenMarket Ltd - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -'use strict'; - -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, spinner; - if (this.props.member.userId === MatrixClientPeg.get().credentials.userId) { - interactButton =
Leave room
; - } - else { - interactButton =
Start chat
; - } - - if (this.state.creatingRoom) { - var Loader = sdk.getComponent("elements.Spinner"); - spinner = ; - } - - if (this.state.can.kick) { - kickButton =
- Kick -
; - } - if (this.state.can.ban) { - banButton =
- Ban -
; - } - if (this.state.can.mute) { - var muteLabel = this.state.muted ? "Unmute" : "Mute"; - muteButton =
- {muteLabel} -
; - } - if (this.state.can.modifyLevel) { - var giveOpLabel = this.state.isTargetMod ? "Revoke Mod" : "Make Mod"; - giveModButton =
- {giveOpLabel} -
- } - - var MemberAvatar = sdk.getComponent('avatars.MemberAvatar'); - return ( -
- -
- -
-

{ this.props.member.name }

-
- { this.props.member.userId } -
-
- power: { this.props.member.powerLevelNorm }% -
-
- {interactButton} - {muteButton} - {kickButton} - {banButton} - {giveModButton} - {spinner} -
-
- ); - } -}); diff --git a/src/skins/vector/views/organisms/RightPanel.js b/src/skins/vector/views/organisms/RightPanel.js index feebcfeb..943624e6 100644 --- a/src/skins/vector/views/organisms/RightPanel.js +++ b/src/skins/vector/views/organisms/RightPanel.js @@ -137,7 +137,7 @@ module.exports = React.createClass({ panel = } else if(this.state.phase == this.Phase.MemberInfo) { - var MemberInfo = sdk.getComponent('molecules.MemberInfo'); + var MemberInfo = sdk.getComponent('rooms.MemberInfo'); panel = } } diff --git a/src/skins/vector/views/pages/MatrixChat.js b/src/skins/vector/views/pages/MatrixChat.js index 08336037..45e2ef20 100644 --- a/src/skins/vector/views/pages/MatrixChat.js +++ b/src/skins/vector/views/pages/MatrixChat.js @@ -56,7 +56,7 @@ module.exports = React.createClass({ onUserClick: function(event, userId) { event.preventDefault(); - var MemberInfo = sdk.getComponent('molecules.MemberInfo'); + var MemberInfo = sdk.getComponent('rooms.MemberInfo'); var member = new Matrix.RoomMember(null, userId); ContextualMenu.createMenu(MemberInfo, { member: member,