<commit_before>import React from "react";
import PropTypes from "prop-types";
import {BootstrapTable, TableHeaderColumn} from "react-bootstrap-table";
import "react-bootstrap-table/dist/react-bootstrap-table.min.css";
import IngredientsTable from "../ingredientsTable/index";
import PriceEdit from "../../container/priceEdit/index";
import PriceText from "../priceText/index";


export default class CraftOverview extends React.Component {

    static propTypes = {
        items: PropTypes.array.isRequired
    };

    imageFormatter( cell, row ) {
        return cell ? <img src={cell} alt={row.name} height="40"/> : cell;
    }

    priceEditFormatter( cell ) {
        return <PriceEdit name={cell}/>
    }

    priceFormatter( cell ) {
        return <PriceText price={cell}/>
    }

    highlightedPriceFormatter( cell ) {
        return <PriceText shouldHighlight={true} price={cell}/>
    }

    expandComponent( row ) {
        return <IngredientsTable item={row} ingredients={row.ingredients}/>
    }

    render() {
        const options = {
            sortName: "name",
            sortOrder: "asc",
            expandRowBgColor: 'rgb(242, 255, 163)',
            expandBy: 'column'
        };
        let {items} = this.props;
        return (
                <BootstrapTable data={items}
                                striped={true}
                                hover={true}
                                search={ true }
                                options={options}
                                expandableRow={ () => true }
                                expandComponent={ this.expandComponent }
                >
                    <TableHeaderColumn dataField="image" dataFormat={this.imageFormatter}>#</TableHeaderColumn>
                    <TableHeaderColumn dataField="name" isKey={true} dataSort={true}>Name</TableHeaderColumn>
                    <TableHeaderColumn dataField="profession" dataSort={true}>Profession</TableHeaderColumn>
                    <TableHeaderColumn dataField="quantity">Quantity</TableHeaderColumn>
                    <TableHeaderColumn dataField="cost" dataFormat={this.priceFormatter}>Crafting
                        Cost</TableHeaderColumn>
                    <TableHeaderColumn dataField="name" expandable={ false } dataFormat={this.priceEditFormatter}>AH
                        Price</TableHeaderColumn>
                    <TableHeaderColumn dataField="totalCraftingCost" dataFormat={this.priceFormatter}>Total Crafting
                        Cost</TableHeaderColumn>
                    <TableHeaderColumn dataField="profit" dataFormat={this.highlightedPriceFormatter} dataSort={true}>Profit</TableHeaderColumn>
                </BootstrapTable>
        )
    }
}<commit_msg> - added width to craftOverview because some columns are to large for the shown data<commit_after>import React from "react";
import PropTypes from "prop-types";
import {BootstrapTable, TableHeaderColumn} from "react-bootstrap-table";
import "react-bootstrap-table/dist/react-bootstrap-table.min.css";
import IngredientsTable from "../ingredientsTable/index";
import PriceEdit from "../../container/priceEdit/index";
import PriceText from "../priceText/index";


export default class CraftOverview extends React.Component {

    static propTypes = {
        items: PropTypes.array.isRequired
    };

    imageFormatter( cell, row ) {
        return cell ? <img src={cell} alt={row.name} height="40"/> : cell;
    }

    priceEditFormatter( cell ) {
        return <PriceEdit name={cell}/>
    }

    priceFormatter( cell ) {
        return <PriceText price={cell}/>
    }

    highlightedPriceFormatter( cell ) {
        return <PriceText shouldHighlight={true} price={cell}/>
    }

    expandComponent( row ) {
        return <IngredientsTable item={row} ingredients={row.ingredients}/>
    }

    render() {
        const options = {
            sortName: "name",
            sortOrder: "asc",
            expandRowBgColor: 'rgb(242, 255, 163)',
            expandBy: 'column'
        };
        let {items} = this.props;
        return (
                <BootstrapTable data={items}
                                striped={true}
                                hover={true}
                                search={ true }
                                options={options}
                                expandableRow={ () => true }
                                expandComponent={ this.expandComponent }
                >
                    <TableHeaderColumn dataField="image" dataFormat={this.imageFormatter}
                                       width="60px">#</TableHeaderColumn>
                    <TableHeaderColumn dataField="name" isKey={true} dataSort={true}
                                       width="400px">Name</TableHeaderColumn>
                    <TableHeaderColumn dataField="profession" dataSort={true}>Profession</TableHeaderColumn>
                    <TableHeaderColumn dataField="quantity" width="100px">Quantity</TableHeaderColumn>
                    <TableHeaderColumn dataField="cost" dataFormat={this.priceFormatter}>Crafting
                        Cost</TableHeaderColumn>
                    <TableHeaderColumn dataField="name" expandable={ false } dataFormat={this.priceEditFormatter}>AH
                        Price</TableHeaderColumn>
                    <TableHeaderColumn dataField="totalCraftingCost" dataFormat={this.priceFormatter}>Total Crafting
                        Cost</TableHeaderColumn>
                    <TableHeaderColumn dataField="profit" dataFormat={this.highlightedPriceFormatter} dataSort={true}>Profit</TableHeaderColumn>
                </BootstrapTable>
        )
    }
}
{'fraction_non_alphanumeric': 0.10603932584269662, 'fraction_numerical': 0.0052668539325842695, 'mean_word_length': 2.03031914893617, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1207548', 'n_tokens_mistral': 1431, 'n_tokens_neox': 1333, 'n_words': 275}