<commit_before>kd     = require 'kd'
React  = require 'kd-react'
Portal = require 'react-portal'

noop = ->


class ModalOverlay extends React.Component

  render: ->
    <div className="ModalOverlay" />


module.exports = class ActivityPromptModal extends React.Component

  @defaultProps =
    onClose             : noop
    closeOnEsc          : yes
    closeOnOutsideClick : yes
    hasOverlay          : yes
    isOpen              : no
    className           : ''

  onClose: (args...) -> @props.onClose? args...


  renderModal: ->

    return null  unless @props.isOpen

    portalProps =
      isOpened            : @props.isOpen
      onClose             : @bound 'onClose'
      closeOnEsc          : @props.closeOnEsc
      closeOnOutsideClick : @props.closeOnOutsideClick

    return (
      <Portal {...portalProps}>
        <div className={kd.utils.curry 'Reactivity Modal ActivityPromptModal', @props.className}>
          <h4 className="Modal-title">{@props.title}</h4>
          <div className="Modal-content">
            <p>{@props.children}</p>
          </div>
          <div className="Modal-buttons">
            <button className="Button Modal-Button Button--danger" onClick={@props.onConfirm}>
              {@props.buttonConfirmTitle}
            </button>
            <button className="Button Modal-Button Button--secondary" onClick={@props.onAbort}>
              {@props.buttonAbortTitle}
            </button>
          </div>
        </div>
      </Portal>
    )


  renderOverlay: ->
    return null  unless @props.isOpen and @props.hasOverlay

    return (
      <Portal isOpened={@props.isOpen}>
        <ModalOverlay />
      </Portal>
    )



  render: ->
    <div className="ActivityPromptModal-container">
      {@renderOverlay()}
      {@renderModal()}
    </div>


<commit_msg>Client: Activity: Mover base modal functionalities to base ActivityModal.<commit_after>kd     = require 'kd'
React  = require 'kd-react'
Portal = require 'react-portal'

noop = ->


class ModalOverlay extends React.Component

  render: ->
    <div className="ModalOverlay" />


module.exports = class ActivityPromptModal extends React.Component

module.exports = class ActivityPromptModal extends ActivityModal

  renderModal: ->

    return null  unless @props.isOpen

    portalProps = @getPortalProps()

    return (
      <Portal {...portalProps}>
        <div className={kd.utils.curry 'Reactivity Modal ActivityPromptModal', @props.className}>
          <h4 className="Modal-title">{@props.title}</h4>
          <div className="Modal-content">
            <p>{@props.children}</p>
          </div>
          <div className="Modal-buttons">
            <button className="Button Modal-Button Button--danger" onClick={@props.onConfirm}>
              {@props.buttonConfirmTitle}
            </button>
            <button className="Button Modal-Button Button--secondary" onClick={@props.onAbort}>
              {@props.buttonAbortTitle}
            </button>
          </div>
        </div>
      </Portal>
    )


{'fraction_non_alphanumeric': 0.12339585389930899, 'fraction_numerical': 0.0013162224415926291, 'mean_word_length': 2.2203389830508473, 'pattern_counts': {'":': 0, '<': 42, '<?xml version=': 0, '>': 51, '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': '4151118', 'n_tokens_mistral': 878, 'n_tokens_neox': 869, 'n_words': 181}