@@ -9,6 +9,7 @@ import { BUTTON_TYPES, OBJ_TYPES } from 'constants/Common';
99import EditEnvVariableModal from '../modals/EditEnvVariableModal' ;
1010import { useKeyPress } from 'reactflow' ;
1111import { saveHandle } from '../modals/SaveFlowModal' ;
12+ import Mousetrap from 'mousetrap' ;
1213
1314const Env = ( { tab } ) => {
1415 const variables = useEnvStore ( ( state ) => state . variables ) ;
@@ -23,45 +24,50 @@ const Env = ({ tab }) => {
2324 const [ editKey , setEditKey ] = useState ( '' ) ;
2425 const [ editValue , setEditValue ] = useState ( '' ) ;
2526
26- const cmdAndSPressed = useKeyPress ( [ 'Meta+s' , 'Strg+s' ] ) ;
27+ //const cmdAndSPressed = useKeyPress(['Meta+s', 'Strg+s']);
28+ // Bind Ctrl+S and Cmd+S
29+ Mousetrap . bind ( [ 'ctrl+s' , 'command+s' ] , function ( e ) {
30+ e . preventDefault ( ) ;
31+ saveHandle ( tab ) ;
32+ return false ;
33+ } ) ;
2734
2835 return (
2936 < div className = 'p-4' >
30- { cmdAndSPressed && saveHandle ( tab ) }
3137 < table className = 'w-full leading-normal' >
3238 < thead >
33- < tr className = 'text-xs font-bold tracking-wider text-left uppercase bg-ghost-50 text-ghost-600 ' >
34- < th className = 'p-5 border border -ghost-200 max-w-4' > S. No.</ th >
35- < th className = 'p-5 border border -ghost-200 ' > Key</ th >
36- < th className = 'p-5 border border -ghost-200' > Value</ th >
37- < th className = 'p-5 border border -ghost-200 max-w-4' > Action</ th >
39+ < tr className = 'bg-ghost-50 text-ghost-600 text-left text-xs font-bold uppercase tracking-wider ' >
40+ < th className = 'border-ghost-200 max-w-4 border p-5 ' > S. No.</ th >
41+ < th className = 'border-ghost-200 border p-5 ' > Key</ th >
42+ < th className = 'border-ghost-200 border p-5 ' > Value</ th >
43+ < th className = 'border-ghost-200 max-w-4 border p-5 ' > Action</ th >
3844 </ tr >
3945 </ thead >
4046 < tbody >
4147 { Object . entries ( variables ) . map ( ( [ key , value ] , index ) => (
42- < tr key = { index } className = 'text-sm border-b border-gray-200 text-ghost-700 hover:bg-ghost-50 ' >
43- < td className = 'p-5 whitespace-no-wrap max-w-4' > { index + 1 } </ td >
44- < td className = 'p-5 whitespace-no-wrap' > { key } </ td >
45- < td className = 'p-5 whitespace-no-wrap' > { value } </ td >
46- < td className = 'p-5 whitespace-no-wrap max-w-4' >
48+ < tr key = { index } className = 'text-ghost-700 hover:bg-ghost-50 border-b border-gray-200 text-sm ' >
49+ < td className = 'whitespace-no-wrap max-w-4 p-5 ' > { index + 1 } </ td >
50+ < td className = 'whitespace-no-wrap p-5 ' > { key } </ td >
51+ < td className = 'whitespace-no-wrap p-5 ' > { value } </ td >
52+ < td className = 'whitespace-no-wrap max-w-4 p-5 ' >
4753 < div
48- className = 'relative inline-block p-2 text-left transition duration-200 ease-out rounded-md cursor-pointer hover:bg-ghost-200 '
54+ className = 'hover:bg-ghost-200 relative inline-block cursor-pointer rounded-md p-2 text-left transition duration-200 ease-out'
4955 onClick = { ( ) => {
5056 setDeleteKey ( key ) ;
5157 setConfirmActionModalOpen ( true ) ;
5258 } }
5359 >
54- < TrashIcon className = 'w -4 h -4' aria-hidden = 'true' />
60+ < TrashIcon className = 'h -4 w -4' aria-hidden = 'true' />
5561 </ div >
5662 < div
57- className = 'relative inline-block p-2 text-left transition duration-200 ease-out rounded-md cursor-pointer hover:bg-ghost-200 '
63+ className = 'hover:bg-ghost-200 relative inline-block cursor-pointer rounded-md p-2 text-left transition duration-200 ease-out'
5864 onClick = { ( ) => {
5965 setEditKey ( key ) ;
6066 setEditValue ( value ) ;
6167 setEditVariableModalOpen ( true ) ;
6268 } }
6369 >
64- < PencilSquareIcon className = 'w -4 h -4' aria-hidden = 'true' />
70+ < PencilSquareIcon className = 'h -4 w -4' aria-hidden = 'true' />
6571 </ div >
6672 </ td >
6773 </ tr >
@@ -75,7 +81,7 @@ const Env = ({ tab }) => {
7581 onClickHandle = { ( ) => setAddVariableModalOpen ( true ) }
7682 fullWidth = { true }
7783 >
78- < PlusIcon className = 'w -5 h -5' />
84+ < PlusIcon className = 'h -5 w -5' />
7985 < span > Add Variable</ span >
8086 </ Button >
8187 </ div >
0 commit comments