<commit_before>import React, { Component } from 'react'
import './index.css'
import Draggable, { DraggableCore } from 'react-draggable'
import CharacterEntry from '../CharacterList/CharacterEntry'
import { NotificationManager } from 'react-notifications'

class PlayerCanvas extends Component {
  constructor(props) {
    super(props)

    this.state = {
      tryCount: 0
    }
  }
  render() {
    const { renderable, onUpdateRenderablePosition, summary, onStart, onStop, onClick } = this.props
    const { tryCount } = this.state
    let imgLink = summary
    if (summary.indexOf('?') !== -1) imgLink = summary + `&tryCount=${tryCount}`
    else imgLink = summary + `?tryCount=${tryCount}`
    return (
      <DraggableCore
        onStart={onStart}
        onStop={onStop}
        onDrag={onUpdateRenderablePosition}
        position={renderable.position}
        >
        <div>
          <img
            src={imgLink}
            alt=''
            className='renderable-instance'
            draggable={false}
            onClick={onClick}
            onError={this.showError.bind(this)}
            style={{
              position: 'relative',
              transform: `translate(${renderable.position.x}px, ${renderable.position.y}px)`,
              touchAction: 'none'
            }}
            />
        </div>
        </DraggableCore>
    )
  }

  showError() {
    NotificationManager.warning(`There was an error rendering your ${this.props.renderable.type}`, '', 7000)
    setTimeout(function () {
      if (this.state.tryCount < 10) {
        NotificationManager.warning(`Retrying to render your ${this.props.renderable.type}`, '', 2000)
        setTimeout(function () {
          this.setState({ tryCount: this.state.tryCount + 1 })
        }.bind(this), 2500)
      }
    }.bind(this), 7500)
  }
}

export default PlayerCanvas<commit_msg>Correcting not being able to move new characters if there are other characters<commit_after>import React, { Component } from 'react'
import './index.css'
import Draggable, { DraggableCore } from 'react-draggable'
import CharacterEntry from '../CharacterList/CharacterEntry'
import { NotificationManager } from 'react-notifications'

class PlayerCanvas extends Component {
  constructor(props) {
    super(props)

    this.state = {
      tryCount: 0
    }
  }
  render() {
    const { renderable, onUpdateRenderablePosition, summary, onStart, onStop, onClick } = this.props
    const { tryCount } = this.state
    let imgLink = summary
    if (summary.indexOf('?') !== -1) imgLink = summary + `&tryCount=${tryCount}`
    else imgLink = summary + `?tryCount=${tryCount}`
    return (
      <DraggableCore
        onStart={onStart}
        onStop={onStop}
        onDrag={onUpdateRenderablePosition}
        position={renderable.position}
        >
        <div style={{ transform: `translate(${renderable.position.x}px, ${renderable.position.y}px)` }}>
          <img
            src={imgLink}
            alt=''
            className='renderable-instance'
            draggable={false}
            onClick={onClick}
            onError={this.showError.bind(this)}
            style={{
              position: 'relative',
              touchAction: 'none'
            }}
            />
        </div>
        </DraggableCore>
    )
  }

  showError() {
    NotificationManager.warning(`There was an error rendering your ${this.props.renderable.type}`, '', 7000)
    setTimeout(function () {
      if (this.state.tryCount < 10) {
        NotificationManager.warning(`Retrying to render your ${this.props.renderable.type}`, '', 2000)
        setTimeout(function () {
          this.setState({ tryCount: this.state.tryCount + 1 })
        }.bind(this), 2500)
      }
    }.bind(this), 7500)
  }
}

export default PlayerCanvas
{'fraction_non_alphanumeric': 0.12857142857142856, 'fraction_numerical': 0.011111111111111112, 'mean_word_length': 2.4783808647654095, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '913732', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1077, 'n_words': 230}