@@ -12,7 +12,10 @@ import {
1212 Checkbox ,
1313 FormControlLabel ,
1414 ListSubheader ,
15+ InputAdornment ,
16+ IconButton ,
1517} from '@mui/material' ;
18+ import { Visibility , VisibilityOff } from '@mui/icons-material' ;
1619import { Icon , message , Modal , ThemeProvider } from '@c-x/ui' ;
1720import Card from './components/card' ;
1821import ModelTagsWithLabel from './components/ModelTagsWithLabel' ;
@@ -100,6 +103,7 @@ export const ModelModal: React.FC<ModelModalProps> = ({
100103 const [ addModelError , setAddModelError ] = useState ( '' ) ;
101104 const [ success , setSuccess ] = useState ( false ) ;
102105 const [ expandAdvanced , setExpandAdvanced ] = useState ( false ) ;
106+ const [ showPassword , setShowPassword ] = useState ( false ) ;
103107
104108 const handleReset = ( ) => {
105109 onClose ( ) ;
@@ -633,10 +637,23 @@ export const ModelModal: React.FC<ModelModalProps> = ({
633637 { ...field }
634638 fullWidth
635639 size = 'small'
636- type = ' password'
640+ type = { showPassword ? 'text' : ' password'}
637641 placeholder = ''
638642 error = { ! ! errors . api_key }
639643 helperText = { errors . api_key ?. message }
644+ InputProps = { {
645+ endAdornment : (
646+ < InputAdornment position = "end" >
647+ < IconButton
648+ aria-label = "toggle password visibility"
649+ onClick = { ( ) => setShowPassword ( ! showPassword ) }
650+ edge = "end"
651+ >
652+ { showPassword ? < VisibilityOff /> : < Visibility /> }
653+ </ IconButton >
654+ </ InputAdornment >
655+ ) ,
656+ } }
640657 onChange = { ( e ) => {
641658 field . onChange ( e . target . value ) ;
642659 setModelUserList ( [ ] ) ;
@@ -775,7 +792,7 @@ export const ModelModal: React.FC<ModelModalProps> = ({
775792 MenuProps : {
776793 PaperProps : {
777794 sx : {
778- maxHeight : 300 ,
795+ maxHeight : 450 ,
779796 '& .MuiList-root' : {
780797 paddingTop : 0 ,
781798 }
0 commit comments