<commit_before>import React, { Component } from 'react';
import { connect } from 'react-redux';
import MyTrade from '../components/MyTrade';
require('../../styles/index.scss');



class TradeOffersScreen extends Component {
    render() {
        const { trade_offers } = this.props
        return (
        <div style={{'marginLeft':'10px'}}>
        <h2 className="mainLayout">Trade Offers</h2>
        {trade_offers.map(mytrade=>{
            return (
            <div style={{'margin-bottom':'10px'}} key={mytrade._id}>
                <MyTrade mytrade={mytrade} tradeType={'offer'}/>
            </div>
            )
        })}
        </div>
        )
    }
}

function mapStateToProps(state) {
    return {
        trade_offers: state.user.trade_offers
    }
}

TradeOffersScreen = connect(
    mapStateToProps
)(TradeOffersScreen)

export default TradeOffersScreen<commit_msg>fixed typeError when trades array undefined<commit_after>import React, { Component } from 'react';
import { connect } from 'react-redux';
import MyTrade from '../components/MyTrade';
require('../../styles/index.scss');



class TradeOffersScreen extends Component {
    render() {
        const { trade_offers } = this.props
        if (trade_offers === undefined) {
            return (<div></div>)
        }
        return (
        <div style={{'marginLeft':'10px'}}>
        <h2 className="mainLayout">Trade Offers</h2>
        {trade_offers.length===0 ? 
            <div style={{'marginLeft': '20px'}} className="mainLayout">
            No Trades Have Been Offered To You</div>:
            <div></div>
        }
        {trade_offers.map(mytrade=>{
            return (
            <div style={{'margin-bottom':'10px'}} key={mytrade._id}>
                <MyTrade mytrade={mytrade} tradeType={'offer'}/>
            </div>
            )
        })}
        </div>
        )
    }
}

function mapStateToProps(state) {
    return {
        trade_offers: state.user.trade_offers
    }
}

TradeOffersScreen = connect(
    mapStateToProps
)(TradeOffersScreen)

export default TradeOffersScreen
{'fraction_non_alphanumeric': 0.14271984622777512, 'fraction_numerical': 0.007208073041806823, 'mean_word_length': 2.3365384615384617, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, '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': '1996309', 'n_tokens_mistral': 659, 'n_tokens_neox': 629, 'n_words': 122}