From 2a025201b1a5650c91242e828c9c45b0f13fdcaa Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 1 Dec 2015 11:19:54 +0000 Subject: [PATCH 1/3] Move remaining vector molecules to be components in vector (for now) --- .../structures}/BottomLeftMenu.js | 4 +- .../views/globals}/MatrixToolbar.js | 0 .../views/messages}/DateSeparator.js | 0 .../views/messages}/SenderProfile.js | 0 .../views/rooms}/BottomLeftMenuTile.js | 2 +- .../views/rooms}/MessageContextMenu.js | 0 .../views/rooms}/RoomDropTarget.js | 0 .../views/rooms}/RoomTooltip.js | 0 .../views/rooms}/SearchBar.js | 0 src/skins/vector/skindex.js | 20 +++++----- .../vector/views/molecules/RoomCreate.js | 38 ------------------- src/skins/vector/views/organisms/LeftPanel.js | 2 +- .../vector/views/organisms/RoomSubList.js | 2 +- 13 files changed, 15 insertions(+), 53 deletions(-) rename src/{skins/vector/views/molecules => components/structures}/BottomLeftMenu.js (92%) rename src/{skins/vector/views/molecules => components/views/globals}/MatrixToolbar.js (100%) rename src/{skins/vector/views/molecules => components/views/messages}/DateSeparator.js (100%) rename src/{skins/vector/views/molecules => components/views/messages}/SenderProfile.js (100%) rename src/{skins/vector/views/molecules => components/views/rooms}/BottomLeftMenuTile.js (95%) rename src/{skins/vector/views/molecules => components/views/rooms}/MessageContextMenu.js (100%) rename src/{skins/vector/views/molecules => components/views/rooms}/RoomDropTarget.js (100%) rename src/{skins/vector/views/molecules => components/views/rooms}/RoomTooltip.js (100%) rename src/{skins/vector/views/molecules => components/views/rooms}/SearchBar.js (100%) delete mode 100644 src/skins/vector/views/molecules/RoomCreate.js diff --git a/src/skins/vector/views/molecules/BottomLeftMenu.js b/src/components/structures/BottomLeftMenu.js similarity index 92% rename from src/skins/vector/views/molecules/BottomLeftMenu.js rename to src/components/structures/BottomLeftMenu.js index 2020d29d..f942efd5 100644 --- a/src/skins/vector/views/molecules/BottomLeftMenu.js +++ b/src/components/structures/BottomLeftMenu.js @@ -40,13 +40,13 @@ module.exports = React.createClass({ return
{name}
} else if (this.state.hover) { - var RoomTooltip = sdk.getComponent("molecules.RoomTooltip"); + var RoomTooltip = sdk.getComponent("rooms.RoomTooltip"); return ; } }, render: function() { - var BottomLeftMenuTile = sdk.getComponent('molecules.BottomLeftMenuTile'); + var BottomLeftMenuTile = sdk.getComponent('rooms.BottomLeftMenuTile'); return (
diff --git a/src/skins/vector/views/molecules/MatrixToolbar.js b/src/components/views/globals/MatrixToolbar.js similarity index 100% rename from src/skins/vector/views/molecules/MatrixToolbar.js rename to src/components/views/globals/MatrixToolbar.js diff --git a/src/skins/vector/views/molecules/DateSeparator.js b/src/components/views/messages/DateSeparator.js similarity index 100% rename from src/skins/vector/views/molecules/DateSeparator.js rename to src/components/views/messages/DateSeparator.js diff --git a/src/skins/vector/views/molecules/SenderProfile.js b/src/components/views/messages/SenderProfile.js similarity index 100% rename from src/skins/vector/views/molecules/SenderProfile.js rename to src/components/views/messages/SenderProfile.js diff --git a/src/skins/vector/views/molecules/BottomLeftMenuTile.js b/src/components/views/rooms/BottomLeftMenuTile.js similarity index 95% rename from src/skins/vector/views/molecules/BottomLeftMenuTile.js rename to src/components/views/rooms/BottomLeftMenuTile.js index 8c28058d..2535490f 100644 --- a/src/skins/vector/views/molecules/BottomLeftMenuTile.js +++ b/src/components/views/rooms/BottomLeftMenuTile.js @@ -41,7 +41,7 @@ module.exports = React.createClass({ label =
{ this.props.label }
; } else if (this.state.hover) { - var RoomTooltip = sdk.getComponent("molecules.RoomTooltip"); + var RoomTooltip = sdk.getComponent("rooms.RoomTooltip"); label = ; } diff --git a/src/skins/vector/views/molecules/MessageContextMenu.js b/src/components/views/rooms/MessageContextMenu.js similarity index 100% rename from src/skins/vector/views/molecules/MessageContextMenu.js rename to src/components/views/rooms/MessageContextMenu.js diff --git a/src/skins/vector/views/molecules/RoomDropTarget.js b/src/components/views/rooms/RoomDropTarget.js similarity index 100% rename from src/skins/vector/views/molecules/RoomDropTarget.js rename to src/components/views/rooms/RoomDropTarget.js diff --git a/src/skins/vector/views/molecules/RoomTooltip.js b/src/components/views/rooms/RoomTooltip.js similarity index 100% rename from src/skins/vector/views/molecules/RoomTooltip.js rename to src/components/views/rooms/RoomTooltip.js diff --git a/src/skins/vector/views/molecules/SearchBar.js b/src/components/views/rooms/SearchBar.js similarity index 100% rename from src/skins/vector/views/molecules/SearchBar.js rename to src/components/views/rooms/SearchBar.js diff --git a/src/skins/vector/skindex.js b/src/skins/vector/skindex.js index 53e94ebc..7fde8808 100644 --- a/src/skins/vector/skindex.js +++ b/src/skins/vector/skindex.js @@ -27,7 +27,16 @@ var skin = {}; skin['elements.Spinner'] = require('../../components/views/elements/Spinner'); skin['elements.ImageView'] = require('../../components/views/elements/ImageView'); skin['messages.MessageTimestamp'] = require('../../components/views/messages/MessageTimestamp'); +skin['messages.DateSeparator'] = require('../../components/views/messages/DateSeparator'); +skin['messages.SenderProfile'] = require('../../components/views//messages/SenderProfile'); skin['rooms.RoomTile'] = require('../../components/views/rooms/RoomDNDView'); +skin['rooms.BottomLeftMenuTile'] = require('../../components/views/rooms/BottomLeftMenuTile'); +skin['rooms.MessageContextMenu'] = require('../../components/views/rooms/MessageContextMenu'); +skin['rooms.RoomDropTarget'] = require('../../components/views/rooms/RoomDropTarget'); +skin['rooms.RoomTooltip'] = require('../../components/views/rooms/RoomTooltip'); +skin['rooms.SearchBar'] = require('../../components/views/rooms/SearchBar'); +skin['globals.MatrixToolbar'] = require('../../components/views/globals/MatrixToolbar'); +skin['structures.BottomLeftMenu'] = require('../../components/structures/BottomLeftMenu'); // TODO: Fix this so matrix-react-sdk stuff is in react SDK skindex? @@ -78,17 +87,8 @@ skin['structures.UserSettings'] = require('matrix-react-sdk/lib/components/struc skin['structures.RoomView'] = require('matrix-react-sdk/lib/components/structures/RoomView'); skin['structures.MatrixChat'] = require('matrix-react-sdk/lib/components/structures/MatrixChat'); + // Old style stuff - this stuff only exists in VECTOR -skin['molecules.BottomLeftMenu'] = require('./views/molecules/BottomLeftMenu'); -skin['molecules.BottomLeftMenuTile'] = require('./views/molecules/BottomLeftMenuTile'); -skin['molecules.DateSeparator'] = require('./views/molecules/DateSeparator'); -skin['molecules.MatrixToolbar'] = require('./views/molecules/MatrixToolbar'); -skin['molecules.MessageContextMenu'] = require('./views/molecules/MessageContextMenu'); -skin['molecules.RoomCreate'] = require('./views/molecules/RoomCreate'); -skin['molecules.RoomDropTarget'] = require('./views/molecules/RoomDropTarget'); -skin['molecules.RoomTooltip'] = require('./views/molecules/RoomTooltip'); -skin['molecules.SearchBar'] = require('./views/molecules/SearchBar'); -skin['molecules.SenderProfile'] = require('./views/molecules/SenderProfile'); skin['organisms.LeftPanel'] = require('./views/organisms/LeftPanel'); skin['organisms.RightPanel'] = require('./views/organisms/RightPanel'); skin['organisms.RoomDirectory'] = require('./views/organisms/RoomDirectory'); diff --git a/src/skins/vector/views/molecules/RoomCreate.js b/src/skins/vector/views/molecules/RoomCreate.js deleted file mode 100644 index d66e014d..00000000 --- a/src/skins/vector/views/molecules/RoomCreate.js +++ /dev/null @@ -1,38 +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'); - -module.exports = React.createClass({ - displayName: 'RoomCreate', - - render: function() { - return ( -
-
-
-
- -
-
Create new room
-
-
-
- ); - } -}); diff --git a/src/skins/vector/views/organisms/LeftPanel.js b/src/skins/vector/views/organisms/LeftPanel.js index 88688ab1..baa91e9f 100644 --- a/src/skins/vector/views/organisms/LeftPanel.js +++ b/src/skins/vector/views/organisms/LeftPanel.js @@ -86,7 +86,7 @@ var LeftPanel = React.createClass({ render: function() { var RoomList = sdk.getComponent('rooms.RoomList'); - var BottomLeftMenu = sdk.getComponent('molecules.BottomLeftMenu'); + var BottomLeftMenu = sdk.getComponent('structures.BottomLeftMenu'); var IncomingCallBox = sdk.getComponent('voip.IncomingCallBox'); var collapseButton; diff --git a/src/skins/vector/views/organisms/RoomSubList.js b/src/skins/vector/views/organisms/RoomSubList.js index 42016d43..8623787f 100644 --- a/src/skins/vector/views/organisms/RoomSubList.js +++ b/src/skins/vector/views/organisms/RoomSubList.js @@ -235,7 +235,7 @@ var RoomSubList = React.createClass({ render: function() { var connectDropTarget = this.props.connectDropTarget; - var RoomDropTarget = sdk.getComponent('molecules.RoomDropTarget'); + var RoomDropTarget = sdk.getComponent('rooms.RoomDropTarget'); var label = this.props.collapsed ? null : this.props.label; From e55e2bdd0d9bc97e622efa78c3fa7bc9d6d7d1e5 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 1 Dec 2015 11:22:19 +0000 Subject: [PATCH 2/3] Remove unused class --- src/skins/vector/views/organisms/Notifier.js | 98 -------------------- 1 file changed, 98 deletions(-) delete mode 100644 src/skins/vector/views/organisms/Notifier.js diff --git a/src/skins/vector/views/organisms/Notifier.js b/src/skins/vector/views/organisms/Notifier.js deleted file mode 100644 index 6ac353f1..00000000 --- a/src/skins/vector/views/organisms/Notifier.js +++ /dev/null @@ -1,98 +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 NotifierController = require('matrix-react-sdk/lib/controllers/organisms/Notifier') - -var TextForEvent = require('matrix-react-sdk/lib/TextForEvent'); -var extend = require('matrix-react-sdk/lib/extend'); -var dis = require('matrix-react-sdk/lib/dispatcher'); -var Avatar = require('matrix-react-sdk/lib/Avatar'); - -var NotifierView = { - notificationMessageForEvent: function(ev) { - return TextForEvent.textForEvent(ev); - }, - - displayNotification: function(ev, room) { - if (!global.Notification || global.Notification.permission != 'granted') { - return; - } - if (global.document.hasFocus()) { - return; - } - - var msg = this.notificationMessageForEvent(ev); - if (!msg) return; - - var title; - if (!ev.sender || room.name == ev.sender.name) { - title = room.name; - // notificationMessageForEvent includes sender, - // but we already have the sender here - if (ev.getContent().body) msg = ev.getContent().body; - } else if (ev.getType() == 'm.room.member') { - // context is all in the message here, we don't need - // to display sender info - title = room.name; - } else if (ev.sender) { - title = ev.sender.name + " (" + room.name + ")"; - // notificationMessageForEvent includes sender, - // but we've just out sender in the title - if (ev.getContent().body) msg = ev.getContent().body; - } - - var avatarUrl = ev.sender ? Avatar.avatarUrlForMember( - ev.sender, 40, 40, 'crop' - ) : null; - - var notification = new global.Notification( - title, - { - "body": msg, - "icon": avatarUrl, - "tag": "vector" - } - ); - - notification.onclick = function() { - dis.dispatch({ - action: 'view_room', - room_id: room.roomId - }); - global.focus(); - }; - - /*var audioClip; - - if (audioNotification) { - audioClip = playAudio(audioNotification); - }*/ - - global.setTimeout(function() { - notification.close(); - }, 5 * 1000); - - } -}; - -var NotifierClass = function() {}; -extend(NotifierClass.prototype, NotifierController); -extend(NotifierClass.prototype, NotifierView); - -module.exports = new NotifierClass(); - From 8083e7f118559cc3b23f3b0241e70f261866431c Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 1 Dec 2015 15:45:38 +0000 Subject: [PATCH 3/3] Move vector-only components to src/components. --- .../structures}/CompatibilityPage.js | 0 .../structures}/LeftPanel.js | 2 +- .../structures}/RightPanel.js | 0 .../structures}/RoomDirectory.js | 0 .../structures}/RoomSubList.js | 0 .../structures}/ViewSource.js | 0 src/components/views/rooms/MessageContextMenu.js | 2 +- src/skins/vector/skindex.js | 16 ++++++---------- src/vector/index.js | 2 +- 9 files changed, 9 insertions(+), 13 deletions(-) rename src/{skins/vector/views/pages => components/structures}/CompatibilityPage.js (100%) rename src/{skins/vector/views/organisms => components/structures}/LeftPanel.js (98%) rename src/{skins/vector/views/organisms => components/structures}/RightPanel.js (100%) rename src/{skins/vector/views/organisms => components/structures}/RoomDirectory.js (100%) rename src/{skins/vector/views/organisms => components/structures}/RoomSubList.js (100%) rename src/{skins/vector/views/organisms => components/structures}/ViewSource.js (100%) diff --git a/src/skins/vector/views/pages/CompatibilityPage.js b/src/components/structures/CompatibilityPage.js similarity index 100% rename from src/skins/vector/views/pages/CompatibilityPage.js rename to src/components/structures/CompatibilityPage.js diff --git a/src/skins/vector/views/organisms/LeftPanel.js b/src/components/structures/LeftPanel.js similarity index 98% rename from src/skins/vector/views/organisms/LeftPanel.js rename to src/components/structures/LeftPanel.js index baa91e9f..aaab8084 100644 --- a/src/skins/vector/views/organisms/LeftPanel.js +++ b/src/components/structures/LeftPanel.js @@ -22,7 +22,7 @@ var HTML5Backend = require('react-dnd-html5-backend'); var sdk = require('matrix-react-sdk') var dis = require('matrix-react-sdk/lib/dispatcher'); -var VectorConferenceHandler = require('../../../../VectorConferenceHandler'); +var VectorConferenceHandler = require('../../VectorConferenceHandler'); var CallHandler = require("matrix-react-sdk/lib/CallHandler"); var LeftPanel = React.createClass({ diff --git a/src/skins/vector/views/organisms/RightPanel.js b/src/components/structures/RightPanel.js similarity index 100% rename from src/skins/vector/views/organisms/RightPanel.js rename to src/components/structures/RightPanel.js diff --git a/src/skins/vector/views/organisms/RoomDirectory.js b/src/components/structures/RoomDirectory.js similarity index 100% rename from src/skins/vector/views/organisms/RoomDirectory.js rename to src/components/structures/RoomDirectory.js diff --git a/src/skins/vector/views/organisms/RoomSubList.js b/src/components/structures/RoomSubList.js similarity index 100% rename from src/skins/vector/views/organisms/RoomSubList.js rename to src/components/structures/RoomSubList.js diff --git a/src/skins/vector/views/organisms/ViewSource.js b/src/components/structures/ViewSource.js similarity index 100% rename from src/skins/vector/views/organisms/ViewSource.js rename to src/components/structures/ViewSource.js diff --git a/src/components/views/rooms/MessageContextMenu.js b/src/components/views/rooms/MessageContextMenu.js index 2aeac39c..c6100db2 100644 --- a/src/components/views/rooms/MessageContextMenu.js +++ b/src/components/views/rooms/MessageContextMenu.js @@ -33,7 +33,7 @@ module.exports = React.createClass({ }, onViewSourceClick: function() { - var ViewSource = sdk.getComponent('organisms.ViewSource'); + var ViewSource = sdk.getComponent('structures.ViewSource'); Modal.createDialog(ViewSource, { mxEvent: this.props.mxEvent }); diff --git a/src/skins/vector/skindex.js b/src/skins/vector/skindex.js index 7fde8808..d5b559c6 100644 --- a/src/skins/vector/skindex.js +++ b/src/skins/vector/skindex.js @@ -37,7 +37,12 @@ skin['rooms.RoomTooltip'] = require('../../components/views/rooms/RoomTooltip'); skin['rooms.SearchBar'] = require('../../components/views/rooms/SearchBar'); skin['globals.MatrixToolbar'] = require('../../components/views/globals/MatrixToolbar'); skin['structures.BottomLeftMenu'] = require('../../components/structures/BottomLeftMenu'); - +skin['structures.LeftPanel'] = require('../../components/structures/LeftPanel'); +skin['structures.RightPanel'] = require('../../components/structures/RightPanel'); +skin['structures.RoomDirectory'] = require('../../components/structures/RoomDirectory'); +skin['structures.RoomSubList'] = require('../../components/structures/RoomSubList'); +skin['structures.ViewSource'] = require('../../components/structures/ViewSource'); +skin['structures.CompatibilityPage'] = require('../../components/structures/CompatibilityPage'); // TODO: Fix this so matrix-react-sdk stuff is in react SDK skindex? skin['avatars.RoomAvatar'] = require('matrix-react-sdk/lib/components/views/avatars/RoomAvatar'); @@ -87,13 +92,4 @@ skin['structures.UserSettings'] = require('matrix-react-sdk/lib/components/struc skin['structures.RoomView'] = require('matrix-react-sdk/lib/components/structures/RoomView'); skin['structures.MatrixChat'] = require('matrix-react-sdk/lib/components/structures/MatrixChat'); - -// Old style stuff - this stuff only exists in VECTOR -skin['organisms.LeftPanel'] = require('./views/organisms/LeftPanel'); -skin['organisms.RightPanel'] = require('./views/organisms/RightPanel'); -skin['organisms.RoomDirectory'] = require('./views/organisms/RoomDirectory'); -skin['organisms.RoomSubList'] = require('./views/organisms/RoomSubList'); -skin['organisms.ViewSource'] = require('./views/organisms/ViewSource'); -skin['pages.CompatibilityPage'] = require('./views/pages/CompatibilityPage'); - module.exports = skin; diff --git a/src/vector/index.js b/src/vector/index.js index 082c5e11..00c22719 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -153,7 +153,7 @@ function loadApp() { else { console.error("Browser is missing required features."); // take to a different landing page to AWOOOOOGA at the user - var CompatibilityPage = require("../skins/vector/views/pages/CompatibilityPage"); + var CompatibilityPage = sdk.getComponent("structures.CompatibilityPage"); window.matrixChat = ReactDOM.render(