<commit_before>import styles from './share.styl'

import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Modal from 'cozy-ui/react/Modal'

import { default as DumbShareByLink } from './components/ShareByLink'
import { default as DumbShareByEmail } from './components/ShareByEmail'
import WhoHasAccess from './components/WhoHasAccess'

require('url-polyfill')

export default class ShareModal extends Component {
  render() {
    const { t } = this.context
    const {
      document,
      isOwner,
      sharingDesc,
      contacts,
      createContact,
      link,
      recipients,
      documentType = 'Document',
      hasSharedParent,
      hasSharedChild,
      onClose,
      onShare,
      onRevoke,
      onShareByLink,
      onRevokeLink
    } = this.props
    return (
      <Modal
        title={t(`${documentType}.share.title`)}
        dismissAction={onClose}
        into="body"
        size="small"
        mobileFullscreen
      >
        <div className={styles['share-modal-content']}>
          <DumbShareByEmail
            document={document}
            documentType={documentType}
            sharingDesc={sharingDesc}
            contacts={contacts}
            createContact={createContact}
            onShare={onShare}
            hasSharedParent={hasSharedParent}
            hasSharedChild={hasSharedChild}
          />
          <hr className={styles['divider']} />
          <DumbShareByLink
            document={document}
            documentType={documentType}
            checked={link !== null}
            link={link}
            onEnable={onShareByLink}
            onDisable={onRevokeLink}
          />
          <WhoHasAccess
            isOwner={isOwner}
            recipients={recipients}
            document={document}
            documentType={documentType}
            onRevoke={onRevoke}
          />
        </div>
      </Modal>
    )
  }
}

ShareModal.propTypes = {
  document: PropTypes.object.isRequired,
  isOwner: PropTypes.bool,
  sharingDesc: PropTypes.string,
  contacts: PropTypes.array.isRequired,
  createContact: PropTypes.func.isRequired,<commit_msg>fix: Scrolling in share modal<commit_after>import styles from './share.styl'

import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Modal, { ModalContent } from 'cozy-ui/react/Modal'

import { default as DumbShareByLink } from './components/ShareByLink'
import { default as DumbShareByEmail } from './components/ShareByEmail'
import WhoHasAccess from './components/WhoHasAccess'

require('url-polyfill')

export default class ShareModal extends Component {
  render() {
    const { t } = this.context
    const {
      document,
      isOwner,
      sharingDesc,
      contacts,
      createContact,
      link,
      recipients,
      documentType = 'Document',
      hasSharedParent,
      hasSharedChild,
      onClose,
      onShare,
      onRevoke,
      onShareByLink,
      onRevokeLink
    } = this.props
    return (
      <Modal
        title={t(`${documentType}.share.title`)}
        dismissAction={onClose}
        into="body"
        size="small"
        mobileFullscreen
      >
        <ModalContent>
          <div className={styles['share-modal-content']}>
            <DumbShareByEmail
              document={document}
              documentType={documentType}
              sharingDesc={sharingDesc}
              contacts={contacts}
              createContact={createContact}
              onShare={onShare}
              hasSharedParent={hasSharedParent}
              hasSharedChild={hasSharedChild}
            />
            <hr className={styles['divider']} />
            <DumbShareByLink
              document={document}
              documentType={documentType}
              checked={link !== null}
              link={link}
              onEnable={onShareByLink}
              onDisable={onRevokeLink}
            />
            <WhoHasAccess
              isOwner={isOwner}
              recipients={recipients}
              document={document}
              documentType={documentType}
              onRevoke={onRevoke}
            />
          </div>
        </ModalContent>
      </Modal>
    )
  }
}

ShareModal.propTypes = {
  document: PropTypes.object.isRequired,
  isOwner: PropTypes.bool,
  sharingDesc: PropTypes.string,
  contacts: PropTypes.array.isRequired,
  createContact: PropTypes.func.isRequired,
{'fraction_non_alphanumeric': 0.10065596019000227, 'fraction_numerical': 0.0, 'mean_word_length': 2.090146750524109, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '5870429', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1188, 'n_words': 224}