@@ -43,6 +43,8 @@ import {
4343 Send ,
4444 Terminal ,
4545 FolderTree ,
46+ ChevronDown ,
47+ ChevronRight ,
4648} from "lucide-react" ;
4749
4850import { ZodType } from "zod" ;
@@ -94,6 +96,7 @@ const App = () => {
9496 const [ notifications , setNotifications ] = useState < ServerNotification [ ] > ( [ ] ) ;
9597 const [ roots , setRoots ] = useState < Root [ ] > ( [ ] ) ;
9698 const [ env , setEnv ] = useState < Record < string , string > > ( { } ) ;
99+ const [ showEnvVars , setShowEnvVars ] = useState ( false ) ;
97100
98101 const [ pendingSampleRequests , setPendingSampleRequests ] = useState <
99102 Array <
@@ -384,46 +387,62 @@ const App = () => {
384387 </ div >
385388 { transportType === "stdio" && (
386389 < div className = "mt-4" >
387- < h3 className = "text-md font-semibold mb-2" >
390+ < Button
391+ variant = "outline"
392+ onClick = { ( ) => setShowEnvVars ( ! showEnvVars ) }
393+ className = "flex items-center"
394+ >
395+ { showEnvVars ? (
396+ < ChevronDown className = "w-4 h-4 mr-2" />
397+ ) : (
398+ < ChevronRight className = "w-4 h-4 mr-2" />
399+ ) }
388400 Environment Variables
389- </ h3 >
390- { Object . entries ( env ) . map ( ( [ key , value ] ) => (
391- < div key = { key } className = "flex space-x-2 mb-2" >
392- < Input
393- placeholder = "Key"
394- value = { key }
395- onChange = { ( e ) =>
396- setEnv ( ( prev ) => ( {
397- ...prev ,
398- [ e . target . value ] : value ,
399- } ) )
400- }
401- />
402- < Input
403- placeholder = "Value"
404- value = { value }
405- onChange = { ( e ) =>
406- setEnv ( ( prev ) => ( { ...prev , [ key ] : e . target . value } ) )
407- }
408- />
401+ </ Button >
402+ { showEnvVars && (
403+ < div className = "mt-2" >
404+ { Object . entries ( env ) . map ( ( [ key , value ] ) => (
405+ < div key = { key } className = "flex space-x-2 mb-2" >
406+ < Input
407+ placeholder = "Key"
408+ value = { key }
409+ onChange = { ( e ) =>
410+ setEnv ( ( prev ) => ( {
411+ ...prev ,
412+ [ e . target . value ] : value ,
413+ } ) )
414+ }
415+ />
416+ < Input
417+ placeholder = "Value"
418+ value = { value }
419+ onChange = { ( e ) =>
420+ setEnv ( ( prev ) => ( {
421+ ...prev ,
422+ [ key ] : e . target . value ,
423+ } ) )
424+ }
425+ />
426+ < Button
427+ onClick = { ( ) =>
428+ setEnv ( ( prev ) => {
429+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
430+ const { [ key ] : _ , ...rest } = prev ;
431+ return rest ;
432+ } )
433+ }
434+ >
435+ Remove
436+ </ Button >
437+ </ div >
438+ ) ) }
409439 < Button
410- onClick = { ( ) =>
411- setEnv ( ( prev ) => {
412- // eslint-disable-next-line @typescript-eslint/no-unused-vars
413- const { [ key ] : _ , ...rest } = prev ;
414- return rest ;
415- } )
416- }
440+ onClick = { ( ) => setEnv ( ( prev ) => ( { ...prev , "" : "" } ) ) }
417441 >
418- Remove
442+ Add Environment Variable
419443 </ Button >
420444 </ div >
421- ) ) }
422- < Button
423- onClick = { ( ) => setEnv ( ( prev ) => ( { ...prev , "" : "" } ) ) }
424- >
425- Add Environment Variable
426- </ Button >
445+ ) }
427446 </ div >
428447 ) }
429448 </ div >
0 commit comments