From 04b59e1a3e13f1a2af8d45846a5a4884f3cfa5df Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Fri, 4 Mar 2016 14:33:11 -0500 Subject: Moved Join button to right side of MoreChannels modal --- web/react/components/more_channels.jsx | 75 ++++++++++++++++++---------------- web/react/components/user_list_row.jsx | 1 - 2 files changed, 39 insertions(+), 37 deletions(-) (limited to 'web/react') diff --git a/web/react/components/more_channels.jsx b/web/react/components/more_channels.jsx index db61e5f49..577922577 100644 --- a/web/react/components/more_channels.jsx +++ b/web/react/components/more_channels.jsx @@ -24,6 +24,7 @@ export default class MoreChannels extends React.Component { this.onListenerChange = this.onListenerChange.bind(this); this.handleJoin = this.handleJoin.bind(this); this.handleNewChannel = this.handleNewChannel.bind(this); + this.createChannelRow = this.createChannelRow.bind(this); var initState = getStateFromStores(); initState.channelType = ''; @@ -70,13 +71,49 @@ export default class MoreChannels extends React.Component { $(ReactDOM.findDOMNode(this.refs.modal)).modal('hide'); this.setState({showNewChannelModal: true}); } + createChannelRow(channel, index) { + let joinButton; + if (this.state.joiningChannel === index) { + joinButton = ( + + ); + } else { + joinButton = ( + + ); + } + + return ( + + +
+

{channel.display_name}

+

{channel.purpose}

+
+
+ {joinButton} +
+ + + ); + } render() { var serverError; if (this.state.serverError) { serverError =
; } - var self = this; var moreChannels; if (this.state.channels != null) { @@ -87,41 +124,7 @@ export default class MoreChannels extends React.Component { moreChannels = ( - {channels.map(function cMap(channel, index) { - var joinButton; - if (self.state.joiningChannel === index) { - joinButton = ( - - ); - } else { - joinButton = ( - - ); - } - - return ( - - - - - ); - })} + {channels.map(this.createChannelRow)}
-

{channel.display_name}

-

{channel.purpose}

-
- {joinButton} -
); diff --git a/web/react/components/user_list_row.jsx b/web/react/components/user_list_row.jsx index 2aeca7d47..68b723f35 100644 --- a/web/react/components/user_list_row.jsx +++ b/web/react/components/user_list_row.jsx @@ -28,7 +28,6 @@ export default function UserListRow({user, actions}) {