import React, { Component, PropTypes } from 'react';
import { CircularProgress } from 'material-ui';
import Spacing from 'material-ui/styles/spacing';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import UCdefaultTheme from '../../themes/DefaultTheme.js';
import Pagelet from '../Pagelet/Pagelet';


import './CourseHistory.css';
import CourseHistoryTab from './CourseHistoryTab';


export default class CourseHistory extends Component {

  constructor(props) {
    super(props);
    this.state = {
      defaultSlideIndex: 1,
    };
  }
  getChildContext() {
    const theme = getMuiTheme(UCdefaultTheme);
    theme.appBar.textColor = 'black';
    theme.appBar.spacing = Spacing.desktopSubheaderHeight;
    return {
      muiTheme: theme,
    };
  }

  render() {
    const { coursesData, isFetching } = this.props;
    let content = 'No data is available';
    if (coursesData.terms) {
      content = <CourseHistoryTab terms={coursesData.terms} initialTerms={coursesData.initialTermIds}/>;
    }

    return (
      <div className="courses-wrapper">
        {content}
      </div>
    );
  }
}

CourseHistory.propTypes = {
  coursesData: PropTypes.object,
  isFetching: PropTypes.bool,
};

CourseHistory.defaultProps = {
  coursesData: {},
  isFetching: true,
};

CourseHistory.childContextTypes = {
  muiTheme: PropTypes.object,
};
