diff --git a/app/javascripts/components/main.js b/app/javascripts/components/main.js index befa16b..9d5e1f9 100644 --- a/app/javascripts/components/main.js +++ b/app/javascripts/components/main.js @@ -178,6 +178,7 @@ const GatherPage = React.createClass({ soundController: new SoundController(), showMessageBox: true, collapseMenu: false, + chatContainerHeight: 500, connectionState: "connected" }; }, @@ -193,6 +194,9 @@ const GatherPage = React.createClass({ this.updateTitle(); + $(window).resize(_.debounce(this.reloadChatContainerHeight, 250)); + this.reloadChatContainerHeight(); + socket.on('stateChange', data => { let state = data.state; @@ -290,6 +294,13 @@ const GatherPage = React.createClass({ } }, + reloadChatContainerHeight() { + let chatContainer = document.getElementById("chat-container"); + if (chatContainer) { + this.setState({ chatContainerHeight: chatContainer.clientHeight }); + } + }, + toggleEventsPanel(event) { let newState = event.target.checked; this.setState({ showEventsPanel: newState }); @@ -390,7 +401,8 @@ const GatherPage = React.createClass({ ); chatroom = ; + user={this.state.user} socket={socket} + containerHeight={this.state.chatContainerHeight}/>; currentUser = (