From 0fcb9383c87794a60b2c5249cef900f912bc5ff4 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 17 Sep 2024 17:28:43 +0530 Subject: [PATCH] feat(wip): integration settings UI --- .../molecules/IntegrationSettings.tsx | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 src/components/molecules/IntegrationSettings.tsx diff --git a/src/components/molecules/IntegrationSettings.tsx b/src/components/molecules/IntegrationSettings.tsx new file mode 100644 index 00000000..0c4ce109 --- /dev/null +++ b/src/components/molecules/IntegrationSettings.tsx @@ -0,0 +1,114 @@ +import React, { useState } from 'react'; +import { GenericModal } from "../atoms/GenericModal"; +import { MenuItem, TextField, Typography } from "@mui/material"; +import { Dropdown } from "../atoms/DropdownMui"; +import Button from "@mui/material/Button"; +import { modalStyle } from "./AddWhereCondModal"; + +interface IntegrationSettingsProps { + isOpen: boolean; + handleStart: (settings: IntegrationSettings) => void; + handleClose: () => void; + isTask: boolean; + params?: string[]; +} + +export interface IntegrationSettings { + maxConcurrency: number; + maxRepeats: number; + debug: boolean; + params?: any; +} + +export const IntegrationSettingsModal = ({ isOpen, handleStart, handleClose, isTask, params }: IntegrationSettingsProps) => { + + const [settings, setSettings] = React.useState({ + maxConcurrency: 1, + maxRepeats: 1, + debug: true, + }); + + 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 + + +
+
+ ); +}