chore: lint

This commit is contained in:
karishmas6
2024-09-17 20:25:10 +05:30
parent 5c0998ae01
commit a2d04b3d5b

View File

@@ -5,88 +5,88 @@ import Button from "@mui/material/Button";
import { modalStyle } from "./AddWhereCondModal"; import { modalStyle } from "./AddWhereCondModal";
interface IntegrationProps { interface IntegrationProps {
isOpen: boolean; isOpen: boolean;
handleStart: (data: IntegrationSettings) => void; handleStart: (data: IntegrationSettings) => void;
handleClose: () => void; handleClose: () => void;
} }
export interface IntegrationSettings { export interface IntegrationSettings {
credentials: string; credentials: string;
spreadsheetId: string; spreadsheetId: string;
range: string; range: string;
data: string; data: string;
} }
export const IntegrationSettingsModal = ({ isOpen, handleStart, handleClose }: IntegrationProps) => { export const IntegrationSettingsModal = ({ isOpen, handleStart, handleClose }: IntegrationProps) => {
const [settings, setSettings] = useState<IntegrationSettings>({ const [settings, setSettings] = useState<IntegrationSettings>({
credentials: '', credentials: '',
spreadsheetId: '', spreadsheetId: '',
range: '', range: '',
data: '', data: '',
}); });
const handleChange = (field: keyof IntegrationSettings) => (e: React.ChangeEvent<HTMLInputElement>) => { const handleChange = (field: keyof IntegrationSettings) => (e: React.ChangeEvent<HTMLInputElement>) => {
setSettings({ ...settings, [field]: e.target.value }); setSettings({ ...settings, [field]: e.target.value });
}; };
return ( return (
<GenericModal <GenericModal
isOpen={isOpen} isOpen={isOpen}
onClose={handleClose} onClose={handleClose}
modalStyle={modalStyle} modalStyle={modalStyle}
> >
<div style={{ <div style={{
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
alignItems: 'flex-start', alignItems: 'flex-start',
marginLeft: '65px', marginLeft: '65px',
}}> }}>
<Typography sx={{ margin: '20px 0px' }}>Google Sheets Integration</Typography> <Typography sx={{ margin: '20px 0px' }}>Google Sheets Integration</Typography>
<TextField <TextField
sx={{ marginBottom: '15px' }} sx={{ marginBottom: '15px' }}
label="Service Account JSON" label="Service Account JSON"
multiline multiline
rows={10} rows={10}
required required
value={settings.credentials} value={settings.credentials}
onChange={handleChange('credentials')} onChange={handleChange('credentials')}
fullWidth fullWidth
/> />
<TextField <TextField
sx={{ marginBottom: '15px' }} sx={{ marginBottom: '15px' }}
label="Google Spreadsheet ID" label="Google Spreadsheet ID"
required required
value={settings.spreadsheetId} value={settings.spreadsheetId}
onChange={handleChange('spreadsheetId')} onChange={handleChange('spreadsheetId')}
fullWidth fullWidth
/> />
<TextField <TextField
sx={{ marginBottom: '15px' }} sx={{ marginBottom: '15px' }}
label="Range (e.g., Sheet1!A1:B2)" label="Range (e.g., Sheet1!A1:B2)"
required required
value={settings.range} value={settings.range}
onChange={handleChange('range')} onChange={handleChange('range')}
fullWidth fullWidth
/> />
<TextField <TextField
sx={{ marginBottom: '15px' }} sx={{ marginBottom: '15px' }}
label="Data (comma-separated, newline for rows)" label="Data (comma-separated, newline for rows)"
multiline multiline
rows={4} rows={4}
value={settings.data} value={settings.data}
onChange={handleChange('data')} onChange={handleChange('data')}
fullWidth fullWidth
/> />
<Button variant="contained" color="primary" onClick={() => handleStart(settings)} style={{ marginTop: '10px' }}> <Button variant="contained" color="primary" onClick={() => handleStart(settings)} style={{ marginTop: '10px' }}>
Submit Submit
</Button> </Button>
</div> </div>
</GenericModal> </GenericModal>
); );
}; };