diff --git a/src/components/molecules/ScheduleSettings.tsx b/src/components/molecules/ScheduleSettings.tsx index 5edf999b..ad17f38b 100644 --- a/src/components/molecules/ScheduleSettings.tsx +++ b/src/components/molecules/ScheduleSettings.tsx @@ -17,7 +17,7 @@ interface ScheduleSettingsProps { export interface ScheduleSettings { runEvery: number; runEveryUnit: string; - startFrom: string; + startFrom: string; dayOfMonth?: string; atTimeStart?: string; atTimeEnd?: string; @@ -29,8 +29,8 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia const [settings, setSettings] = useState({ runEvery: 1, runEveryUnit: 'HOURS', - startFrom: 'MONDAY', - dayOfMonth: '1', + startFrom: 'MONDAY', + dayOfMonth: '1', atTimeStart: '00:00', atTimeEnd: '01:00', timezone: 'UTC' @@ -67,6 +67,16 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia 'MONTHS' ]; + const days = [ + 'MONDAY', + 'TUESDAY', + 'WEDNESDAY', + 'THURSDAY', + 'FRIDAY', + 'SATURDAY', + 'SUNDAY' + ]; + const { recordingId } = useGlobalInfoStore(); const deleteRobotSchedule = () => { @@ -81,7 +91,7 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia runEvery: 1, runEveryUnit: 'HOURS', startFrom: 'MONDAY', - dayOfMonth: '', + dayOfMonth: '', atTimeStart: '00:00', atTimeEnd: '01:00', timezone: 'UTC' @@ -124,7 +134,7 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia {schedule !== null ? ( <> Run every: {schedule.runEvery} {schedule.runEveryUnit.toLowerCase()} - Start from: {schedule.startFrom.charAt(0).toUpperCase() + schedule.startFrom.slice(1).toLowerCase()} + {['MONTHS', 'WEEKS'].includes(settings.runEveryUnit) ? "Start From" : "On"} {schedule.startFrom.charAt(0).toUpperCase() + schedule.startFrom.slice(1).toLowerCase()} On day: {schedule.dayOfMonth} At around: {schedule.atTimeStart}, {schedule.timezone} Timezone @@ -161,18 +171,33 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia - {settings.runEveryUnit === 'MONTHS' && ( + + {['MONTHS', 'WEEKS'].includes(settings.runEveryUnit) ? "Start From" : "On"} + handleChange('startFrom', e.target.value)} + sx={dropDownStyle} + > + {days.map((day) => ( + {day} + ))} + + + + {settings.runEveryUnit === 'MONTHS' && ( On Day of the Month handleChange('dayOfMonth', e.target.value)} - sx={textStyle} - inputProps={{ min: 1, max: 31 }} + type="number" + value={settings.dayOfMonth} + onChange={(e) => handleChange('dayOfMonth', e.target.value)} + sx={textStyle} + inputProps={{ min: 1, max: 31 }} /> - )} + )} {['MINUTES', 'HOURS'].includes(settings.runEveryUnit) ? (