/** @jsx React.DOM */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ /* global loop:true, React */ var loop = loop || {}; loop.roomViews = (function(mozL10n) { "use strict"; var DesktopRoomView = React.createClass({displayName: 'DesktopRoomView', mixins: [Backbone.Events, loop.shared.mixins.DocumentTitleMixin], propTypes: { mozLoop: React.PropTypes.object.isRequired, roomStore: React.PropTypes.instanceOf(loop.store.RoomStore).isRequired, }, getInitialState: function() { return this.props.roomStore.getStoreState(); }, componentWillMount: function() { this.listenTo(this.props.roomStore, "change:activeRoom", this._onActiveRoomStateChanged); }, /** * Handles a "change" event on the roomStore, and updates this.state * to match the store. * * @private */ _onActiveRoomStateChanged: function() { this.setState(this.props.roomStore.getStoreState("activeRoom")); }, componentWillUnmount: function() { this.stopListening(this.props.roomStore); }, render: function() { if (this.state.serverData && this.state.serverData.roomName) { this.setTitle(this.state.serverData.roomName); } return ( React.DOM.div({className: "goat"}) ); } }); return { DesktopRoomView: DesktopRoomView }; })(document.mozL10n || navigator.mozL10n);