<commit_before>/**
* GenerateDetachedFilesPage.jsx
* Created by <NAME>
**/

import ReactCSSTransitionGroup from 'react-addons-css-transition-group';

import React from 'react';
import moment from 'moment';
import Navbar from '../SharedComponents/navigation/NavigationComponent.jsx';
import Footer from '../SharedComponents/FooterComponent.jsx';
import AgencyListContainer from '../../containers/SharedContainers/AgencyListContainer.jsx';
import DateSelect from './DateSelect.jsx';

import * as GenerateFilesHelper from '../../helpers/generateFilesHelper.js';

import * as Icons from '../SharedComponents/icons/Icons.jsx';

const timerDuration = 10;

export default class GenerateDetachedFilesPage extends React.Component {
    constructor(props) {
        super(props);

        this.state = {
            agency: "",
            agencyError: false,
            showDateSelect: false,
            showSubmitButton: false,
            buttonDisabled: true,
            d1: {
				startDate: null,
				endDate: null,
				error: {
					show: false,
					header: '',
					description: ''
				},
				download: {
					show: false,
					url: ''
				},
                valid: false,
                status: ""
			},
			d2: {
				startDate: null,
				endDate: null,
				error: {
					show: false,
					header: '',
					description: ''
				},
				download: {
					show: false,
					url: ''
				},
                valid: false,
                status: ""
			}
        };
    }

    handleChange(agency, isValid){
        // display or hide file generation based on agency validity and set agency
        if (agency != '' && isValid) {
            this.setState({
                agency: agency,
                agencyError: false
             }, this.checkComplete);
        }
        else {
            this.setState({
                agency: '',
                agencyError: true
            }, this.checkComplete);
        }
    }

    checkComplete() {
        // actually display/hide the file generation<commit_msg>Fixing "unmounted" issue<commit_after>/**
* GenerateDetachedFilesPage.jsx
* Created by <NAME>
**/

import ReactCSSTransitionGroup from 'react-addons-css-transition-group';

import React from 'react';
import moment from 'moment';
import Navbar from '../SharedComponents/navigation/NavigationComponent.jsx';
import Footer from '../SharedComponents/FooterComponent.jsx';
import AgencyListContainer from '../../containers/SharedContainers/AgencyListContainer.jsx';
import DateSelect from './DateSelect.jsx';

import * as GenerateFilesHelper from '../../helpers/generateFilesHelper.js';

import * as Icons from '../SharedComponents/icons/Icons.jsx';

const timerDuration = 10;

export default class GenerateDetachedFilesPage extends React.Component {
    constructor(props) {
        super(props);

        this.isUnmounted = false;

        this.state = {
            agency: "",
            agencyError: false,
            showDateSelect: false,
            showSubmitButton: false,
            buttonDisabled: true,
            d1: {
				startDate: null,
				endDate: null,
				error: {
					show: false,
					header: '',
					description: ''
				},
				download: {
					show: false,
					url: ''
				},
                valid: false,
                status: ""
			},
			d2: {
				startDate: null,
				endDate: null,
				error: {
					show: false,
					header: '',
					description: ''
				},
				download: {
					show: false,
					url: ''
				},
                valid: false,
                status: ""
			}
        };
    }

    componentDidMount() {
		this.isUnmounted = false;
	}

	componentWillUnmount() {
		this.isUnmounted = true;
	}

    handleChange(agency, isValid){
        // display or hide file generation based on agency validity and set agency
        if (agency != '' && isValid) {
            this.setState({
                agency: agency,
                agencyError: false
             }, this.checkComplete);
        }
        else {
            this.setState({
                agency: '',
                agencyError: true
            }, this.checkComplete);
        }
    }

    checkComplete() {
        // actually display/hide the file generation
{'fraction_non_alphanumeric': 0.11462072266092367, 'fraction_numerical': 0.00191433357262503, 'mean_word_length': 1.9333333333333333, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3229116', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1119, 'n_words': 275}