<commit_before>import React from "react";
import { Row, Col, Modal } from "react-bootstrap";
import { connect } from "react-redux";
import { updateSubtraction } from "../actions";
import { Button, InputError } from "../../base";

const getInitialState = (props) => ({
    subtractionId: props.entry.id,
    fileId: props.entry.file.name,
    nickname: props.entry.nickname
});

class EditSubtraction extends React.Component {

    constructor (props) {
        super(props);
        this.state = getInitialState(this.props);
    }

    handleSubmit = (e) => {
        e.preventDefault();
        this.props.onUpdate(this.state.subtractionId, this.state.nickname);
        this.props.exited();
    };

    render () {

        return (
            <Modal
                show={this.props.show}
                onHide={this.props.exited}
                onExited={this.props.exited}
            >
                <Modal.Header closeButton>
                    Edit Subtraction
                </Modal.Header>
                <Modal.Body style={{margin: "0 0 10px 0"}}>
                    <Row>
                        <Col md={12}>
                            <InputError
                                type="text"
                                label="Unique Name"
                                value={this.state.subtractionId}
                                readOnly
                            />
                        </Col>
                    </Row>
                    <Row>
                        <Col md={12}>
                            <InputError
                                type="text"
                                label="Nickname"
                                value={this.state.nickname}
                                onChange={(e) => this.setState({nickname: e.target.value})}
                            />
                        </Col>
                    </Row>
                    <Row>
                        <Col md={12}>
                            <InputError
                                type="text"
                                label="File"
                                value={this.state.fileId}
                                readOnly
                            />
                        </Col>
                    </Row>
                </Modal.Body>

                <Modal.Footer className="modal-footer">
                    <Button
                        type="submit"
                        bsStyle="primary"
                        icon="save"
                        onClick={this.handleSubmit}
                        pullRight
                    >
                        Save
                    </Button>
                </Modal.Footer>
            </Modal>
        );
    }
}

const mapDispatchToProps = (dispatch) => ({
    onUpdate: (id, nickname) => {
        dispatch(updateSubtraction(id, nickname));
    }
});

export default connect(null, mapDispatchToProps)(EditSubtraction);
<commit_msg>Update subtraction edit submit on enter key<commit_after>import React from "react";
import { Row, Col, Modal } from "react-bootstrap";
import { connect } from "react-redux";
import { updateSubtraction } from "../actions";
import { Button, InputError } from "../../base";

const getInitialState = (props) => ({
    subtractionId: props.entry.id,
    fileId: props.entry.file.name,
    nickname: props.entry.nickname
});

class EditSubtraction extends React.Component {

    constructor (props) {
        super(props);
        this.state = getInitialState(this.props);
    }

    handleSubmit = (e) => {
        e.preventDefault();
        this.props.onUpdate(this.state.subtractionId, this.state.nickname);
        this.props.exited();
    };

    render () {

        return (
            <Modal
                show={this.props.show}
                onHide={this.props.exited}
                onExited={this.props.exited}
            >
                <Modal.Header closeButton>
                    Edit Subtraction
                </Modal.Header>
                <form onSubmit={this.handleSubmit}>
                    <Modal.Body style={{margin: "0 0 10px 0"}}>
                        <Row>
                            <Col md={12}>
                                <InputError
                                    type="text"
                                    label="Unique Name"
                                    value={this.state.subtractionId}
                                    readOnly
                                />
                            </Col>
                        </Row>
                        <Row>
                            <Col md={12}>
                                <InputError
                                    type="text"
                                    label="Nickname"
                                    value={this.state.nickname}
                                    onChange={(e) => this.setState({nickname: e.target.value})}
                                />
                            </Col>
                        </Row>
                        <Row>
                            <Col md={12}>
                                <InputError
                                    type="text"
                                    label="File"
                                    value={this.state.fileId}
                                    readOnly
                                />
                            </Col>
                        </Row>
                    </Modal.Body>

                    <Modal.Footer className="modal-footer">
                        <Button
                            type="submit"
                            bsStyle="primary"
                            icon="save"
                            pullRight
                        >
                            Save
                        </Button>
                    </Modal.Footer>
                </form>
            </Modal>
        );
    }
}

const mapDispatchToProps = (dispatch) => ({
    onUpdate: (id, nickname) => {
        dispatch(updateSubtraction(id, nickname));
    }
});

export default connect(null, mapDispatchToProps)(EditSubtraction);

{'fraction_non_alphanumeric': 0.10107073329007138, 'fraction_numerical': 0.0035691109669046075, 'mean_word_length': 0.859167671893848, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1074552', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1370, 'n_words': 252}