<commit_before>'use strict';

import Relay from 'react-relay';
import React from 'react';
import { Text, View, StyleSheet, TouchableWithoutFeedback } from 'react-native';

import ImageView from '../../opaque_image_view';
import SerifText from '../../text/serif';
import colors from '../../../../data/colors';
import SwitchBoard from '../../../modules/switch_board';

export default class Artwork extends React.Component {
  handleTap() {
    SwitchBoard.presentNavigationViewController(this, this.props.artwork.href);
  }

  render() {
    const artwork = this.props.artwork;
    return (
      <TouchableWithoutFeedback onPress={this.handleTap.bind(this)}>
        <View>
          <ImageView style={styles.image} aspectRatio={artwork.image.aspect_ratio} imageURL={artwork.image.url} />
          <SerifText style={[styles.text, styles.artist]}>{artwork.artist.name}</SerifText>
          { this.artworkTitle() }
          <SerifText style={styles.text}>{this.props.artwork.partner.name }</SerifText>
          { this.saleMessage() }
        </View>
      </TouchableWithoutFeedback>
    );
  }

  artworkTitle() {
    const artwork = this.props.artwork;
    if (artwork.title) {
      return (
        <SerifText style={styles.text}>
          <SerifText style={[styles.text, styles.title]}>{ artwork.title }</SerifText>
          { artwork.date ? (", " + artwork.date) : "" }
        </SerifText>
      );   
    } else {
      return null;
    }
  }
  
  saleMessage() {
    const message = this.props.artwork.sale_message;
    return message ? <SerifText style={styles.text}>{ message }</SerifText> : null;<commit_msg>[Artworks] Fixed partner name crasher for artworks in grid<commit_after>'use strict';

import Relay from 'react-relay';
import React from 'react';
import { Text, View, StyleSheet, TouchableWithoutFeedback } from 'react-native';

import ImageView from '../../opaque_image_view';
import SerifText from '../../text/serif';
import colors from '../../../../data/colors';
import SwitchBoard from '../../../modules/switch_board';

export default class Artwork extends React.Component {
  handleTap() {
    SwitchBoard.presentNavigationViewController(this, this.props.artwork.href);
  }

  render() {
    const artwork = this.props.artwork;
    return (
      <TouchableWithoutFeedback onPress={this.handleTap.bind(this)}>
        <View>
          <ImageView style={styles.image} aspectRatio={artwork.image.aspect_ratio} imageURL={artwork.image.url} />
          <SerifText style={[styles.text, styles.artist]}>{artwork.artist.name}</SerifText>
          { this.artworkTitle() }
          { this.props.artwork.partner ? <SerifText style={styles.text}>{ this.props.artwork.partner.name }</SerifText> : null }
          { this.saleMessage() }
        </View>
      </TouchableWithoutFeedback>
    );
  }

  artworkTitle() {
    const artwork = this.props.artwork;
    if (artwork.title) {
      return (
        <SerifText style={styles.text}>
          <SerifText style={[styles.text, styles.title]}>{ artwork.title }</SerifText>
          { artwork.date ? (", " + artwork.date) : "" }
        </SerifText>
      );
    } else {
      return null;
    }
  }

  saleMessage() {
    const message = this.props.artwork.sale_message;
    return message ? <SerifText style={styles.text}>{ message }</SerifText> : null;
{'fraction_non_alphanumeric': 0.15359182446648634, 'fraction_numerical': 0.0, 'mean_word_length': 2.9808612440191387, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '1776021', 'n_tokens_mistral': 1026, 'n_tokens_neox': 1013, 'n_words': 200}