import { CronInput } from "~/client/components/cron-input"; import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "~/client/components/ui/form"; import { Input } from "~/client/components/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "~/client/components/ui/select"; import { Button } from "~/client/components/ui/button"; import type { UseFormReturn } from "react-hook-form"; import type { InternalFormValues } from "./types"; import { weeklyDays } from "./types"; type FrequencySectionProps = { form: UseFormReturn; frequency: string; }; export const FrequencySection = ({ form, frequency }: FrequencySectionProps) => { return ( <> ( Backup frequency Define how often snapshots should be taken. )} /> {frequency === "cron" && ( ( )} /> )} {frequency !== "hourly" && frequency !== "cron" && ( ( Execution time Time of day when the backup will run. )} /> )} {frequency === "weekly" && ( ( Execution day Choose which day of the week to run the backup. )} /> )} {frequency === "monthly" && ( ( Days of the month
{Array.from({ length: 31 }, (_, i) => { const day = (i + 1).toString(); const isSelected = field.value?.includes(day); return ( ); })}
Select one or more days when the backup should run.
)} /> )} ); };