From 91511281c55ac9b7d3d8ce21d409905c2aec1955 Mon Sep 17 00:00:00 2001
From: Reed Garmsen <rgarmsen2295@gmail.com>
Date: Tue, 7 Jul 2015 13:10:11 -0700
Subject: Changed loading logic for retrieving more channels to allow for
 loading animation to be inserted into the More... menu that allows you to
 join more channels while waiting for the list of channels to load

---
 web/react/components/more_channels.jsx | 53 +++++++++++++++++++++-------------
 1 file changed, 33 insertions(+), 20 deletions(-)

(limited to 'web/react/components/more_channels.jsx')

diff --git a/web/react/components/more_channels.jsx b/web/react/components/more_channels.jsx
index be2a5e93c..3cb83cec5 100644
--- a/web/react/components/more_channels.jsx
+++ b/web/react/components/more_channels.jsx
@@ -61,6 +61,10 @@ module.exports = React.createClass({
     render: function() {
         var server_error = this.state.server_error ? <div className='form-group has-error'><label className='control-label'>{ this.state.server_error }</label></div> : null;
         var outter = this;
+        var moreChannels;
+
+        if (this.state.channels != null)
+            moreChannels = this.state.channels;
 
         return (
             <div className="modal fade" id="more_channels" ref="modal" tabIndex="-1" role="dialog" aria-hidden="true">
@@ -75,27 +79,36 @@ module.exports = React.createClass({
                             <button data-toggle="modal" data-target="#new_channel" data-channeltype={this.state.channel_type} type="button" className="btn btn-primary channel-create-btn" onClick={this.handleNewChannel}>Create New Channel</button>
                         </div>
                         <div className="modal-body">
-                            {this.state.channels.length ?
-                                <table className="more-channel-table table">
-                                    <tbody>
-                                        {this.state.channels.map(function(channel) {
-                                            return (
-                                                <tr key={channel.id}>
-                                                    <td>
-                                                        <p className="more-channel-name">{channel.display_name}</p>
-                                                        <p className="more-channel-description">{channel.description}</p>
-                                                    </td>
-                                                    <td className="td--action"><button onClick={outter.handleJoin.bind(outter, channel.id)} className="pull-right btn btn-primary">Join</button></td>
-                                                </tr>
-                                            )
-                                        })}
-                                    </tbody>
-                                </table>
-                                :   <div className="no-channel-message">
-                                        <p className="primary-message">No more channels to join</p>
-                                        <p className="secondary-message">Click 'Create New Channel' to make a new one</p>
+                            {moreChannels ? 
+                                (moreChannels.length ?
+                                    <table className="more-channel-table table">
+                                        <tbody>
+                                            {this.state.channels.map(function(channel) {
+                                                return (
+                                                    <tr key={channel.id}>
+                                                        <td>
+                                                            <p className="more-channel-name">{channel.display_name}</p>
+                                                            <p className="more-channel-description">{channel.description}</p>
+                                                        </td>
+                                                        <td className="td--action"><button onClick={outter.handleJoin.bind(outter, channel.id)} className="pull-right btn btn-primary">Join</button></td>
+                                                    </tr>
+                                                )
+                                            })}
+                                        </tbody>
+                                    </table>
+                                    :   <div className="no-channel-message">
+                                            <p className="primary-message">No more channels to join</p>
+                                            <p className="secondary-message">Click 'Create New Channel' to make a new one</p>
+                                        </div>)
+                                :   <div ref="loadingscreen" className="channel-loading-message">
+                                        <div className="loading__content">
+                                        <h3>Loading</h3>
+                                            <div id="round_1" className="round"></div>
+                                            <div id="round_2" className="round"></div>
+                                            <div id="round_3" className="round"></div>
+                                        </div>
                                     </div>}
-                            { server_error }
+                                { server_error }
                         </div>
                         <div className="modal-footer">
                             <button type="button" className="btn btn-default" data-dismiss="modal">Close</button>
-- 
cgit v1.2.3-1-g7c22


From ff4b94f02b038bf754ba3fcb00b7dd2a421a2d71 Mon Sep 17 00:00:00 2001
From: Reed Garmsen <rgarmsen2295@gmail.com>
Date: Tue, 7 Jul 2015 13:18:10 -0700
Subject: Small changes and code clean-up

---
 web/react/components/more_channels.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'web/react/components/more_channels.jsx')

diff --git a/web/react/components/more_channels.jsx b/web/react/components/more_channels.jsx
index 3cb83cec5..dad0a644a 100644
--- a/web/react/components/more_channels.jsx
+++ b/web/react/components/more_channels.jsx
@@ -83,7 +83,7 @@ module.exports = React.createClass({
                                 (moreChannels.length ?
                                     <table className="more-channel-table table">
                                         <tbody>
-                                            {this.state.channels.map(function(channel) {
+                                            {moreChannels.map(function(channel) {
                                                 return (
                                                     <tr key={channel.id}>
                                                         <td>
@@ -108,7 +108,7 @@ module.exports = React.createClass({
                                             <div id="round_3" className="round"></div>
                                         </div>
                                     </div>}
-                                { server_error }
+                            { server_error }
                         </div>
                         <div className="modal-footer">
                             <button type="button" className="btn btn-default" data-dismiss="modal">Close</button>
-- 
cgit v1.2.3-1-g7c22

