<commit_before>import React, { PropTypes } from 'react'
import { injectIntl, intlShape, defineMessages, FormattedMessage } from 'react-intl'
import ClickableElement from '../components/ClickableElement'

class Publication extends React.Component {
  renderTitle (publication) {
    let title = publication.mainTitle
    if (publication.partTitle) {
      title += ` — ${publication.partTitle}`
    }
    return title
  }

  render () {
    const { publication, startReservation } = this.props
    const languages = [ ...new Set(publication.languages.map(language => this.props.intl.formatMessage({ id: language }))) ]
    const coverAltText = this.props.intl.formatMessage(messages.coverImageOf, { title: this.renderTitle(publication) })
    return (
        <article onClick={this.handleClick}
                 className={this.props.open ? 'single-publication open' : 'single-publication'}
                 data-automation-id={`publication_${publication.uri}`}>
          <div className="book-cover">
            {publication.image ? <img src={publication.image} alt={coverAltText} /> : null}
          </div>
          <div className="meta-info">
            <div className="publication-text-container">
              <div className="availability" data-automation-id={publication.available ? 'publication_available' : 'publication_unavailable'}>
                <FormattedMessage {...(publication.available ? messages.available : messages.unavailable)} />
              </div>
              <h2 data-automation-id="publication_title">{this.renderTitle(publication)}</h2>
              <div className="meta-item">
                <span data-automation-id="publication_year">{publication.publicationYear}, </span>
                <span data-automation-id="publication_languages">{languages.join(', ')}</span>
              </div>
            </div>
            { publication.items.length > 0 ? (
              <div className="reserve-button">
                <ClickableElement onClickAction={startReservation} onClickArguments={publication.recordId}>
                  <button className="red-btn" type="button"
                          data-automation-id={`recordId_${publication.recordId}`}>
                    <span data-automation-id="publication_order"><FormattedMessage {...messages.reserve} /></span>
                  </button><commit_msg>Patron-client: add publication formats and record id to work view<commit_after>import React, { PropTypes } from 'react'
import { injectIntl, intlShape, defineMessages, FormattedMessage } from 'react-intl'
import ClickableElement from '../components/ClickableElement'

class Publication extends React.Component {
  renderTitle (publication) {
    let title = publication.mainTitle
    if (publication.partTitle) {
      title += ` — ${publication.partTitle}`
    }
    return title
  }

  render () {
    const { publication, startReservation } = this.props
    const languages = [ ...new Set(publication.languages.map(language => this.props.intl.formatMessage({ id: language }))) ]
    const formats = [ ...new Set(publication.formats.map(format => this.props.intl.formatMessage({ id: format }))) ]
    const coverAltText = this.props.intl.formatMessage(messages.coverImageOf, { title: this.renderTitle(publication) })
    return (
        <article onClick={this.handleClick}
                 className={this.props.open ? 'single-publication open' : 'single-publication'}
                 data-automation-id={`publication_${publication.uri}`}>
          <div className="book-cover">
            {publication.image ? <img src={publication.image} alt={coverAltText} /> : null}
          </div>
          <div className="meta-info">
            <div className="publication-text-container">
              <div className="availability" data-automation-id={publication.available ? 'publication_available' : 'publication_unavailable'}>
                <FormattedMessage {...(publication.available ? messages.available : messages.unavailable)} />
              </div>
              <h2 data-automation-id="publication_title">{this.renderTitle(publication)}</h2>
              <div className="meta-item">
                <span data-automation-id="publication_year">{publication.publicationYear}, </span>
                <span data-automation-id="publication_languages">{languages.join(', ')}</span>
              </div>
              <div className="meta-item">
                <span data-automation-id="publication_formats">{formats.join(', ')}</span>
              </div>
              <div className="meta-item">
                <span data-automation-id="publication_record_id">{publication.recordId}</span>
              </div>
            </div>
            { publication.items.length > 0 ? (
              <div className="reserve-button">
                <ClickableElement onClickAction={startReservation} onClickArguments={publication.recordId}>
                  <button className="red-btn" type="button"
                          data-automation-id={`recordId_${publication.recordId}`}>
                    <span data-automation-id="publication_order"><FormattedMessage {...messages.reserve} /></span>
                  </button>
{'fraction_non_alphanumeric': 0.13502028201661193, 'fraction_numerical': 0.0011589723778249951, 'mean_word_length': 2.7144906743185078, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 66, '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': '254389', 'n_tokens_mistral': 1393, 'n_tokens_neox': 1374, 'n_words': 240}