<commit_before>import React, { Component } from 'react';
import { connect } from 'react-redux';

import { logoutUser, deleteListing } from '../actions/index';

class ModalComponent extends Component {
    constructor(props) {
        super(props);

        this.removeThisModal = this.removeThisModal.bind(this);
        this.logout = this.logout.bind(this);
    }

    removeThisModal() {
        this.props.removeModal();
    }

    logout() {
        const { context } = this.props;

        this.props.logoutUser().then(() => {
            this.removeThisModal();

            return context.push('/');
        });
    }

    deleteListing(listingID) {
        const { context } = this.props;

        this.props.deleteListing(listingID).then(() => {
            this.removeThisModal();

            return context.push('/app/dashboard');
        });
    }

    determineLayout(modalType) {
        switch (modalType) {
            case 'logout':
                return (
                    <div>
                        <button onClick={ this.logout } className='btn btn-danger pull-left'>Log out</button>
                        <button onClick={ this.removeThisModal } className='btn btn-default pull-right'>Cancel</button>
                    </div>
                );
            case 'deleteListing':
                return (
                    <div>
                        <button onClick={ () => this.deleteListing(this.props.listingID) } className='btn btn-danger pull-left'>Delete</button>
                        <button onClick={ this.removeThisModal } className='btn btn-default pull-right'>Cancel</button>
                    </div>
                );
        }
    }

    render() {
        const { message, modalType } = this.props;<commit_msg>Reload dashboard view when listing is deleted<commit_after>import React, { Component } from 'react';
import { connect } from 'react-redux';

import { logoutUser, deleteListing } from '../actions/index';

class ModalComponent extends Component {
    constructor(props) {
        super(props);

        this.removeThisModal = this.removeThisModal.bind(this);
        this.logout = this.logout.bind(this);
    }

    removeThisModal() {
        this.props.removeModal();
    }

    logout() {
        const { context } = this.props;

        this.props.logoutUser().then(() => {
            this.removeThisModal();

            return context.push('/');
        });
    }

    deleteListing(listingID) {
        const { context } = this.props;

        this.props.deleteListing(listingID).then(() => {
            this.removeThisModal();

            context.push('/app');
            return context.push('/app/dashboard')
        });
    }

    determineLayout(modalType) {
        switch (modalType) {
            case 'logout':
                return (
                    <div>
                        <button onClick={ this.logout } className='btn btn-danger pull-left'>Log out</button>
                        <button onClick={ this.removeThisModal } className='btn btn-default pull-right'>Cancel</button>
                    </div>
                );
            case 'deleteListing':
                return (
                    <div>
                        <button onClick={ () => this.deleteListing(this.props.listingID) } className='btn btn-danger pull-left'>Delete</button>
                        <button onClick={ this.removeThisModal } className='btn btn-default pull-right'>Cancel</button>
                    </div>
                );
        }
    }

    render() {
        const { message, modalType } = this.props;
{'fraction_non_alphanumeric': 0.12836899138649624, 'fraction_numerical': 0.0, 'mean_word_length': 1.7149321266968325, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 33, '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': '5543036', 'n_tokens_mistral': 965, 'n_tokens_neox': 912, 'n_words': 176}