Merge pull request #384 from RohitR311/vis-fix
feat: hide input values in edit robot
This commit is contained in:
@@ -320,30 +320,37 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
|
|||||||
<Typography variant="h6" style={{ marginBottom: '20px'}}>
|
<Typography variant="h6" style={{ marginBottom: '20px'}}>
|
||||||
{headerText}
|
{headerText}
|
||||||
</Typography>
|
</Typography>
|
||||||
{selectors.map((selector) => (
|
{selectors.map((selector) => {
|
||||||
<TextField
|
const isVisible = showPasswords[selector];
|
||||||
key={selector}
|
|
||||||
type={showPasswords[selector] ? 'text' : defaultType}
|
return (
|
||||||
label={`Credential for ${selector}`}
|
<TextField
|
||||||
value={credentials[selector]?.value || ''}
|
key={selector}
|
||||||
onChange={(e) => handleCredentialChange(selector, e.target.value)}
|
// The type changes based on visibility state
|
||||||
style={{ marginBottom: '20px' }}
|
type={isVisible ? 'text' : 'password'}
|
||||||
InputProps={{
|
label={`Credential for ${selector}`}
|
||||||
// Only show visibility toggle for password fields
|
value={credentials[selector]?.value || ''}
|
||||||
endAdornment: defaultType === 'password' ? (
|
onChange={(e) => handleCredentialChange(selector, e.target.value)}
|
||||||
<InputAdornment position="end">
|
style={{ marginBottom: '20px' }}
|
||||||
<IconButton
|
InputProps={{
|
||||||
aria-label="toggle password visibility"
|
// Now showing visibility toggle for all fields
|
||||||
onClick={() => handleClickShowPassword(selector)}
|
endAdornment: (
|
||||||
edge="end"
|
<InputAdornment position="end">
|
||||||
>
|
<IconButton
|
||||||
{showPasswords[selector] ? <Visibility /> : <VisibilityOff />}
|
aria-label="toggle credential visibility"
|
||||||
</IconButton>
|
onClick={() => handleClickShowPassword(selector)}
|
||||||
</InputAdornment>
|
edge="end"
|
||||||
) : undefined,
|
// Optional: disable if field is empty
|
||||||
}}
|
disabled={!credentials[selector]?.value}
|
||||||
/>
|
>
|
||||||
))}
|
{isVisible ? <Visibility /> : <VisibilityOff />}
|
||||||
|
</IconButton>
|
||||||
|
</InputAdornment>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user