<commit_before>import * as React from 'react';
import { connect } from 'react-redux';
import { Creators } from '../actions';
import { IAppState, IAvailability, Availability } from '../models';

export interface DownloadProps {
    fileName: string;
    fileAvailability: IAvailability;
    checkAvailability(fileName: string): void;
}

class Download extends React.Component<DownloadProps, void> {
    componentWillMount(): void {
        const { fileName, checkAvailability } = this.props;
        checkAvailability(fileName);
    }

    render(): JSX.Element {
        return (
            <div>
                <p>this is the download page</p>
                {this._linkIfExists()}
            </div>
        );
    }

    private _linkIfExists(): JSX.Element {
        const { fileName, fileAvailability } = this.props;
        if (fileAvailability === Availability.AVAILABLE) {
            // TODO: make this an environment variable
            return <a href={`https://go-transfer.herokuapp.com/${fileName}`} download={fileName}>DOWNLOAD THE FILE</a>;
        }

        return <p>uh oh... you shouldn't be seeing this.</p>;<commit_msg>download page now has more correct messaging.<commit_after>import * as React from 'react';
import { connect } from 'react-redux';
import { Creators } from '../actions';
import { IAppState, IAvailability, Availability } from '../models';
import { Spinner } from 'react-mdl';

export interface DownloadProps {
    fileName: string;
    fileAvailability: IAvailability;
    checkAvailability(fileName: string): void;
}

class Download extends React.Component<DownloadProps, void> {
    componentWillMount(): void {
        const { fileName, checkAvailability } = this.props;
        checkAvailability(fileName);
    }

    render(): JSX.Element {
        return (
            <div>
                {this._linkIfExists()}
            </div>
        );
    }

    private _linkIfExists(): JSX.Element {
        const { fileName, fileAvailability } = this.props;
        if (fileAvailability === Availability.AVAILABLE) {
            // TODO: make this an environment variable
            return <a href={`https://go-transfer.herokuapp.com/${fileName}`} download={fileName}>DOWNLOAD THE FILE</a>;
        } else if (fileAvailability == Availability.NOT_AVAILABLE) {
            return <p>The file you are looking for has either expired, or never existed.</p>;
        }

        return <Spinner />;
{'fraction_non_alphanumeric': 0.12073921971252567, 'fraction_numerical': 0.0, 'mean_word_length': 2.663157894736842, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1047915', 'n_tokens_mistral': 655, 'n_tokens_neox': 645, 'n_words': 179}