From 7fa8f7febcc552befe4399a8e3f2a6397d347016 Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Thu, 20 Aug 2015 12:04:36 -0700 Subject: Fixed issue with channel name in url and added loading icon to replace 'Join' button for slow connections --- web/react/components/more_channels.jsx | 34 +++++++++++++++++------- web/sass-files/sass/partials/_sidebar--left.scss | 14 +++++++--- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/web/react/components/more_channels.jsx b/web/react/components/more_channels.jsx index bc634ba55..2b2c8b68d 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 { var initState = getStateFromStores(); initState.channelType = ''; + initState.joiningChannel = -1; this.state = initState; } componentDidMount() { @@ -47,14 +48,17 @@ export default class MoreChannels extends React.Component { this.setState(newState); } } - handleJoin(id) { - client.joinChannel(id, - function joinSuccess(data) { + handleJoin(channel, channelIndex) { + this.setState({joiningChannel: channelIndex}); + client.joinChannel(channel.id, + function joinSuccess() { $(this.refs.modal.getDOMNode()).modal('hide'); - asyncClient.getChannel(id); - utils.switchChannel(data); + asyncClient.getChannel(channel.id); + utils.switchChannel(channel); + this.setState({joiningChannel: -1}); }.bind(this), function joinFail(err) { + this.setState({joiningChannel: -1}); this.state.serverError = err.message; this.setState(this.state); }.bind(this) @@ -79,7 +83,20 @@ export default class MoreChannels extends React.Component { moreChannels = ( - {channels.map(function cMap(channel) { + {channels.map(function cMap(channel, index) { + var joinButton; + if (self.state.joiningChannel === index) { + joinButton = (); + } else { + joinButton = (); + } + return ( ); diff --git a/web/sass-files/sass/partials/_sidebar--left.scss b/web/sass-files/sass/partials/_sidebar--left.scss index 6d9f2ad8b..7bbaa21cb 100644 --- a/web/sass-files/sass/partials/_sidebar--left.scss +++ b/web/sass-files/sass/partials/_sidebar--left.scss @@ -124,7 +124,15 @@ } .channel-loading-gif { - height:15px; - width:15px; - margin-top:2px; + height: 15px; + width: 15px; + margin-top: 2px; +} + +.join-channel-loading-gif { + margin-top: 5px; + margin-left: 10px; + height: 25px; + width: 25px; + } -- cgit v1.2.3-1-g7c22
@@ -87,10 +104,7 @@ export default class MoreChannels extends React.Component {

{channel.description}

- + {joinButton}