import { Button, DatePicker, DatePickerProps, Flex, Select, Space } from 'antd';
import React, { useEffect, useRef, useState } from 'react';
import { SettingOutlined } from '@ant-design/icons';
import { useDispatch } from 'react-redux';
import { setDate, setType, toggleSettingsDrawer } from '@/features/schedule/scheduleSlice';
import ScheduleSettingsDrawer from '@/features/schedule/ScheduleSettingsDrawer';
import dayjs from 'dayjs';
import { useTranslation } from 'react-i18next';
import { useDocumentTitle } from '@/hooks/useDoumentTItle';
import ScheduleDrawer from '@/features/schedule/ScheduleDrawer';
import GranttChart from '@/components/schedule/grant-chart/grantt-chart';
import { useAppSelector } from '@/hooks/useAppSelector';
import { PickerType } from '@/types/schedule/schedule-v2.types';
import { evt_schedule_page_visit } from '@/shared/worklenz-analytics-events';
import { useMixpanelTracking } from '@/hooks/useMixpanelTracking';
const { Option } = Select;
const PickerWithType = ({
type,
onChange,
date,
}: {
type: PickerType;
onChange: DatePickerProps['onChange'];
date?: Date;
}) => {
return ;
};
const Schedule: React.FC = () => {
const { t } = useTranslation('schedule');
const dispatch = useDispatch();
const granttChartRef = useRef(null);
const { date, type } = useAppSelector(state => state.scheduleReducer);
const { trackMixpanelEvent } = useMixpanelTracking();
useDocumentTitle('Schedule');
const handleDateChange = (value: dayjs.Dayjs | null) => {
if (!value) return;
let selectedDate = value.toDate();
// If 'Month' is selected, default to the first day of the selected month
if (type === 'month') {
selectedDate = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), 1);
}
dispatch(setDate(selectedDate));
};
const handleToday = () => {
const today = new Date();
setDate(today);
granttChartRef.current?.scrollToToday();
console.log('Today:', today);
};
useEffect(() => {
trackMixpanelEvent(evt_schedule_page_visit);
}, []);
return (
);
};
export default Schedule;