import { useEffect, useState } from 'react'; import CancelIcon from '@mui/icons-material/Cancel'; import DoneIcon from '@mui/icons-material/Done'; import { Box, Button, Checkbox, Dialog, DialogActions, DialogContent, DialogTitle, Grid2 as Grid, TextField } from '@mui/material'; import { dialogStyle } from 'CustomTheme'; import { BlockFormControlLabel } from 'components'; import { useI18nContext } from 'i18n/i18n-react'; import { updateValue } from 'utils'; import type { ModuleItem } from './types'; interface ModulesDialogProps { open: boolean; onClose: () => void; onSave: (mi: ModuleItem) => void; selectedItem: ModuleItem; } const ModulesDialog = ({ open, onClose, onSave, selectedItem }: ModulesDialogProps) => { const { LL } = useI18nContext(); const [editItem, setEditItem] = useState(selectedItem); const updateFormValue = updateValue(setEditItem); useEffect(() => { if (open) { setEditItem(selectedItem); } }, [open, selectedItem]); const close = () => { onClose(); }; const save = () => { onSave(editItem); }; return ( {LL.EDIT() + ' ' + editItem.key} } label="Enabled" /> ); }; export default ModulesDialog;