import type { FC } from 'react';
import { Suspense, useState } from 'react';
import { EllipsisOutlined } from '@ant-design/icons';
import { Col, Dropdown, Menu, Row } from 'antd';
import { GridContent } from '@ant-design/pro-layout';
import type { RadioChangeEvent } from 'antd/es/radio';
import type { RangePickerProps } from 'antd/es/date-picker/generatePicker';
import type moment from 'moment';
import IntroduceRow from './components/IntroduceRow';
import TrainingRow from './components/CourseRow';

import TopSearch from './components/TopSearch';
import ProportionSales from './components/ProportionSales';
import OfflineData from './components/OfflineData';
import { useRequest } from 'umi';

import { fakeChartData, subjectAndCourseNumberStatistics } from './service';
import PageLoading from './components/PageLoading';
import type { TimeType } from './components/CourseRow';
import { getTimeDistance } from './utils/utils';
import type { AnalysisData } from './data.d';
import styles from './style.less';
import CourseRow from './components/CourseRow';

type RangePickerValue = RangePickerProps<moment.Moment>['value'];

type AnalysisProps = {
  dashboardAndanalysis: AnalysisData;
  loading: boolean;
};

//type SalesType = 'all' | 'online' | 'stores';

const Analysis: FC<AnalysisProps> = () => {

  //const { loading: subjectAndCourseLoading, data: subjectAndCourseData = [] } = useRequest(subjectAndCourseNumberStatistics); // 主题数、课程数统计



  const [salesType, setSalesType] = useState<SalesType>('all');
  const [currentTabKey, setCurrentTabKey] = useState<string>('');
  const [rangePickerValue, setRangePickerValue] = useState<RangePickerValue>(
    getTimeDistance('year'),
  );


  const loading = ""
  const handleRangePickerChange = (value: RangePickerValue) => {
    setRangePickerValue(value);
  };


  //console.log('subjectAndCourseData', subjectAndCourseData);
  return (
    <GridContent>
      <>
        {/** 主题数, 课程数 | 培训情况 */}
        <Suspense fallback={<PageLoading />}>
          <IntroduceRow />
        </Suspense>
        <Suspense fallback={null}>
          {/** 课程浏览量/月柱形图 需要处理 */}
          <CourseRow
            rangePickerValue={rangePickerValue}

            isActive={true}
            handleRangePickerChange={handleRangePickerChange}
            loading={loading}
          />
        </Suspense>
      </>
    </GridContent>
  );
};

export default Analysis;


