From 1bd7b2fd4787c72d1b202b72da5699d9116e9be3 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 22 Oct 2024 21:15:05 +0530 Subject: [PATCH] feat: get schedule of robot --- src/components/molecules/ScheduleSettings.tsx | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/src/components/molecules/ScheduleSettings.tsx b/src/components/molecules/ScheduleSettings.tsx index 457572e3..f0f7ff38 100644 --- a/src/components/molecules/ScheduleSettings.tsx +++ b/src/components/molecules/ScheduleSettings.tsx @@ -5,6 +5,8 @@ import { Dropdown } from "../atoms/DropdownMui"; import Button from "@mui/material/Button"; import { modalStyle } from "./AddWhereCondModal"; import { validMomentTimezones } from '../../constants/const'; +import { useGlobalInfoStore } from '../../context/globalInfo'; +import { getSchedule } from '../../api/storage'; interface ScheduleSettingsProps { isOpen: boolean; @@ -85,6 +87,26 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia }); }; + const { recordingId } = useGlobalInfoStore(); + + const getRobotSchedule = async () => { + if (recordingId) { + const schedule = await getSchedule(recordingId); + if (schedule) { + setSettings(schedule); + } + } else { + console.error('No recording id provided'); + } + } + + useEffect(() => { + if (isOpen) { + getRobotSchedule(); + } + }, [isOpen]); + + return ( + + + + - - );