<commit_before>import React, { Component, PropTypes } from 'react'
import { IndexLink, Link } from 'react-router'

import FeedbackPanel from './feedbackPanel'

import styles from '../styles/core.scss'
import classNames from 'classnames/bind'

let cx = classNames.bind(styles)

// Note: Stateless/function components *will not* hot reload!
// react-transform *only* works on component classes.
//
// Since layouts rarely change, they are a good place to
// leverage React's new Statelesss Functions:
// https://facebook.github.io/react/docs/reusable-components.html#stateless-functions
//
// App is a pure function of it's props, so we can
// define it with a plain javascript function...
// export default function App({ children, state }) {
export default function App({ location, children, store }) {
	// console.log('this.props: ', this.props)
	// console.log('this.context: ', this.context)
	// let { children, state } = this.props

	// console.log('app.location: ', location)

	let { state, actions } = store

	if (!state.config) {
		return (
			<div></div>
		)
	}

	let alert = null
	if ( state.feedback.length !== 0) {
		alert = (
			<section className={cx('row', 'bottom-spacer-half')}>
				<div className={cx('col-xs-12')}>
					<FeedbackPanel {...store} />
				</div>
			</section>
		)
	}

	let stats = null
	if (state.stats !== '') {
		stats = (
			<span>{state.stats}</span>
		)
	}

	let progress = null
	if (state.opInProgress) {
		progress = (
			<div className={cx('loading')}>
				<div className={cx('loading-bar')}></div>
				<div className={cx('loading-bar')}></div>
				<div className={cx('loading-bar')}></div>
				<div className={cx('loading-bar')}></div>
			</div>
		)
	}

	const stateOk = state.unraid && state.unraid.condition.state === "STARTED"
	const disabled = state.opInProgress || (!stateOk)

	// <span className={cx('lspacer')}>STATUS:</span>
	const labelStyle = cx({
		'spacer': true,
		'label': true,
		'label-success': stateOk,
		'label-alert': !stateOk,
	})

	// let status = null
	let buttons = null
	if (location.pathname === '/' && state.unraid) {
		// status = (
		// 	<div className={cx('flexSection', 'middle-xs')}>
		// 		<span className={labelStyle}>{state.unraid.condition.state}</span>
		// 	</div>
		// )

		buttons = (
			<div className={cx('flexSection', 'end-xs')}>
				<button className={cx('btn', 'btn-primary')} onClick={() => actions.calculate()} disabled={disabled}>CALCULATE</button>
				<button className={cx('btn', 'btn-primary', 'lspacer')} onClick={move.bind(null, actions)} disabled={state.moveDisabled || state.opInProgress}>MOVE</button>
				<span>&nbsp; | &nbsp;</span>
				<div className={cx('flexSection', 'middle-xs', 'rspacer')}>
					<input type="checkbox" checked={state.config.dryRun} onChange={toggleDryRun.bind(null, actions)} disabled={disabled} />
					&nbsp;
					<label>dry run</label><commit_msg>Modify button disabling logic<commit_after>import React, { Component, PropTypes } from 'react'
import { IndexLink, Link } from 'react-router'

import FeedbackPanel from './feedbackPanel'

import styles from '../styles/core.scss'
import classNames from 'classnames/bind'

let cx = classNames.bind(styles)

// Note: Stateless/function components *will not* hot reload!
// react-transform *only* works on component classes.
//
// Since layouts rarely change, they are a good place to
// leverage React's new Statelesss Functions:
// https://facebook.github.io/react/docs/reusable-components.html#stateless-functions
//
// App is a pure function of it's props, so we can
// define it with a plain javascript function...
// export default function App({ children, state }) {
export default function App({ location, children, store }) {
	// console.log('this.props: ', this.props)
	// console.log('this.context: ', this.context)
	// let { children, state } = this.props

	// console.log('app.location: ', location)

	let { state, actions } = store

	if (!state.config) {
		return (
			<div></div>
		)
	}

	let alert = null
	if ( state.feedback.length !== 0) {
		alert = (
			<section className={cx('row', 'bottom-spacer-half')}>
				<div className={cx('col-xs-12')}>
					<FeedbackPanel {...store} />
				</div>
			</section>
		)
	}

	let stats = null
	if (state.stats !== '') {
		stats = (
			<span>{state.stats}</span>
		)
	}

	let progress = null
	if (state.opInProgress) {
		progress = (
			<div className={cx('loading')}>
				<div className={cx('loading-bar')}></div>
				<div className={cx('loading-bar')}></div>
				<div className={cx('loading-bar')}></div>
				<div className={cx('loading-bar')}></div>
			</div>
		)
	}

	const stateOk = state.unraid && state.unraid.condition.state === "STARTED"
	const disabled = state.opInProgress || (!stateOk) || (Object.keys(state.tree.chosen).length === 0)

	// <span className={cx('lspacer')}>STATUS:</span>
	const labelStyle = cx({
		'spacer': true,
		'label': true,
		'label-success': stateOk,
		'label-alert': !stateOk,
	})

	// let status = null
	let buttons = null
	if (location.pathname === '/' && state.unraid) {
		// status = (
		// 	<div className={cx('flexSection', 'middle-xs')}>
		// 		<span className={labelStyle}>{state.unraid.condition.state}</span>
		// 	</div>
		// )

		buttons = (
			<div className={cx('flexSection', 'end-xs')}>
				<button className={cx('btn', 'btn-primary')} onClick={() => actions.calculate()} disabled={disabled}>CALCULATE</button>
				<button className={cx('btn', 'btn-primary', 'lspacer')} onClick={move.bind(null, actions)} disabled={state.moveDisabled || state.opInProgress}>MOVE</button>
				<span>&nbsp; | &nbsp;</span>
				<div className={cx('flexSection', 'middle-xs', 'rspacer')}>
					<input type="checkbox" checked={state.config.dryRun} onChange={toggleDryRun.bind(null, actions)} disabled={state.moveDisabled || state.opInProgress} />
					&nbsp;
					<label>dry run</label>
{'fraction_non_alphanumeric': 0.18979976039705632, 'fraction_numerical': 0.001198014718466541, 'mean_word_length': 3.8217821782178216, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 77, 'https://': 2, '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': '2333512', 'n_tokens_mistral': 2092, 'n_tokens_neox': 1907, 'n_words': 435}