diff --git a/src/components/molecules/ScheduleSettings.tsx b/src/components/molecules/ScheduleSettings.tsx index f0f7ff38..6449835c 100644 --- a/src/components/molecules/ScheduleSettings.tsx +++ b/src/components/molecules/ScheduleSettings.tsx @@ -25,6 +25,7 @@ export interface ScheduleSettings { } export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initialSettings }: ScheduleSettingsProps) => { + const [schedule, setSchedule] = useState(null); const [settings, setSettings] = useState({ runEvery: 1, runEveryUnit: 'HOURS', @@ -89,11 +90,14 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia const { recordingId } = useGlobalInfoStore(); + console.log(`Recoridng ID Shculde: ${recordingId}`); + const getRobotSchedule = async () => { if (recordingId) { const schedule = await getSchedule(recordingId); + console.log(`RObot found schedule: ${schedule}`) if (schedule) { - setSettings(schedule); + setSchedule(schedule); } } else { console.error('No recording id provided'); @@ -104,7 +108,7 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia if (isOpen) { getRobotSchedule(); } - }, [isOpen]); + }, [isOpen, getRobotSchedule]); return ( @@ -122,7 +126,20 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia }}> Schedule Settings <> - + { + (schedule != null) ? ( + + + + ) : ( + <> + Run once every - - + @@ -212,16 +228,10 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia Cancel - - - - + + ) + } + );