<commit_before>// dependencies -------------------------------------------------------

import React                     from 'react';
import {OverlayTrigger, Tooltip} from 'react-bootstrap';

export default class WarnButton extends React.Component {

	constructor() {
		super();
		this.state = {
			showAction: false,
			link: null
		};
	}

// life cycle events --------------------------------------------------

	render () {
		let showAction = this.state.showAction;
		let message    = this.props.message;
		let cancel     = this.props.cancel;
		let confirm    = this.props.confirm;
		let tooltip    = <Tooltip>{this.props.tooltip}</Tooltip>;

		let link;
		if (this.state.link) {
			link = (
				<a className="btn btn-admin success" onClick={this.toggle.bind(this)} href={this.state.link} download>
	        		{confirm}
	    		</a>
	    	);
		}

		let confirmBtn = <button className={'btn btn-admin ' + (typeof this.props.tooltip == 'string' ? 'success' : 'delete')} onClick={this.toggle.bind(this, this.props.action)}>{confirm}</button>;

		let viewAction = (
        	<div className="btn-group slideInRightFast" role="group" >
        		<button className="btn btn-admin cancel" onClick={this.toggle.bind(this)}>{cancel}</button>
        		{link ? link : confirmBtn}
        	</div>
        );

        let hideAction = (
        	<div className=" fadeIn" >
        		<button className="btn btn-admin warning" onClick={this.props.warn ? this.toggle.bind(this) : this.props.action}>
	        		<i className={'fa ' + this.props.icon}></i>  {message}
        		</button>
        	</div>
        );

        let button = showAction ? viewAction : hideAction;

        if (this.props.tooltip) {
        	return (
				<OverlayTrigger role="presentation"  placement="top" className="tool" overlay={tooltip}>
					{button}
				</OverlayTrigger>
        	);
        }

		return button;
	}

// custom methods -----------------------------------------------------

	toggle(action) {
		if (this.state.showAction == false) {
			if (this.props.prepDownload) {
				this.props.prepDownload((link) => {
					this.setState({showAction: true, link: link});
				});
				return;
			}
		}
		if (typeof action === 'function') {
			action(() => {
				this.setState({showAction: !this.state.showAction});
			});
		} else {
			this.setState({showAction: !this.state.showAction});
		}
	}
<commit_msg>minor cleanup<commit_after>// dependencies -------------------------------------------------------

import React                     from 'react';
import {OverlayTrigger, Tooltip} from 'react-bootstrap';

export default class WarnButton extends React.Component {

	constructor() {
		super();
		this.state = {
			showAction: false,
			link: null
		};
	}

// life cycle events --------------------------------------------------

	render () {
		let showAction = this.state.showAction;
		let message    = this.props.message;
		let cancel     = this.props.cancel;
		let confirm    = this.props.confirm;
		let tooltip    = <Tooltip>{this.props.tooltip}</Tooltip>;

		let link;
		if (this.state.link) {
			link = (
				<a className="btn btn-admin success" onClick={this.toggle.bind(this)} href={this.state.link} download>
	        		{confirm}
	    		</a>
	    	);
		}

		let confirmBtn = <button className={'btn btn-admin ' + (typeof this.props.tooltip == 'string' ? 'success' : 'delete')} onClick={this.toggle.bind(this, this.props.action)}>{confirm}</button>;

		let viewAction = (
        	<div className="btn-group slideInRightFast" role="group" >
        		<button className="btn btn-admin cancel" onClick={this.toggle.bind(this)}>{cancel}</button>
        		{link ? link : confirmBtn}
        	</div>
        );

        let hideAction = (
        	<div className=" fadeIn" >
        		<button className="btn btn-admin warning" onClick={this.props.warn ? this.toggle.bind(this) : this.props.action}>
	        		<i className={'fa ' + this.props.icon}></i>  {message}
        		</button>
        	</div>
        );

        let button = showAction ? viewAction : hideAction;

        if (this.props.tooltip) {
        	return (
				<OverlayTrigger role="presentation"  placement="top" className="tool" overlay={tooltip}>
					{button}
				</OverlayTrigger>
        	);
        }

		return button;
	}

// custom methods -----------------------------------------------------

	toggle(action) {
		if (this.state.showAction == false && this.props.prepDownload) {
			this.props.prepDownload((link) => {
				this.setState({showAction: true, link: link});
			});
			return;
		}

		if (typeof action === 'function') {
			action(() => {
				this.setState({showAction: !this.state.showAction});
			});
		} else {
			this.setState({showAction: !this.state.showAction});
		}
	}

{'fraction_non_alphanumeric': 0.20966040919637208, 'fraction_numerical': 0.0, 'mean_word_length': 2.0892508143322477, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '238650', 'n_tokens_mistral': 1530, 'n_tokens_neox': 1389, 'n_words': 286}