<commit_before>import React from 'react'
import RaisedButton from 'material-ui/RaisedButton'
import MenuItem from 'material-ui/MenuItem'
import store from '../store'
import {removeFromOrder} from '../reducers/cart'
import {notify} from 'react-notify-toast'

export default class CartMenuItem extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      numItems: 1,
    }
  }

  handleQuantChange = (evt) => {
    evt.target.value < 0 ? this.setState({numItems: 0}) : this.setState({numItems: evt.target.value})
  };

  removeFromCart = (evt) => {
    notify.show('Removed from cart', 'warning')
    store.dispatch(removeFromOrder(this.props.cart.id, this.props.magnet.id))
  }

  render() {
    const style = {margin: 12}
    return (
        <MenuItem >
          <div style={{display: 'block'}}>
            <h4 style={{padding: '0 20px', width: '200px'}} >{this.props.magnet.title}</h4>
          </div>
          <div style={{display: 'inLine'}}>
            <img style={{padding: '0 20px', width: '150px', height: '75px'}} src={`${this.props.magnet.image}`} alt="Magnet pic" />
          </div>
          <div style={{display: 'inLine'}}>
            <span style={{padding: '0 20px', width: '150px', height: '75px'}}>{`ID: ${this.props.magnet.id}`}</span>
          </div>
          <div style={{display: 'inLine'}}>
            <span style={{padding: '0 20px', width: '200px'}} >{`${this.props.magnet.price} x`}</span>
          </div>
          <div style={{display: 'inLine'}}>
            <input style={{padding: '0 20px'}} onChange={this.handleQuantChange} style={{width: '25px', height: '25px', fontSize: 14}} type='number' defaultValue={1} />
          </div>
          <div style={{display: 'inLine'}}>
            <span style={{padding: '0 20px', width: '200px'}} >{`= ${this.props.magnet.price * this.state.numItems}`}</span>
          </div>
          <div style={{display: 'inLine'}}>
            <RaisedButton onClick={this.removeFromCart} label="Remove" />
          </div>
        </MenuItem>
    )
  }
}<commit_msg>fix: show integer as float in cart menu item<commit_after>import React from 'react'
import RaisedButton from 'material-ui/RaisedButton'
import MenuItem from 'material-ui/MenuItem'
import store from '../store'
import {removeFromOrder} from '../reducers/cart'
import {notify} from 'react-notify-toast'

export default class CartMenuItem extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      numItems: 1,
    }
  }

  handleQuantChange = (evt) => {
    evt.target.value < 0 ? this.setState({numItems: 0}) : this.setState({numItems: evt.target.value})
  };

  removeFromCart = (evt) => {
    notify.show('Removed from cart', 'warning')
    store.dispatch(removeFromOrder(this.props.cart.id, this.props.magnet.id))
  }

  render() {
    const style = {margin: 12}
    return (
        <MenuItem >
          <div style={{display: 'block'}}>
            <h4 style={{padding: '0 20px', width: '200px'}} >{this.props.magnet.title}</h4>
          </div>
          <div style={{display: 'inLine'}}>
            <img style={{padding: '0 20px', width: '150px', height: '75px'}} src={`${this.props.magnet.image}`} alt="Magnet pic" />
          </div>
          <div style={{display: 'inLine'}}>
            <span style={{padding: '0 20px', width: '150px', height: '75px'}}>{`ID: ${this.props.magnet.id}`}</span>
          </div>
          <div style={{display: 'inLine'}}>
            <span style={{padding: '0 20px', width: '200px'}} >{`$${this.props.magnet.price / 100} x`}</span>
          </div>
          <div style={{display: 'inLine'}}>
            <input style={{padding: '0 20px'}} onChange={this.handleQuantChange} style={{width: '25px', height: '25px', fontSize: 14}} type='number' defaultValue={1} />
          </div>
          <div style={{display: 'inLine'}}>
            <span style={{padding: '0 20px', width: '200px'}} >{`= $${(this.props.magnet.price / 100) * this.state.numItems}`}</span>
          </div>
          <div style={{display: 'inLine'}}>
            <RaisedButton onClick={this.removeFromCart} label="Remove" />
          </div>
        </MenuItem>
    )
  }
}
{'fraction_non_alphanumeric': 0.19158096149246592, 'fraction_numerical': 0.025831140875388663, 'mean_word_length': 2.826166514181153, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 61, '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': '903406', 'n_tokens_mistral': 1442, 'n_tokens_neox': 1401, 'n_words': 302}