import React, { useMemo } from "react";
import AllSchedules from "./AllSchedules";
import SchedulesForDay from "./SchedulesForDay";
import ScheduleDetailDrawer from "./ScheduleDetailDrawer";
import "./index.less";
/**
 * 日程tab项
 * @param props
 * @constructor
 */
var Schedules = function Schedules(props) {
  var type = props.type,
    detail = props.detail,
    onClose = props.onClose,
    onOpenDetail = props.onOpenDetail,
    dataSource = props.dataSource,
    loading = props.loading,
    onCalendarDataChange = props.onCalendarDataChange,
    onDelete = props.onDelete,
    currentSelectDayDetail = props.currentSelectDayDetail,
    onCloseDay = props.onCloseDay,
    schedulesForDaySlot = props.schedulesForDaySlot,
    scheduleMap = props.scheduleMap;
  var id = detail.id,
    show = detail.show,
    createType = detail.type;
  var content = useMemo(function () {
    if (type === "all") {
      return /*#__PURE__*/React.createElement(AllSchedules, {
        onOpenDetail: onOpenDetail,
        dataSource: dataSource,
        loading: loading
      });
    } else if (type === "forADay") {
      return /*#__PURE__*/React.createElement(SchedulesForDay, {
        onOpenDetail: onOpenDetail,
        dataSource: dataSource,
        loading: loading,
        currentSelectDayDetail: currentSelectDayDetail,
        onCloseDay: onCloseDay,
        slot: schedulesForDaySlot,
        scheduleMap: scheduleMap
      });
    }
    return null;
  }, [type, dataSource, loading, currentSelectDayDetail, schedulesForDaySlot, scheduleMap]);
  return /*#__PURE__*/React.createElement(React.Fragment, null, content, /*#__PURE__*/React.createElement(ScheduleDetailDrawer, {
    type: createType,
    scheduleId: id,
    open: show,
    onClose: onClose,
    onDelete: onDelete,
    onCalendarDataChange: onCalendarDataChange
  }));
};
export default Schedules;