<commit_before>
/** VenueListItem renders data for a single item representing one venue where
 * people can go to. It renders an image of the place, a link to Yelp site and
 * few control buttons.
 */
class VenueListItem extends React.Component {

    constructor(props) {
        super(props);
        this.onGoingClick = this.onGoingClick.bind(this);
        this.addToFavourites = this.addToFavourites.bind(this);
    }

    onGoingClick(e) {
        var newGoingState = !this.props.going;
        var obj = {going: newGoingState, appID: this.props.data.appID};
        this.props.onGoingClick(obj);
    }

    addToFavourites(e) {
        //TODO call top component handles for ajax-post
    }

    render() {
        var data = this.props.data;
        var goingButtonText = !this.props.going ? "Go" : "Cancel";
        var nGoing = data.going.length;
        var url = data.url;
        var image = data.image;
        var descr = data.descr;
        var descrComp = null;
        if (descr) {
            descrComp = <p className="venue-descr">{descr}</p>;
        }

        // Generate buttons only for authenticated users
        var isAuth = this.props.isAuth;
        var buttons = null;
        if (isAuth) {
            buttons = (
                <div id='venue-list-item-btn'>
                <button onClick={this.onGoingClick}>{goingButtonText}</button>
                <button onClick={this.addToFavourites}>Add to favourites</button>
                </div>
            );
        }

        var userGoing = "You are not going.";
        if (this.props.going) {
            if (nGoing > 1) userGoing = "You're also going!";
            else userGoing = "You're going!";
        }

        return (
            <li className='venue-list-item'>
                <img src={image}/>
                {buttons}
                <a href={url}>{data.name}</a>
                <span className='li-going'> | {nGoing} going | {userGoing}</span>
                {descrComp}
            </li>
        );
    }

}<commit_msg>Title of venue shown now before the buttons when logged in.<commit_after>
/** VenueListItem renders data for a single item representing one venue where
 * people can go to. It renders an image of the place, a link to Yelp site and
 * few control buttons.
 */
class VenueListItem extends React.Component {

    constructor(props) {
        super(props);
        this.onGoingClick = this.onGoingClick.bind(this);
        this.addToFavourites = this.addToFavourites.bind(this);
    }

    onGoingClick(e) {
        var newGoingState = !this.props.going;
        var obj = {going: newGoingState, appID: this.props.data.appID};
        this.props.onGoingClick(obj);
    }

    addToFavourites(e) {
        //TODO call top component handles for ajax-post
    }

    render() {
        var data = this.props.data;
        var goingButtonText = !this.props.going ? "Go" : "Cancel";
        var nGoing = data.going.length;
        var url = data.url;
        var image = data.image;
        var descr = data.descr;
        var descrComp = null;
        if (descr) {
            descrComp = <p className="venue-descr">{descr}</p>;
        }

        // Generate buttons only for authenticated users
        var isAuth = this.props.isAuth;
        var buttons = null;
        if (isAuth) {
            buttons = (
                <span className='venue-list-item-btn'>
                    <button onClick={this.onGoingClick}>{goingButtonText}</button>
                    <button onClick={this.addToFavourites}>Add to favourites</button>
                </span>
            );
        }

        var userGoing = "You are not going.";
        if (this.props.going) {
            if (nGoing > 1) userGoing = "You're also going!";
            else userGoing = "You're going!";
        }

        return (
            <li className='venue-list-item'>
                <img className='img-venue-thumbnail' src={image}/>
                <div style="display: inline-block;">
                    <a href={url}>{data.name}</a>
                    {buttons}
                </div>
                <p className='li-going'> | {nGoing} going | {userGoing}</p>
                {descrComp}
            </li>
        );
    }

}
{'fraction_non_alphanumeric': 0.11805062692216702, 'fraction_numerical': 0.0004731488052992666, 'mean_word_length': 1.7688277668631303, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 37, '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': '75307', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1201, 'n_words': 311}