<commit_before>import React, {Component, PropTypes} from 'react';
import ProductsEdit from './products-edit.react.jsx';
import ProductsAlert from './products-alert.react.jsx';
import DialogActions from './../../actions/dialog/dialog.actions.js';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import classNames from 'classnames';
import {cl as cloudinary, options} from './../../helpers/cloudinary/cloudinary.js';

export class ProductsItemUnwrapped extends Component {
    constructor(props) {
        super(props);

        this.alertProduct = this.alertProduct.bind(this);
        this.upsertProduct = this.upsertProduct.bind(this);
        this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
    }

    alertProduct(event) {
        event.preventDefault();

        DialogActions.open(<ProductsAlert product={this.props.product}/>);
    }

    upsertProduct(event) {
        event.preventDefault();

        DialogActions.open(<ProductsEdit hasExistingCategory={this.props.hasExistingCategory} product={this.props.product} categories={this.props.categories}/>);
    }

    render() {
        let _this = this;
        let callout;

        callout = classNames({
            'callout': true,
            'warning': !_this.props.hasExistingCategory
        });

        return <section className='column'>
            <div className={callout}>
                <h6>{this.props.product.title}</h6>
                <div className='button-group stacked-for-small small'>
                    <button className='button success' onClick={this.upsertProduct}>Edit</button>
                    <button className='button alert' onClick={this.alertProduct}>Delete</button>
                    <span/>
                </div>
                <div className='stat'>{this.props.product.price} &#8381;</div>
                <hr/>
                <img className='thumbnail' src={cloudinary.url(this.props.product.image.public_id, Object.assign({}, options, {width: 400, height: 300}))} alt={this.props.product.title}/>
            </div>
        </section>;
    }
}

ProductsItemUnwrapped.propTypes = {
    product: PropTypes.shape({
        _id: PropTypes.string.isRequired,
        title: PropTypes.string.isRequired,
        category: PropTypes.string.isRequired,
        image: PropTypes.shape({
            public_id: PropTypes.string.isRequired
        })
    }).isRequired
};

const ProductsItem = ProductsItemUnwrapped;

export default ProductsItem;<commit_msg>Returned button group<commit_after>import React, {Component, PropTypes} from 'react';
import ProductsEdit from './products-edit.react.jsx';
import ProductsAlert from './products-alert.react.jsx';
import DialogActions from './../../actions/dialog/dialog.actions.js';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import classNames from 'classnames';
import {cl as cloudinary, options} from './../../helpers/cloudinary/cloudinary.js';

export class ProductsItemUnwrapped extends Component {
    constructor(props) {
        super(props);

        this.alertProduct = this.alertProduct.bind(this);
        this.upsertProduct = this.upsertProduct.bind(this);
        this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
    }

    alertProduct(event) {
        event.preventDefault();

        DialogActions.open(<ProductsAlert product={this.props.product}/>);
    }

    upsertProduct(event) {
        event.preventDefault();

        DialogActions.open(<ProductsEdit hasExistingCategory={this.props.hasExistingCategory} product={this.props.product} categories={this.props.categories}/>);
    }

    render() {
        let _this = this;
        let callout;

        callout = classNames({
            'callout': true,
            'warning': !_this.props.hasExistingCategory
        });

        return <section className='column'>
            <div className={callout}>
                <h6>{this.props.product.title}</h6>
                <div className='button-group stacked-for-small small'>
                    <button className='button success' onClick={this.upsertProduct}>Edit</button>
                    <button className='button alert' onClick={this.alertProduct}>Delete</button>
                </div>
                <div className='stat'>{this.props.product.price} &#8381;</div>
                <hr/>
                <img className='thumbnail' src={cloudinary.url(this.props.product.image.public_id, Object.assign({}, options, {width: 400, height: 300}))} alt={this.props.product.title}/>
            </div>
        </section>;
    }
}

ProductsItemUnwrapped.propTypes = {
    product: PropTypes.shape({
        _id: PropTypes.string.isRequired,
        title: PropTypes.string.isRequired,
        category: PropTypes.string.isRequired,
        image: PropTypes.shape({
            public_id: PropTypes.string.isRequired
        })
    }).isRequired
};

const ProductsItem = ProductsItemUnwrapped;

export default ProductsItem;
{'fraction_non_alphanumeric': 0.13047848813831925, 'fraction_numerical': 0.0048250904704463205, 'mean_word_length': 2.7775246772968867, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 40, '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': '3104187', 'n_tokens_mistral': 1374, 'n_tokens_neox': 1325, 'n_words': 248}