2023-12-21 12:11:27 +00:00
|
|
|
import React, { useMemo, memo } from "react";
|
|
|
|
|
|
|
|
import { Select } from "./Select";
|
|
|
|
|
|
|
|
import type { WeekDaysProps } from "../Cron.types";
|
|
|
|
|
|
|
|
export const WeekDays = memo(
|
2024-01-24 13:39:37 +00:00
|
|
|
({ setWeekDays, unit, isWeek, weekDays, monthDays, t }: WeekDaysProps) => {
|
2023-12-21 12:11:27 +00:00
|
|
|
const placeholder = useMemo(() => {
|
|
|
|
const isEmpty = monthDays.length === 0;
|
|
|
|
|
|
|
|
return isEmpty || isWeek ? t("EveryDayOfTheWeek") : t("DayOfTheWeek");
|
|
|
|
}, [monthDays.length, isWeek, t]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Select
|
2024-01-24 13:39:37 +00:00
|
|
|
unit={unit}
|
2023-12-21 12:11:27 +00:00
|
|
|
value={weekDays}
|
|
|
|
setValue={setWeekDays}
|
|
|
|
dropDownMaxHeight={300}
|
2024-01-24 13:39:37 +00:00
|
|
|
placeholder={placeholder}
|
2023-12-21 12:11:27 +00:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
WeekDays.displayName = "WeekDays";
|