<commit_before>"use strict";
import React, { Component, PropTypes } from 'react';
import { Link } from 'react-router';
import moment from 'moment';
import Text from '../../components/Text';
import Image from '../../components/Image';
import Audio from '../../components/Audio';
import Video from '../../components/Video';
import Button from '../../components/Button';
import Section from '../../components/Section';
import MessageItem from './MessageItem';

const LEFT_KEY = 37;
const RIGHT_KEY = 39;

export default class MessageContents extends Component {

  constructor () {
    super();
    this._onKey = this._onKey.bind(this);
  }

  componentDidMount () {
    window.addEventListener('keydown', this._onKey);
  }

  componentWillUnmount () {
    window.removeEventListener('keydown', this._onKey);
  }

  _changeToMessage (message) {
    const path = `/messages/${message.path || message._id}`;
    this.context.router.replace(path);
  }

  _onKey (event) {
    const message = this.props.item;
    const key = (event.keyCode ? event.keyCode : event.which);
    if (LEFT_KEY === key && message.previousMessage) {
      this._changeToMessage(message.previousMessage);
    } else if (RIGHT_KEY ===  key && message.nextMessage) {
      this._changeToMessage(message.nextMessage);
    }
  }

  _renderMessageNav (message, type) {
    return (
      <Button left={'previous' === type} right={'next' === type}
        path={`/messages/${message.path || message._id}`} replaceHistory={true}>
        <div className="message__nav-name">{message.name}</div>
        <div className="message__nav-verses">{message.verses}</div>
      </Button>
    );
  }

  render () {
    const message = this.props.item;

    let video;
    if (message.videoUrl) {
      video = <Video url={message.videoUrl} full={true} />;
    }

    let text;
    if (message.text) {
      text = <Text text={message.text} />;
    }<commit_msg>Fixed an issues with Message text layout when mobile.<commit_after>"use strict";
import React, { Component, PropTypes } from 'react';
import { Link } from 'react-router';
import moment from 'moment';
import Text from '../../components/Text';
import Image from '../../components/Image';
import Audio from '../../components/Audio';
import Video from '../../components/Video';
import Button from '../../components/Button';
import Section from '../../components/Section';
import MessageItem from './MessageItem';

const LEFT_KEY = 37;
const RIGHT_KEY = 39;

export default class MessageContents extends Component {

  constructor () {
    super();
    this._onKey = this._onKey.bind(this);
  }

  componentDidMount () {
    window.addEventListener('keydown', this._onKey);
  }

  componentWillUnmount () {
    window.removeEventListener('keydown', this._onKey);
  }

  _changeToMessage (message) {
    const path = `/messages/${message.path || message._id}`;
    this.context.router.replace(path);
  }

  _onKey (event) {
    const message = this.props.item;
    const key = (event.keyCode ? event.keyCode : event.which);
    if (LEFT_KEY === key && message.previousMessage) {
      this._changeToMessage(message.previousMessage);
    } else if (RIGHT_KEY ===  key && message.nextMessage) {
      this._changeToMessage(message.nextMessage);
    }
  }

  _renderMessageNav (message, type) {
    return (
      <Button left={'previous' === type} right={'next' === type}
        path={`/messages/${message.path || message._id}`} replaceHistory={true}>
        <div className="message__nav-name">{message.name}</div>
        <div className="message__nav-verses">{message.verses}</div>
      </Button>
    );
  }

  render () {
    const message = this.props.item;

    let video;
    if (message.videoUrl) {
      video = <Video url={message.videoUrl} full={true} />;
    }

    let text;
    if (message.text) {
      text = (
        <Section full={false}>
          <Text text={message.text} />
        </Section>
      );
    }
{'fraction_non_alphanumeric': 0.1603150406504065, 'fraction_numerical': 0.0020325203252032522, 'mean_word_length': 3.1617336152219875, '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': '6525771', 'n_tokens_mistral': 1159, 'n_tokens_neox': 1153, 'n_words': 271}