<commit_before>//@flow

import React, {Component, PropTypes} from 'react';
import {
  Button,
  Checkbox,
  Col,
  ControlLabel,
  DropdownButton,
  Form,
  FormControl,
  FormGroup,
  MenuItem,
  Modal,
} from 'react-bootstrap';
import {connect} from 'react-redux';

import {
  ArrayToFuncSet,
  FuncSetToArray,
  //LoadFuncSets,*/
  SaveFuncSets
} from './LoadSave';
import {Actions} from './coasterRedux';

import type {FuncArray} from './UserFunction';
import type {FuncSetsType, FlatFunc} from './LoadSave';
import type {GraphState, dispatchType} from './coasterRedux';

type FileDialogState = {
  showModal : boolean,
  // settings: {
  cart : boolean,
  velocity : boolean,
  labels : boolean,
  //},
  // loader: {
  loadSelection : string,
  funcsets : FuncSetsType;
  //},
  // saver: {
  saveName : string,
  //},
};

type FileDialogProps = {
  cart : boolean,
  velocity : boolean,
  labels : boolean,
  curFuncs : FuncArray,
  onSave : (cart: boolean, velocity: boolean, labels: boolean) => void,
  onLoad : (funcSet: FuncArray) => void,
};

export class UnboundFileDialog extends Component {
  state: FileDialogState;
  constructor(props: FileDialogProps) {
    super(props);
    this.state = {
      showModal : false,

      cart : props.cart,
      velocity : props.velocity,
      labels : props.labels,

      loadSelection : '',
      funcsets : new Map(),

      saveName : ''
    };
  }
  open = () => {
    this.setState({showModal : true});
  }
  close = () => {
    this.setState({showModal : false});
  }
  loadSelect = (which: string) => {<commit_msg>It would help if I actually *loaded* something I saved...<commit_after>//@flow

import React, {Component, PropTypes} from 'react';
import {
  Button,
  Checkbox,
  Col,
  ControlLabel,
  DropdownButton,
  Form,
  FormControl,
  FormGroup,
  MenuItem,
  Modal,
} from 'react-bootstrap';
import {connect} from 'react-redux';

import {
  ArrayToFuncSet,
  FuncSetToArray,
  LoadFuncSets,
  SaveFuncSets
} from './LoadSave';
import {Actions} from './coasterRedux';

import type {FuncArray} from './UserFunction';
import type {FuncSetsType, FlatFunc} from './LoadSave';
import type {GraphState, dispatchType} from './coasterRedux';

type FileDialogState = {
  showModal : boolean,
  // settings: {
  cart : boolean,
  velocity : boolean,
  labels : boolean,
  //},
  // loader: {
  loadSelection : string,
  funcsets : FuncSetsType;
  //},
  // saver: {
  saveName : string,
  //},
};

type FileDialogProps = {
  cart : boolean,
  velocity : boolean,
  labels : boolean,
  curFuncs : FuncArray,
  onSave : (cart: boolean, velocity: boolean, labels: boolean) => void,
  onLoad : (funcSet: FuncArray) => void,
};

export class UnboundFileDialog extends Component {
  state: FileDialogState;
  constructor(props: FileDialogProps) {
    super(props);
    const funcsets = LoadFuncSets();
    let loadSelection:string = '';
    for (loadSelection of funcsets.keys()) break;
    this.state = {
      showModal : false,

      cart : props.cart,
      velocity : props.velocity,
      labels : props.labels,

      loadSelection,
      funcsets,

      saveName : ''
    };
  }
  open = () => {
    this.setState({showModal : true});
  }
  close = () => {
    this.setState({showModal : false});
  }
  loadSelect = (which: string) => {
{'fraction_non_alphanumeric': 0.1387458345955771, 'fraction_numerical': 0.0, 'mean_word_length': 3.2063694267515923, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '7104144', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1063, 'n_words': 269}