From cb30cbb09a8b3e50cfc26f3ba921aa98ab2557b2 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Mon, 30 Nov 2015 15:14:04 +0000 Subject: [PATCH] Remove MemberList and put it in react-sdk --- src/skins/vector/skindex.js | 2 +- .../vector/views/organisms/MemberList.js | 121 ------------------ .../vector/views/organisms/RightPanel.js | 2 +- 3 files changed, 2 insertions(+), 123 deletions(-) delete mode 100644 src/skins/vector/views/organisms/MemberList.js diff --git a/src/skins/vector/skindex.js b/src/skins/vector/skindex.js index d12d5fb7..87c9f86a 100644 --- a/src/skins/vector/skindex.js +++ b/src/skins/vector/skindex.js @@ -60,6 +60,7 @@ skin['rooms.MemberInfo'] = require('matrix-react-sdk/lib/components/views/rooms/ skin['rooms.RoomHeader'] = require('matrix-react-sdk/lib/components/views/rooms/RoomHeader'); skin['rooms.RoomSettings'] = require('matrix-react-sdk/lib/components/views/rooms/RoomSettings'); skin['rooms.MemberTile'] = require('matrix-react-sdk/lib/components/views/rooms/MemberTile'); +skin['rooms.MemberList'] = require('matrix-react-sdk/lib/components/views/rooms/MemberList'); 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'); @@ -87,7 +88,6 @@ skin['molecules.SearchBar'] = require('./views/molecules/SearchBar'); skin['molecules.SenderProfile'] = require('./views/molecules/SenderProfile'); skin['organisms.LeftPanel'] = require('./views/organisms/LeftPanel'); skin['organisms.LogoutPrompt'] = require('./views/organisms/LogoutPrompt'); -skin['organisms.MemberList'] = require('./views/organisms/MemberList'); skin['organisms.RightPanel'] = require('./views/organisms/RightPanel'); skin['organisms.RoomDirectory'] = require('./views/organisms/RoomDirectory'); skin['organisms.RoomList'] = require('./views/organisms/RoomList'); diff --git a/src/skins/vector/views/organisms/MemberList.js b/src/skins/vector/views/organisms/MemberList.js deleted file mode 100644 index a51c1348..00000000 --- a/src/skins/vector/views/organisms/MemberList.js +++ /dev/null @@ -1,121 +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 classNames = require('classnames'); - -var MemberListController = require('matrix-react-sdk/lib/controllers/organisms/MemberList') -var GeminiScrollbar = require('react-gemini-scrollbar'); - -var sdk = require('matrix-react-sdk') - - -module.exports = React.createClass({ - displayName: 'MemberList', - mixins: [MemberListController], - - getInitialState: function() { - }, - - memberSort: function(userIdA, userIdB) { - var userA = this.memberDict[userIdA].user; - var userB = this.memberDict[userIdB].user; - - var presenceMap = { - online: 3, - unavailable: 2, - offline: 1 - }; - - var presenceOrdA = userA ? presenceMap[userA.presence] : 0; - var presenceOrdB = userB ? presenceMap[userB.presence] : 0; - - if (presenceOrdA != presenceOrdB) { - return presenceOrdB - presenceOrdA; - } - - var latA = userA ? (userA.lastPresenceTs - (userA.lastActiveAgo || userA.lastPresenceTs)) : 0; - var latB = userB ? (userB.lastPresenceTs - (userB.lastActiveAgo || userB.lastPresenceTs)) : 0; - - return latB - latA; - }, - - makeMemberTiles: function(membership) { - var MemberTile = sdk.getComponent("rooms.MemberTile"); - - var self = this; - return self.state.members.filter(function(userId) { - var m = self.memberDict[userId]; - return m.membership == membership; - }).map(function(userId) { - var m = self.memberDict[userId]; - return ( - - ); - }); - }, - - onPopulateInvite: function(e) { - this.onInvite(this.refs.invite.value); - e.preventDefault(); - }, - - inviteTile: function() { - if (this.state.inviting) { - var Loader = sdk.getComponent("elements.Spinner"); - return ( - - ); - } else { - return ( -
- -
- ); - } - }, - - render: function() { - var invitedSection = null; - var invitedMemberTiles = this.makeMemberTiles('invite'); - if (invitedMemberTiles.length > 0) { - invitedSection = ( -
-

Invited

-
- {invitedMemberTiles} -
-
- ); - } - return ( -
- - {this.inviteTile()} -
-
- {this.makeMemberTiles('join')} -
-
- {invitedSection} -
-
- ); - } -}); - diff --git a/src/skins/vector/views/organisms/RightPanel.js b/src/skins/vector/views/organisms/RightPanel.js index 943624e6..67d9ab76 100644 --- a/src/skins/vector/views/organisms/RightPanel.js +++ b/src/skins/vector/views/organisms/RightPanel.js @@ -94,7 +94,7 @@ module.exports = React.createClass({ }, render: function() { - var MemberList = sdk.getComponent('organisms.MemberList'); + var MemberList = sdk.getComponent('rooms.MemberList'); var buttonGroup; var panel;