chore: lint

This commit is contained in:
amhsirak
2025-01-09 17:18:05 +05:30
parent e6a77a2a59
commit f5ba1465bf

View File

@@ -12,15 +12,15 @@ interface DisplayConditionSettingsProps {
setAdditionalSettings: (value: any) => void; setAdditionalSettings: (value: any) => void;
newValue: any; newValue: any;
setNewValue: (value: any) => void; setNewValue: (value: any) => void;
keyValueFormRef: React.RefObject<{getObject: () => object}>; keyValueFormRef: React.RefObject<{ getObject: () => object }>;
whereKeys: string[]; whereKeys: string[];
checked: boolean[]; checked: boolean[];
setChecked: (value: boolean[]) => void; setChecked: (value: boolean[]) => void;
} }
export const DisplayConditionSettings = ( export const DisplayConditionSettings = (
{whereProp, setAdditionalSettings, additionalSettings, { whereProp, setAdditionalSettings, additionalSettings,
setNewValue, newValue, keyValueFormRef, whereKeys, checked, setChecked} setNewValue, newValue, keyValueFormRef, whereKeys, checked, setChecked }
: DisplayConditionSettingsProps) => { : DisplayConditionSettingsProps) => {
switch (whereProp) { switch (whereProp) {
case 'url': case 'url':
@@ -34,7 +34,7 @@ export const DisplayConditionSettings = (
<MenuItem value="string">string</MenuItem> <MenuItem value="string">string</MenuItem>
<MenuItem value="regex">regex</MenuItem> <MenuItem value="regex">regex</MenuItem>
</MuiDropdown> </MuiDropdown>
{ additionalSettings ? <TextField {additionalSettings ? <TextField
size='small' size='small'
type="string" type="string"
onChange={(e) => setNewValue(e.target.value)} onChange={(e) => setNewValue(e.target.value)}
@@ -56,20 +56,20 @@ export const DisplayConditionSettings = (
...newValue.slice(0, index), ...newValue.slice(0, index),
e.target.value, e.target.value,
...newValue.slice(index + 1) ...newValue.slice(index + 1)
])}/> ])} />
}) })
} }
</Stack> </Stack>
<AddButton handleClick={() => setNewValue([...newValue, ''])}/> <AddButton handleClick={() => setNewValue([...newValue, ''])} />
<RemoveButton handleClick={()=> { <RemoveButton handleClick={() => {
const arr = newValue; const arr = newValue;
arr.splice(-1); arr.splice(-1);
setNewValue([...arr]); setNewValue([...arr]);
}}/> }} />
</React.Fragment> </React.Fragment>
) )
case 'cookies': case 'cookies':
return <KeyValueForm ref={keyValueFormRef}/> return <KeyValueForm ref={keyValueFormRef} />
case 'before': case 'before':
return <TextField return <TextField
label='pair id' label='pair id'
@@ -96,23 +96,23 @@ export const DisplayConditionSettings = (
<MenuItem value="or">or</MenuItem> <MenuItem value="or">or</MenuItem>
</MuiDropdown> </MuiDropdown>
<FormGroup> <FormGroup>
{ {
whereKeys.map((key: string, index: number) => { whereKeys.map((key: string, index: number) => {
return ( return (
<FormControlLabel control={ <FormControlLabel control={
<Checkbox <Checkbox
checked={checked[index]} checked={checked[index]}
onChange={() => setChecked([ onChange={() => setChecked([
...checked.slice(0, index), ...checked.slice(0, index),
!checked[index], !checked[index],
...checked.slice(index + 1) ...checked.slice(index + 1)
])} ])}
key={`checkbox-${key}-${index}`} key={`checkbox-${key}-${index}`}
/> />
} label={key} key={`control-label-form-${key}-${index}`}/> } label={key} key={`control-label-form-${key}-${index}`} />
) )
}) })
} }
</FormGroup> </FormGroup>
<WarningText> <WarningText>
Choose at least 2 where conditions. Nesting of boolean operators Choose at least 2 where conditions. Nesting of boolean operators