2015-06-12 16:59:33 +03:00
|
|
|
var React = require('react');
|
|
|
|
|
|
|
|
var MatrixClientPeg = require("../MatrixClientPeg");
|
|
|
|
|
|
|
|
var RoomTile = require("../molecules/RoomTile");
|
|
|
|
|
|
|
|
module.exports = React.createClass({
|
|
|
|
componentWillMount: function() {
|
|
|
|
var cli = MatrixClientPeg.get();
|
|
|
|
|
|
|
|
this.setState({roomList: cli.getRooms()});
|
|
|
|
},
|
|
|
|
|
|
|
|
makeRoomTiles: function() {
|
2015-06-12 19:34:17 +03:00
|
|
|
var that = this;
|
2015-06-12 16:59:33 +03:00
|
|
|
return this.state.roomList.map(function(room) {
|
2015-06-12 19:34:17 +03:00
|
|
|
var selected = room.roomId == that.props.selectedRoom;
|
2015-06-12 16:59:33 +03:00
|
|
|
return (
|
2015-06-12 19:34:17 +03:00
|
|
|
<RoomTile room={room} key={room.roomId} selected={selected} />
|
2015-06-12 16:59:33 +03:00
|
|
|
);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
|
|
|
return (
|
|
|
|
<div className="mx_RoomList">
|
|
|
|
<ul>
|
|
|
|
{this.makeRoomTiles()}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|