import DateSelector from '@/components/V2504/DateSelector';
import PanelTitle from '@/pages/Home_v_2504/components/common/PanelTitle';
import { useMapState } from '@/pages/Home_v_2504/components/MapStateContext';
import { Flex } from 'antd';
import dayjs from 'dayjs';
import React, { useCallback, useState } from 'react';
import AbsorbSiteSituation from './AbsorbSiteSituation';
import CertificateOverview from './CertificateOverview';
import DeclaredEmission from './DeclaredEmission';
import DeclareDischargeType from './DeclareDischargeType';
import styles from './index.less';
import VehicleOverview from './VehicleOverview';
import ViolationDumpingLocation from './ViolationDumpingLocation';
/**
 * 建筑垃圾左侧内容组件
 */
const LeftContent: React.FC = () => {
 
  const [searchTime, setSearchTime] = useState<any>({
    startTime: dayjs().startOf('month').format('YYYY-MM-DD'),
    endTime: dayjs().endOf('month').format('YYYY-MM-DD'),
  });

  // 处理日期变化
  const handleDateChange = useCallback(
    (params: { type: string; startTime: string; endTime: string }) => {
      setSearchTime({
        startTime: params.startTime,
        endTime: params.endTime,
      });
    
    },

    [],
  );

  return (
    <div className={styles.container}>
      {/* 标题 */}
      <div className={styles.header}>
        <PanelTitle title="建筑垃圾处置" />
        <DateSelector
        useDefaultTypeFirst={true}
          onChange={handleDateChange}
          defaultType="month"
          panelType="left"
          pageId="constructionWaste"
          timeOptions={['month', 'year', 'range']}
        />
      </div>

      <div className={styles.content}>
        <Flex gap={15}>
          <CertificateOverview searchTime={searchTime} />
          <VehicleOverview searchTime={searchTime} />
        </Flex>
        <Flex gap={15} style={{ marginTop: 20 }}>
          <AbsorbSiteSituation searchTime={searchTime} />
          {/* 疑似违规倾倒点位 */}
          <ViolationDumpingLocation dateType="range" />
        </Flex>
        <Flex gap={15} style={{ marginTop: 20 }}>
          <DeclareDischargeType searchTime={searchTime} />
          {/* 申报排放量 */}
          <DeclaredEmission />
        </Flex>
      </div>
    </div>
  );
};

export default LeftContent;
