<commit_before>import {isEmpty} from "ramda";
import React, {Component, PropTypes} from "react";
import {Grid} from "react-bootstrap";
import {connect} from "react-redux";

import Header from "components/header";
import * as colors from "lib/colors";
import measures from "lib/measures";

const styles = {
    header: {
        width: "100%",
        height: measures.headerHeightPx
    },
    content: {
        width: "100%"
    },
    emptySettingsWarning: {
        color: colors.red,
        textAlign: "center"
    }
};

class Root extends Component {

    static propTypes = {
        children: PropTypes.node.isRequired,
        emptySettings: PropTypes.bool.isRequired
    };

    renderEmptySettingsWarning () {
        return (
            <h3 style={styles.emptySettingsWarning}>
                {"Configuration needed"}
            </h3>
        );
    }

    render () {
        const {children, emptySettings} = this.props;
        return (
            <div>
                <Grid>
                    <div style={styles.header}>
                        <Header />
                    </div>
                </Grid>
                <hr style={{marginTop: "0px"}} />
                <Grid>
                    <div style={styles.content}>
                        {emptySettings ? this.renderEmptySettingsWarning() : children}
                    </div>
                </Grid>
            </div>
        );
    }

}

function mapStateToProps (state) {
    return {
        emptySettings: isEmpty(state.settings)
    };
}
export default connect(mapStateToProps)(Root);<commit_msg>Render settings page if settings are empty<commit_after>import {isEmpty} from "ramda";
import React, {Component, PropTypes} from "react";
import {Grid} from "react-bootstrap";
import {connect} from "react-redux";

import Header from "components/header";
import measures from "lib/measures";
import Settings from "views/settings";

const styles = {
    header: {
        width: "100%",
        height: measures.headerHeightPx
    },
    content: {
        width: "100%"
    }
};

class Root extends Component {

    static propTypes = {
        children: PropTypes.node.isRequired,
        emptySettings: PropTypes.bool.isRequired
    };

    renderEmptySettingsWarning () {
        return (
            <h3 style={styles.emptySettingsWarning}>
                {"Configuration needed"}
            </h3>
        );
    }

    render () {
        const {children, emptySettings} = this.props;
        return (
            <div>
                <Grid>
                    <div style={styles.header}>
                        <Header />
                    </div>
                </Grid>
                <hr style={{marginTop: "0px"}} />
                <Grid>
                    <div style={styles.content}>
                        {emptySettings ? <Settings /> : children}
                    </div>
                </Grid>
            </div>
        );
    }

}

function mapStateToProps (state) {
    return {
        emptySettings: isEmpty(state.settings)
    };
}
export default connect(mapStateToProps)(Root);
{'fraction_non_alphanumeric': 0.11755233494363929, 'fraction_numerical': 0.005797101449275362, 'mean_word_length': 1.668384879725086, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, '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': '4288400', 'n_tokens_mistral': 841, 'n_tokens_neox': 806, 'n_words': 193}