From e2e8c9da4783e4644f35a66952ebe2473b136628 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 12 Sep 2024 22:17:30 +0530 Subject: [PATCH] feat(wip): schedule settings --- src/components/molecules/ScheduleSettings.tsx | 163 +++++++++--------- 1 file changed, 84 insertions(+), 79 deletions(-) diff --git a/src/components/molecules/ScheduleSettings.tsx b/src/components/molecules/ScheduleSettings.tsx index f7a01a9e..d40a52ff 100644 --- a/src/components/molecules/ScheduleSettings.tsx +++ b/src/components/molecules/ScheduleSettings.tsx @@ -9,25 +9,29 @@ interface ScheduleSettingsProps { isOpen: boolean; handleStart: (settings: ScheduleSettings) => void; handleClose: () => void; - isTask: boolean; - params?: string[]; } export interface ScheduleSettings { - maxConcurrency: number; - maxRepeats: number; - debug: boolean; - params?: any; + runEvery: number; + runEveryUnit: string; + startFrom: string; + atTime: string; + timezone: string; } -export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, isTask, params }: ScheduleSettingsProps) => { - - const [settings, setSettings] = React.useState({ - maxConcurrency: 1, - maxRepeats: 1, - debug: true, +export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose }: ScheduleSettingsProps) => { + const [settings, setSettings] = useState({ + runEvery: 1, + runEveryUnit: 'hours', + startFrom: 'Monday', + atTime: '00:00', + timezone: 'UTC' }); + const handleChange = (field: keyof ScheduleSettings, value: string | number) => { + setSettings(prev => ({ ...prev, [field]: value })); + }; + return ( - { isTask - ? - ( - - Recording parameters: - { params?.map((item, index) => { - return setSettings( - { - ...settings, - params: settings.params - ? { - ...settings.params, - [item]: e.target.value, - } - : { - [item]: e.target.value, - }, - })} - /> - }) } - ) - : null - } - Interpreter settings: - setSettings( - { - ...settings, - maxConcurrency: parseInt(e.target.value), - })} - defaultValue={settings.maxConcurrency} - /> - setSettings( - { - ...settings, - maxRepeats: parseInt(e.target.value), - })} - defaultValue={settings.maxRepeats} - /> - setSettings( - { - ...settings, - debug: e.target.value === "true", - })} - > - true - false - +
+ Run once every + handleChange('runEvery', parseInt(e.target.value))} + style={{ width: '60px', margin: '0 10px' }} + /> + handleChange('runEveryUnit', e.target.value)} + > + minutes + hours + days + weeks + months + +
+ +
+ Start from + handleChange('startFrom', e.target.value)} + > + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + Sunday + +
+ +
+ At around + handleChange('atTime', e.target.value)} + /> +
+ +
+ Timezone + handleChange('timezone', e.target.value)} + > + UTC + America/New_York + Europe/London + Asia/Tokyo + Asia/Kolkata + {/* Add more timezone options as needed */} + +
+
); } + +export default ScheduleSettingsModal; \ No newline at end of file