<commit_before>kd              = require 'kd'
React           = require 'kd-react'
ChatList        = require 'activity/components/chatlist'
ActivityFlux    = require 'activity/flux'
Scroller        = require 'app/components/scroller'
ScrollerMixin   = require 'app/components/scroller/scrollermixin'


module.exports = class ChatPane extends React.Component

  @defaultProps =
    title         : null
    messages      : null
    isDataLoading : no
    onLoadMore    : kd.noop
    showItemMenu  : yes


  componentWillUpdate: (nextProps, nextState) ->

    return  unless nextProps?.thread

    { thread } = nextProps
    isMessageBeingSubmitted = thread.getIn ['flags', 'isMessageBeingSubmitted']
    @shouldScrollToBottom = yes  if isMessageBeingSubmitted


  onTopThresholdReached: -> @props.onLoadMore()


  renderBody: ->

    return null  unless @props.messages

    <section className="ChatPane-body" ref="ChatPaneBody">
      <Scroller
        onTopThresholdReached={@bound 'onTopThresholdReached'}
        ref="scrollContainer">
        <ChatList
          isMessagesLoading={@props.thread?.getIn ['flags', 'isMessagesLoading']}
          firstPost={@props.thread.get 'message'}
          messages={@props.messages}
          showItemMenu={@props.showItemMenu}
          channelName={@props.thread.getIn ['channel', 'name']}
        />
      </Scroller>
    </section>


  render: ->
    <div className={kd.utils.curry 'ChatPane', @props.className}>
      <section className="ChatPane-contentWrapper">
        {@renderBody()}
        {@props.children}
      </section>
    </div>


React.Component.include.call ChatPane, [ScrollerMixin]

<commit_msg>Client: Activity: Updated componentWillUpdate event handler to set @isMessageBeingSubmitted prop<commit_after>kd              = require 'kd'
React           = require 'kd-react'
ChatList        = require 'activity/components/chatlist'
ActivityFlux    = require 'activity/flux'
Scroller        = require 'app/components/scroller'
ScrollerMixin   = require 'app/components/scroller/scrollermixin'


module.exports = class ChatPane extends React.Component

  @defaultProps =
    title         : null
    messages      : null
    isDataLoading : no
    onLoadMore    : kd.noop
    showItemMenu  : yes


  componentWillUpdate: (nextProps, nextState) ->

    return  unless nextProps?.thread

    { thread } = nextProps
    @isMessageBeingSubmitted = thread.getIn ['flags', 'isMessageBeingSubmitted']


  onTopThresholdReached: -> @props.onLoadMore()


  renderBody: ->

    return null  unless @props.messages

    <section className="ChatPane-body" ref="ChatPaneBody">
      <Scroller
        onTopThresholdReached={@bound 'onTopThresholdReached'}
        ref="scrollContainer">
        <ChatList
          isMessagesLoading={@props.thread?.getIn ['flags', 'isMessagesLoading']}
          firstPost={@props.thread.get 'message'}
          messages={@props.messages}
          showItemMenu={@props.showItemMenu}
          channelName={@props.thread.getIn ['channel', 'name']}
        />
      </Scroller>
    </section>


  render: ->
    <div className={kd.utils.curry 'ChatPane', @props.className}>
      <section className="ChatPane-contentWrapper">
        {@renderBody()}
        {@props.children}
      </section>
    </div>


React.Component.include.call ChatPane, [ScrollerMixin]


{'fraction_non_alphanumeric': 0.11483253588516747, 'fraction_numerical': 0.0, 'mean_word_length': 2.9445754716981134, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7584574', 'n_tokens_mistral': 986, 'n_tokens_neox': 948, 'n_words': 187}