diff --git a/src/components/login/Login.js b/src/components/structures/login/Login.js similarity index 96% rename from src/components/login/Login.js rename to src/components/structures/login/Login.js index 80d0314fca..3503fdba9f 100644 --- a/src/components/login/Login.js +++ b/src/components/structures/login/Login.js @@ -20,9 +20,9 @@ var React = require('react'); var ReactDOM = require('react-dom'); var sdk = require('matrix-react-sdk'); var Signup = require("matrix-react-sdk/lib/Signup"); -var PasswordLogin = require("matrix-react-sdk/lib/components/login/PasswordLogin"); -var CasLogin = require("matrix-react-sdk/lib/components/login/CasLogin"); -var ServerConfig = require("./ServerConfig"); +var PasswordLogin = require("matrix-react-sdk/lib/components/views/login/PasswordLogin"); +var CasLogin = require("matrix-react-sdk/lib/components/views/login/CasLogin"); +var ServerConfig = require("../../views/login/ServerConfig"); /** * A wire component which glues together login UI components and Signup logic diff --git a/src/components/login/PostRegistration.js b/src/components/structures/login/PostRegistration.js similarity index 100% rename from src/components/login/PostRegistration.js rename to src/components/structures/login/PostRegistration.js diff --git a/src/components/login/Registration.js b/src/components/structures/login/Registration.js similarity index 97% rename from src/components/login/Registration.js rename to src/components/structures/login/Registration.js index b06f9ffef5..7137582ce4 100644 --- a/src/components/login/Registration.js +++ b/src/components/structures/login/Registration.js @@ -21,9 +21,9 @@ var React = require('react'); var sdk = require('matrix-react-sdk'); var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); var dis = require('matrix-react-sdk/lib/dispatcher'); -var ServerConfig = require("./ServerConfig"); -var RegistrationForm = require("./RegistrationForm"); -var CaptchaForm = require("matrix-react-sdk/lib/components/login/CaptchaForm"); +var ServerConfig = require("../../views/login/ServerConfig"); +var RegistrationForm = require("../../views/login/RegistrationForm"); +var CaptchaForm = require("matrix-react-sdk/lib/components/views/login/CaptchaForm"); var Signup = require("matrix-react-sdk/lib/Signup"); var MIN_PASSWORD_LENGTH = 6; diff --git a/src/components/login/RegistrationForm.js b/src/components/views/login/RegistrationForm.js similarity index 100% rename from src/components/login/RegistrationForm.js rename to src/components/views/login/RegistrationForm.js diff --git a/src/components/login/ServerConfig.js b/src/components/views/login/ServerConfig.js similarity index 100% rename from src/components/login/ServerConfig.js rename to src/components/views/login/ServerConfig.js diff --git a/src/skins/vector/skindex.js b/src/skins/vector/skindex.js index 83a1284cbd..d558751b79 100644 --- a/src/skins/vector/skindex.js +++ b/src/skins/vector/skindex.js @@ -23,13 +23,15 @@ limitations under the License. var skin = {}; +// TODO: Fix this so matrix-react-sdk stuff is in react SDK. +skin['avatars.RoomAvatar'] = require('matrix-react-sdk/lib/components/views/avatars/RoomAvatar'); +skin['avatars.MemberAvatar'] = require('matrix-react-sdk/lib/components/views/avatars/MemberAvatar'); + skin['atoms.EditableText'] = require('./views/atoms/EditableText'); skin['atoms.EnableNotificationsButton'] = require('./views/atoms/EnableNotificationsButton'); skin['atoms.ImageView'] = require('./views/atoms/ImageView'); skin['atoms.LogoutButton'] = require('./views/atoms/LogoutButton'); -skin['atoms.MemberAvatar'] = require('./views/atoms/MemberAvatar'); skin['atoms.MessageTimestamp'] = require('./views/atoms/MessageTimestamp'); -skin['atoms.RoomAvatar'] = require('./views/atoms/RoomAvatar'); skin['atoms.Spinner'] = require('./views/atoms/Spinner'); skin['atoms.create_room.CreateRoomButton'] = require('./views/atoms/create_room/CreateRoomButton'); skin['atoms.create_room.Presets'] = require('./views/atoms/create_room/Presets'); diff --git a/src/skins/vector/views/atoms/MemberAvatar.js b/src/skins/vector/views/atoms/MemberAvatar.js deleted file mode 100644 index c719d70c59..0000000000 --- a/src/skins/vector/views/atoms/MemberAvatar.js +++ /dev/null @@ -1,71 +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 Avatar = require('../../../../Avatar'); - -var MemberAvatarController = require('matrix-react-sdk/lib/controllers/atoms/MemberAvatar') - -module.exports = React.createClass({ - displayName: 'MemberAvatar', - mixins: [MemberAvatarController], - - avatarUrlForMember: function(member) { - return Avatar.avatarUrlForMember( - member, - this.props.member, - this.props.width, - this.props.height, - this.props.resizeMethod - ); - }, - - skinnedDefaultAvatarUrl: function(member, width, height, resizeMethod) { - return Avatar.defaultAvatarUrlForString(member.userId); - }, - - render: function() { - // XXX: recalculates default avatar url constantly - if (this.state.imageUrl === this.defaultAvatarUrl(this.props.member)) { - var initial; - if (this.props.member.name[0]) - initial = this.props.member.name[0].toUpperCase(); - if (initial === '@' && this.props.member.name[1]) - initial = this.props.member.name[1].toUpperCase(); - - return ( - - - ); - } - return ( - - ); - } -}); diff --git a/src/skins/vector/views/atoms/RoomAvatar.js b/src/skins/vector/views/atoms/RoomAvatar.js deleted file mode 100644 index bdd28bad59..0000000000 --- a/src/skins/vector/views/atoms/RoomAvatar.js +++ /dev/null @@ -1,75 +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 RoomAvatarController = require('matrix-react-sdk/lib/controllers/atoms/RoomAvatar') - -module.exports = React.createClass({ - displayName: 'RoomAvatar', - mixins: [RoomAvatarController], - - getUrlList: function() { - return [ - this.roomAvatarUrl(), - this.getOneToOneAvatar(), - this.getFallbackAvatar() - ]; - }, - - getFallbackAvatar: function() { - var images = [ '76cfa6', '50e2c2', 'f4c371' ]; - var total = 0; - for (var i = 0; i < this.props.room.roomId.length; ++i) { - total += this.props.room.roomId.charCodeAt(i); - } - return 'img/' + images[total % images.length] + '.png'; - }, - - render: function() { - var style = { - width: this.props.width, - height: this.props.height, - }; - - // XXX: recalculates fallback avatar constantly - if (this.state.imageUrl === this.getFallbackAvatar()) { - var initial; - if (this.props.room.name[0]) - initial = this.props.room.name[0].toUpperCase(); - if ((initial === '@' || initial === '#') && this.props.room.name[1]) - initial = this.props.room.name[1].toUpperCase(); - - return ( - - - - - ); - } - else { - return - } - - } -}); diff --git a/src/skins/vector/views/molecules/ChangeAvatar.js b/src/skins/vector/views/molecules/ChangeAvatar.js index 7afac77fd5..dd5727e2de 100644 --- a/src/skins/vector/views/molecules/ChangeAvatar.js +++ b/src/skins/vector/views/molecules/ChangeAvatar.js @@ -37,7 +37,7 @@ module.exports = React.createClass({ }, render: function() { - var RoomAvatar = sdk.getComponent('atoms.RoomAvatar'); + var RoomAvatar = sdk.getComponent('avatars.RoomAvatar'); var avatarImg; // Having just set an avatar we just display that since it will take a little // time to propagate through to the RoomAvatar. diff --git a/src/skins/vector/views/molecules/EventTile.js b/src/skins/vector/views/molecules/EventTile.js index 236e7b1fd8..f3f8ae7096 100644 --- a/src/skins/vector/views/molecules/EventTile.js +++ b/src/skins/vector/views/molecules/EventTile.js @@ -109,7 +109,7 @@ module.exports = React.createClass({ return r2.data.ts - r1.data.ts; }); - var MemberAvatar = sdk.getComponent('atoms.MemberAvatar'); + var MemberAvatar = sdk.getComponent('avatars.MemberAvatar'); var left = 0; @@ -211,7 +211,7 @@ module.exports = React.createClass({ render: function() { var MessageTimestamp = sdk.getComponent('atoms.MessageTimestamp'); var SenderProfile = sdk.getComponent('molecules.SenderProfile'); - var MemberAvatar = sdk.getComponent('atoms.MemberAvatar'); + var MemberAvatar = sdk.getComponent('avatars.MemberAvatar'); var content = this.props.mxEvent.getContent(); var msgtype = content.msgtype; diff --git a/src/skins/vector/views/molecules/MRoomMemberTile.js b/src/skins/vector/views/molecules/MRoomMemberTile.js index 0048306d39..9dd51a5562 100644 --- a/src/skins/vector/views/molecules/MRoomMemberTile.js +++ b/src/skins/vector/views/molecules/MRoomMemberTile.js @@ -34,7 +34,7 @@ module.exports = React.createClass({ var text = this.getMemberEventText(); if (!text) return - -
; var MessageTimestamp = sdk.getComponent('atoms.MessageTimestamp'); - var MemberAvatar = sdk.getComponent('atoms.MemberAvatar'); + var MemberAvatar = sdk.getComponent('avatars.MemberAvatar'); return (