From 450b2d4d67eaafb8efdd1ed7f0843a0dc4d754f5 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Mon, 30 Nov 2015 10:55:52 +0000 Subject: [PATCH] Move CreateRoom to react-sdk --- src/skins/vector/skindex.js | 4 +- .../vector/views/organisms/CreateRoom.js | 173 ------------------ src/skins/vector/views/pages/MatrixChat.js | 2 +- 3 files changed, 4 insertions(+), 175 deletions(-) delete mode 100644 src/skins/vector/views/organisms/CreateRoom.js diff --git a/src/skins/vector/skindex.js b/src/skins/vector/skindex.js index b4a8e11909..6137200f01 100644 --- a/src/skins/vector/skindex.js +++ b/src/skins/vector/skindex.js @@ -29,6 +29,9 @@ skin['elements.ImageView'] = require('../../components/views/elements/ImageView' skin['messages.MessageTimestamp'] = require('../../components/views/messages/MessageTimestamp'); skin['rooms.RoomTile'] = require('../../components/views/rooms/RoomDNDView'); + +skin['structures.CreateRoom'] = require('matrix-react-sdk/lib/components/structures/CreateRoom'); + // 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'); skin['avatars.MemberAvatar'] = require('matrix-react-sdk/lib/components/views/avatars/MemberAvatar'); @@ -82,7 +85,6 @@ 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.CreateRoom'] = require('./views/organisms/CreateRoom'); skin['organisms.ErrorDialog'] = require('./views/organisms/ErrorDialog'); skin['organisms.LeftPanel'] = require('./views/organisms/LeftPanel'); skin['organisms.LogoutPrompt'] = require('./views/organisms/LogoutPrompt'); diff --git a/src/skins/vector/views/organisms/CreateRoom.js b/src/skins/vector/views/organisms/CreateRoom.js deleted file mode 100644 index b40952bcc0..0000000000 --- a/src/skins/vector/views/organisms/CreateRoom.js +++ /dev/null @@ -1,173 +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 CreateRoomController = require('matrix-react-sdk/lib/controllers/organisms/CreateRoom') - -var sdk = require('matrix-react-sdk') - -var PresetValues = { - PrivateChat: "private_chat", - PublicChat: "public_chat", - Custom: "custom", -}; - -module.exports = React.createClass({ - displayName: 'CreateRoom', - mixins: [CreateRoomController], - - getPreset: function() { - return this.refs.presets.getPreset(); - }, - - getName: function() { - return this.refs.name_textbox.getName(); - }, - - getTopic: function() { - return this.refs.topic.getTopic(); - }, - - getAliasLocalpart: function() { - return this.refs.alias.getAliasLocalpart(); - }, - - getInvitedUsers: function() { - return this.refs.user_selector.getUserIds(); - }, - - onPresetChanged: function(preset) { - switch (preset) { - case PresetValues.PrivateChat: - this.setState({ - preset: preset, - is_private: true, - share_history: false, - }); - break; - case PresetValues.PublicChat: - this.setState({ - preset: preset, - is_private: false, - share_history: true, - }); - break; - case PresetValues.Custom: - this.setState({ - preset: preset, - }); - break; - } - }, - - onPrivateChanged: function(ev) { - this.setState({ - preset: PresetValues.Custom, - is_private: ev.target.checked, - }); - }, - - onShareHistoryChanged: function(ev) { - this.setState({ - preset: PresetValues.Custom, - share_history: ev.target.checked, - }); - }, - - onTopicChange: function(ev) { - this.setState({ - topic: ev.target.value, - }); - }, - - onNameChange: function(ev) { - this.setState({ - room_name: ev.target.value, - }); - }, - - onInviteChanged: function(invited_users) { - this.setState({ - invited_users: invited_users, - }); - }, - - onAliasChanged: function(alias) { - this.setState({ - alias: alias - }) - }, - - onEncryptChanged: function(ev) { - this.setState({ - encrypt: ev.target.checked, - }); - }, - - render: function() { - var curr_phase = this.state.phase; - if (curr_phase == this.phases.CREATING) { - var Loader = sdk.getComponent("elements.Spinner"); - return ( - - ); - } else { - var error_box = ""; - if (curr_phase == this.phases.ERROR) { - error_box = ( -
- An error occured: {this.state.error_string} -
- ); - } - - var CreateRoomButton = sdk.getComponent("create_room.CreateRoomButton"); - var RoomAlias = sdk.getComponent("create_room.RoomAlias"); - var Presets = sdk.getComponent("create_room.Presets"); - var UserSelector = sdk.getComponent("elements.UserSelector"); - var RoomHeader = sdk.getComponent("rooms.RoomHeader"); - - return ( -
- -
-
-