From f578bb1e48ec4d97bca92c7faf0dd8ed5aeceb39 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 1 Sep 2015 17:06:31 -0700 Subject: MM-2065 style refactoring --- web/react/components/more_direct_channels.jsx | 60 ++++++++++++++++++++------- 1 file changed, 46 insertions(+), 14 deletions(-) (limited to 'web/react/components/more_direct_channels.jsx') diff --git a/web/react/components/more_direct_channels.jsx b/web/react/components/more_direct_channels.jsx index 11ddbcbd1..5741f6e45 100644 --- a/web/react/components/more_direct_channels.jsx +++ b/web/react/components/more_direct_channels.jsx @@ -7,19 +7,22 @@ var Client = require('../utils/client.jsx'); var AsyncClient = require('../utils/async_client.jsx'); var utils = require('../utils/utils.jsx'); -module.exports = React.createClass({ - displayName: 'MoreDirectChannels', - componentDidMount: function() { +export default class MoreDirectChannels extends React.Component { + constructor(props) { + super(props); + + this.state = {channels: [], loadingDMChannel: -1}; + } + + componentDidMount() { var self = this; $(this.refs.modal.getDOMNode()).on('show.bs.modal', function showModal(e) { var button = e.relatedTarget; self.setState({channels: $(button).data('channels')}); }); - }, - getInitialState: function() { - return {channels: [], loadingDMChannel: -1}; - }, - render: function() { + } + + render() { var self = this; var directMessageItems = this.state.channels.map(function mapActivityToChannel(channel, index) { @@ -48,7 +51,12 @@ module.exports = React.createClass({ var otherUserId = utils.getUserIdFromChannelName(channel); if (self.state.loadingDMChannel === index) { - badge = ; + badge = ( + + ); } if (self.state.loadingDMChannel === -1) { @@ -73,16 +81,36 @@ module.exports = React.createClass({ } return ( -
  • {badge}{channel.display_name}
  • +
  • + {badge}{channel.display_name} +
  • ); }); return ( -