summaryrefslogtreecommitdiffstats
path: root/web/react/components/more_channels.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-10-05 09:58:42 -0400
committerChristopher Speller <crspeller@gmail.com>2015-10-05 11:05:06 -0400
commit33b957ed1a8a44d4bed0f9c674d5602bad5028ea (patch)
treeeecee1a84d2da761345c244fa8078488a52eba94 /web/react/components/more_channels.jsx
parent515d709c2ef13b6ed7a3d04a7ad2fb2acbb0ec5d (diff)
downloadchat-33b957ed1a8a44d4bed0f9c674d5602bad5028ea.tar.gz
chat-33b957ed1a8a44d4bed0f9c674d5602bad5028ea.tar.bz2
chat-33b957ed1a8a44d4bed0f9c674d5602bad5028ea.zip
Disabling complexity warning. Allowing non-nested ternary. Upgrading ESList. Adding new ESLint rules. Fixing new ESLint errors.
Diffstat (limited to 'web/react/components/more_channels.jsx')
-rw-r--r--web/react/components/more_channels.jsx98
1 files changed, 47 insertions, 51 deletions
diff --git a/web/react/components/more_channels.jsx b/web/react/components/more_channels.jsx
index 65cd40975..487192d91 100644
--- a/web/react/components/more_channels.jsx
+++ b/web/react/components/more_channels.jsx
@@ -60,9 +60,7 @@ export default class MoreChannels extends React.Component {
this.setState({joiningChannel: -1});
}.bind(this),
function joinFail(err) {
- this.setState({joiningChannel: -1});
- this.state.serverError = err.message;
- this.setState(this.state);
+ this.setState({joiningChannel: -1, serverError: err.message});
}.bind(this)
);
}
@@ -81,56 +79,54 @@ export default class MoreChannels extends React.Component {
if (this.state.channels != null) {
var channels = this.state.channels;
- if (!channels.loading) {
- if (channels.length) {
- moreChannels = (
- <table className='more-channel-table table'>
- <tbody>
- {channels.map(function cMap(channel, index) {
- var joinButton;
- if (self.state.joiningChannel === index) {
- joinButton = (
- <img
- className='join-channel-loading-gif'
- src='/static/images/load.gif'
- />
- );
- } else {
- joinButton = (
- <button
- onClick={self.handleJoin.bind(self, channel, index)}
- className='btn btn-primary'
- >
- Join
- </button>
- );
- }
+ if (channels.loading) {
+ moreChannels = <LoadingScreen />;
+ } else if (channels.length) {
+ moreChannels = (
+ <table className='more-channel-table table'>
+ <tbody>
+ {channels.map(function cMap(channel, index) {
+ var joinButton;
+ if (self.state.joiningChannel === index) {
+ joinButton = (
+ <img
+ className='join-channel-loading-gif'
+ src='/static/images/load.gif'
+ />
+ );
+ } else {
+ joinButton = (
+ <button
+ onClick={self.handleJoin.bind(self, channel, index)}
+ className='btn btn-primary'
+ >
+ Join
+ </button>
+ );
+ }
- 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'>
- {joinButton}
- </td>
- </tr>
- );
- })}
- </tbody>
- </table>
- );
- } else {
- moreChannels = (
- <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>
- );
- }
+ 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'>
+ {joinButton}
+ </td>
+ </tr>
+ );
+ })}
+ </tbody>
+ </table>
+ );
} else {
- moreChannels = <LoadingScreen />;
+ moreChannels = (
+ <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>
+ );
}
}