<commit_before>import React from 'react';
import RaisedButton from 'material-ui/RaisedButton';
import ContentSave from 'material-ui/svg-icons/content/save';

const SaveButton = () => <RaisedButton
    type="submit"
    label="Save"
    icon={<ContentSave />}
    primary
    style={{
        margin: '10px 24px',
        position: 'relative',
    }}
/>;

export default SaveButton;<commit_msg>Add double submission protection in Save button<commit_after>import React, { Component } from 'react';
import RaisedButton from 'material-ui/RaisedButton';
import ContentSave from 'material-ui/svg-icons/content/save';
import CircularProgress from 'material-ui/CircularProgress';

class SaveButton extends Component {
    constructor(props) {
        super(props);
        this.state = {
            submitting: false,
        };
    }

    handleClick = (e) => {
        if (this.state.submitting) {
            // prevent double submission
            e.preventDefault();
        }
        this.setState({ submitting: true });
    }

    render() {
        return <RaisedButton
            type="submit"
            label="Save"
            icon={this.state.submitting ? <CircularProgress size={25} thickness={2} /> : <ContentSave />}
            onClick={this.handleClick}
            primary={!this.state.submitting}
            style={{
                margin: '10px 24px',
                position: 'relative',
            }}
        />;
    }
}

export default SaveButton;
{'fraction_non_alphanumeric': 0.12236573759347383, 'fraction_numerical': 0.007477906186267845, 'mean_word_length': 2.3378684807256236, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, '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': '6585733', 'n_tokens_mistral': 417, 'n_tokens_neox': 399, 'n_words': 91}