<commit_before>/*
 *
 * CatKitDemo
 *
 */

import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import _ from 'lodash';

import { MdChevronLeft, MdChevronRight } from 'react-icons/lib/md';

import { withStyles } from 'material-ui/styles';
import Stepper, { Step, StepLabel } from 'material-ui/Stepper';
import Button from 'material-ui/Button';
import Paper from 'material-ui/Paper';
import Grid from 'material-ui/Grid';

import CatKitDemoHeader from './catKitDemoHeader';
import BulkInput from './BulkInput';
import { CalculationsView } from './CalculationsView';
import { BulkView } from './BulkView';
import SlabInput from './SlabInput';
import { SlabView } from './SlabView';
import AdsorbateInput from './AdsorbateInput';
import { AdsorbateView } from './AdsorbateView';
import DftInput from './DftInput';

import * as actions from './actions';
import { styles } from './styles';

function getSteps() {
  return [
    'Configure bulk structure',
    'Configure surface slab',
    'Add adsorbates',
    'Configure calculator',
  ];
}

function nextStepReady(step, props) {
  switch (step) {
    case 0:
      return !_.isEmpty(props.bulkCif);
    case 1:
      return !_.isEmpty(props.images);
    case 2:
      return true;
    case 3:
      return false;
    default:
      return false;
  }
}

function getStepContent(step, props) {
  switch (step) {
    case 0:
      /* return 'Make choices for bulk cell'*/
      return (
        <div>
          <BulkInput {...props} />
          <BulkView {...props} />
        </div>
      );
    case 1:
      /* return 'Make choices for surface slab'*/
      return (
        <div>
          <SlabInput {...props} />
          <SlabView {...props} />
        </div>
      );
    case 2:
      /* return 'Add some adsorbates'*/
      return (
        <div>
          <AdsorbateInput {...props} />
          <AdsorbateView {...props} />
        </div>
      );
    case 3:
      /* return 'Configure calculator'*/
      return (
        <div>
          <DftInput {...props} />
        </div>
      );
    default:
      return `Unkown step ${typeof activeStep}`;
  }
}

export class CatKitDemo extends React.Component { // eslint-disable-line react/prefer-stateless-function
  handleNext =() => {
    this.props.stepperHandleNext();
  }

  handleReset = () => {
    this.props.stepperHandleReset();
  }

  handleBack = () => {
    this.props.stepperHandleBack();
  }

  render() {
    const steps = getSteps();
    const { activeStep } = this.props;

    return (
      <div>
        <div >
          <div className={this.props.classes.header} >
            <CatKitDemoHeader {...this.props} />
          </div>
          <Paper className={this.props.classes.paper}>
            <Grid
              container
              justify="space-between"
              direction="row"
              className={this.props.classes.buttongrid}
            >
              <Grid item>
                <Stepper activeStep={activeStep} className={this.props.classes.lightsandhill}>
                  {steps.map((label) => {
                    const props = {};
                    const labelProps = {};
                    return (
                      <Step key={label} {...props}>
                        <StepLabel {...labelProps}>{label}</StepLabel>
                      </Step>
                    );
                  })}<commit_msg>Flip stepper vertical on mobile<commit_after>/*
 *
 * CatKitDemo
 *
 */

import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import _ from 'lodash';

import { MdChevronLeft, MdChevronRight } from 'react-icons/lib/md';
import { isMobileOnly } from 'react-device-detect';

import { withStyles } from 'material-ui/styles';
import Stepper, { Step, StepLabel } from 'material-ui/Stepper';
import Button from 'material-ui/Button';
import Paper from 'material-ui/Paper';
import Grid from 'material-ui/Grid';

import CatKitDemoHeader from './catKitDemoHeader';
import BulkInput from './BulkInput';
import { CalculationsView } from './CalculationsView';
import { BulkView } from './BulkView';
import SlabInput from './SlabInput';
import { SlabView } from './SlabView';
import AdsorbateInput from './AdsorbateInput';
import { AdsorbateView } from './AdsorbateView';
import DftInput from './DftInput';

import * as actions from './actions';
import { styles } from './styles';

function getSteps() {
  return [
    'Configure bulk structure',
    'Configure surface slab',
    'Add adsorbates',
    'Configure calculator',
  ];
}

function nextStepReady(step, props) {
  switch (step) {
    case 0:
      return !_.isEmpty(props.bulkCif);
    case 1:
      return !_.isEmpty(props.images);
    case 2:
      return true;
    case 3:
      return false;
    default:
      return false;
  }
}

function getStepContent(step, props) {
  switch (step) {
    case 0:
      /* return 'Make choices for bulk cell'*/
      return (
        <div>
          <BulkInput {...props} />
          <BulkView {...props} />
        </div>
      );
    case 1:
      /* return 'Make choices for surface slab'*/
      return (
        <div>
          <SlabInput {...props} />
          <SlabView {...props} />
        </div>
      );
    case 2:
      /* return 'Add some adsorbates'*/
      return (
        <div>
          <AdsorbateInput {...props} />
          <AdsorbateView {...props} />
        </div>
      );
    case 3:
      /* return 'Configure calculator'*/
      return (
        <div>
          <DftInput {...props} />
        </div>
      );
    default:
      return `Unkown step ${typeof activeStep}`;
  }
}

export class CatKitDemo extends React.Component { // eslint-disable-line react/prefer-stateless-function
  handleNext =() => {
    this.props.stepperHandleNext();
  }

  handleReset = () => {
    this.props.stepperHandleReset();
  }

  handleBack = () => {
    this.props.stepperHandleBack();
  }

  render() {
    const steps = getSteps();
    const { activeStep } = this.props;

    return (
      <div>
        <div >
          <div className={this.props.classes.header} >
            <CatKitDemoHeader {...this.props} />
          </div>
          <Paper className={this.props.classes.paper}>
            <Grid
              container
              justify="space-between"
              direction="row"
              className={this.props.classes.buttongrid}
            >
              <Grid item>
                <Stepper activeStep={activeStep} className={this.props.classes.lightsandhill} orientation={isMobileOnly ? 'vertical' : 'horizontal'}>
                  {steps.map((label) => {
                    const props = {};
                    const labelProps = {};
                    return (
                      <Step key={label} {...props}>
                        <StepLabel {...labelProps}>{label}</StepLabel>
                      </Step>
                    );
                  })}
{'fraction_non_alphanumeric': 0.13914789843637929, 'fraction_numerical': 0.0022952230669918234, 'mean_word_length': 1.951735817104149, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 67, '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': '6026658', 'n_tokens_mistral': 2114, 'n_tokens_neox': 2043, 'n_words': 495}