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 - web/sass-files/sass/partials/_modal.scss | 20 +++++++-- 3 files changed, 55 insertions(+), 41 deletions(-) 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}) { tr { -- cgit v1.2.3-1-g7c22 From 41af72bff64217e39e082c5bc0cba37b0795b8ef Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Fri, 4 Mar 2016 14:37:04 -0500 Subject: Re-added max height to MoreChannels modal --- web/react/components/more_channels.jsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/web/react/components/more_channels.jsx b/web/react/components/more_channels.jsx index 577922577..d91a42b87 100644 --- a/web/react/components/more_channels.jsx +++ b/web/react/components/more_channels.jsx @@ -1,7 +1,7 @@ // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. -import * as utils from '../utils/utils.jsx'; +import * as Utils from '../utils/utils.jsx'; import * as client from '../utils/client.jsx'; import * as AsyncClient from '../utils/async_client.jsx'; import ChannelStore from '../stores/channel_store.jsx'; @@ -49,7 +49,7 @@ export default class MoreChannels extends React.Component { } onListenerChange() { var newState = getStateFromStores(); - if (!utils.areObjectsEqual(newState.channels, this.state.channels)) { + if (!Utils.areObjectsEqual(newState.channels, this.state.channels)) { this.setState(newState); } } @@ -59,7 +59,7 @@ export default class MoreChannels extends React.Component { () => { $(ReactDOM.findDOMNode(this.refs.modal)).modal('hide'); AsyncClient.getChannel(channel.id); - utils.switchChannel(channel); + Utils.switchChannel(channel); this.setState({joiningChannel: -1}); }, (err) => { @@ -109,6 +109,11 @@ export default class MoreChannels extends React.Component { ); } render() { + let maxHeight = 1000; + if (Utils.windowHeight() <= 1200) { + maxHeight = Utils.windowHeight() - 300; + } + var serverError; if (this.state.serverError) { serverError =
; @@ -195,7 +200,10 @@ export default class MoreChannels extends React.Component { onModalDismissed={() => this.setState({showNewChannelModal: false})} /> -
+
{moreChannels} {serverError}
-- cgit v1.2.3-1-g7c22 From c6fce25c7c7c67cf325367a8ed4dacc738582a26 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 7 Mar 2016 09:09:23 -0500 Subject: Fixed indentation in MoreChannels modal --- web/react/components/more_channels.jsx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/web/react/components/more_channels.jsx b/web/react/components/more_channels.jsx index d91a42b87..3309ef52e 100644 --- a/web/react/components/more_channels.jsx +++ b/web/react/components/more_channels.jsx @@ -136,18 +136,18 @@ export default class MoreChannels extends React.Component { } else { moreChannels = (
-

- -

-

- -

+

+ +

+

+ +

); } -- cgit v1.2.3-1-g7c22