<commit_before>/*

The Navigation for the Inbox components

*/

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Components, registerComponent, withList, withCurrentUser, getFragment } from 'meteor/vulcan:core';
import Messages from "../../lib/collections/messages/collection.js";
import Typography from '@material-ui/core/Typography';
import { withStyles } from '@material-ui/core/styles';
import Conversations from '../../lib/collections/conversations/collection.js';

const styles = theme => ({
  conversationTitle: {
    ...theme.typography.commentStyle,
    marginTop: theme.spacing.unit,
    marginBottom: theme.spacing.unit*1.5
  },
  editor: {
    marginTop: theme.spacing.unit*4,
    ...theme.typography.commentStyle,
    position:"relative",
  }
})

class ConversationWrapper extends Component {

  renderMessages(results, currentUser) {
    if (results && results.length) {
      return (
        <div>
          {results.map((message) => (<Components.MessageItem key={message._id} currentUser={currentUser} message={message} />))}
        </div>);
    } else {
     return <Components.NoContent>There are no messages in this conversation yet!</Components.NoContent>
    }
  }

  render() {

    const { results, currentUser, loading, conversation, classes } = this.props

    if (loading) {
      return (<Components.Loading/>)
    } else if (conversation) {
      return (
        <div>
          <Typography variant="display2" className={classes.conversationTitle}>
            { Conversations.getTitle(conversation, currentUser)}
          </Typography>
          <Components.ConversationDetails conversation={conversation}/>
          {this.renderMessages(results, currentUser)}
          <div className={classes.editor}>
            <Components.SmartForm
              key={conversation._id}
              collection={Messages}
              prefilledProps={ {conversationId: conversation._id} }<commit_msg>Cleanup conversation wrapper<commit_after>/*

The Navigation for the Inbox components

*/

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Components, registerComponent, withList, withCurrentUser, getFragment } from 'meteor/vulcan:core';
import Messages from "../../lib/collections/messages/collection.js";
import Typography from '@material-ui/core/Typography';
import { withStyles } from '@material-ui/core/styles';
import Conversations from '../../lib/collections/conversations/collection.js';

const styles = theme => ({
  conversationTitle: {
    ...theme.typography.commentStyle,
    marginTop: theme.spacing.unit,
    marginBottom: theme.spacing.unit*1.5
  },
  editor: {
    marginTop: theme.spacing.unit*4,
    ...theme.typography.commentStyle,
    position:"relative",
  }
})

class ConversationWrapper extends Component {

  renderMessages = () => {
    const { results, currentUser, loading } = this.props
    if (results && results.length) {
      return (
        <div>
          {results.map((message) => (<Components.MessageItem key={message._id} currentUser={currentUser} message={message} />))}
        </div>);
    } else if (loading) {
      return <Components.Loading/>
    } else {
      return null
    }
  }

  render() {

    const { results, currentUser, conversation, classes } = this.props

    if (conversation) {
      return (
        <div>
          <Typography variant="display2" className={classes.conversationTitle}>
            { Conversations.getTitle(conversation, currentUser)}
          </Typography>
          <Components.ConversationDetails conversation={conversation}/>
          {this.renderMessages(results, currentUser)}
          <div className={classes.editor}>
            <Components.SmartForm
              key={conversation._id}
              collection={Messages}
              prefilledProps={ {conversationId: conversation._id} }
{'fraction_non_alphanumeric': 0.12796086508753862, 'fraction_numerical': 0.0020597322348094747, 'mean_word_length': 3.1506410256410255, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 28, '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': '5043378', 'n_tokens_mistral': 1060, 'n_tokens_neox': 1046, 'n_words': 230}