<commit_before>class Lanes.Components.NetworkActivityOverlay extends Lanes.React.Component

    propTypes:
        model:   Lanes.PropTypes.Model
        message: React.PropTypes.string
        timeout: React.PropTypes.number
        visible: React.PropTypes.bool
        errorTimeout: React.PropTypes.number

    getDefaultProps: ->
        timeout: 30000, errorTimeout: 2000

    removeMessage: ->
        return unless @isMounted()
        @setState(isRequesting: false, hasError: false)

    clearTimeout: ->
        clearTimeout(@state.removeHandler) if @state.removeHandler

    installRemoval: (state) ->
        @clearTimeout()
        @setState(removeHandler: _.delay(@removeMessage,
            if state.hasError then @props.errorTimeout else @props.timeout
        ))

    listenNetworkEvents: true

    setModelState: (state) ->
        if state.hasError or state.isRequesting
            @installRemoval(state)
        else if not @state.hasError
            @removeMessage()
        @setState(state)

    render: ->
        return null unless @props.visible or @state.isRequesting or @state.hasError
        message = @props.message or (
            if @state.hasError
                errorMsg = @model.errorMessage
                if errorMsg and _.isString(errorMsg) then errorMsg else "Error"
            else if @state.isRequesting is 'GET'
                'Loading…'
            else if _.includes(['PATCH', 'POST', 'PUT'], @state.isRequesting)
                'Saving…'
            else if @state.isRequesting is 'DELETE'
                'Deleting…'
            else
                'Pending…'
        )
        icon = if @state.hasError then 'exclamation-circle' else 'spinner'
        classes = _.classnames 'overlay', {rounded: @props.roundedCorners}
        <div className={classes}>
            <div className="mask" />
            <div className="message">
                <LC.Icon type={icon} animated={not @state.hasError} />
                {message}
            </div>
        </div>
<commit_msg>method has been renamed<commit_after>class Lanes.Components.NetworkActivityOverlay extends Lanes.React.Component

    propTypes:
        model:   Lanes.PropTypes.Model
        message: React.PropTypes.string
        timeout: React.PropTypes.number
        visible: React.PropTypes.bool
        errorTimeout: React.PropTypes.number

    getDefaultProps: ->
        timeout: 30000, errorTimeout: 2000

    removeMessage: ->
        return unless @isMounted()
        @setState(isRequesting: false, hasError: false)

    clearTimeout: ->
        clearTimeout(@state.removeHandler) if @state.removeHandler

    installRemoval: (state) ->
        @clearTimeout()
        @setState(removeHandler: _.delay(@removeMessage,
            if state.hasError then @props.errorTimeout else @props.timeout
        ))

    listenNetworkEvents: true

    setNetworkActivity: (state) ->
        if state.hasError or state.isRequesting
            @installRemoval(state)
        else if not @state.hasError
            @removeMessage()
        @setState(state)

    render: ->
        return null unless @props.visible or @state.isRequesting or @state.hasError
        message = @props.message or (
            if @state.hasError
                errorMsg = @model.errorMessage
                if errorMsg and _.isString(errorMsg) then errorMsg else "Error"
            else if @state.isRequesting is 'GET'
                'Loading…'
            else if _.includes(['PATCH', 'POST', 'PUT'], @state.isRequesting)
                'Saving…'
            else if @state.isRequesting is 'DELETE'
                'Deleting…'
            else
                'Pending…'
        )
        icon = if @state.hasError then 'exclamation-circle' else 'spinner'
        classes = _.classnames 'overlay', {rounded: @props.roundedCorners}
        <div className={classes}>
            <div className="mask" />
            <div className="message">
                <LC.Icon type={icon} animated={not @state.hasError} />
                {message}
            </div>
        </div>

{'fraction_non_alphanumeric': 0.10081140890090975, 'fraction_numerical': 0.004425866732235063, 'mean_word_length': 2.0222882615156017, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 27, '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': '3630178', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1071, 'n_words': 259}