11import { useState } from "react" ;
2- import { Play , ChevronDown , ChevronRight , CircleHelp , Bug , Github } from "lucide-react" ;
2+ import {
3+ Play ,
4+ ChevronDown ,
5+ ChevronRight ,
6+ Bug ,
7+ CircleHelp ,
8+ Github ,
9+ Eye ,
10+ EyeOff ,
11+ } from "lucide-react" ;
312import { Button } from "@/components/ui/button" ;
413import { Input } from "@/components/ui/input" ;
514import {
@@ -47,6 +56,7 @@ const Sidebar = ({
4756} : SidebarProps ) => {
4857 const [ theme , setTheme ] = useTheme ( ) ;
4958 const [ showEnvVars , setShowEnvVars ] = useState ( false ) ;
59+ const [ shownEnvVars , setShownEnvVars ] = useState < Record < string , boolean > > ( { } ) ;
5060
5161 return (
5262 < div className = "w-80 bg-card border-r border-border flex flex-col h-full" >
@@ -127,20 +137,40 @@ const Sidebar = ({
127137 { showEnvVars && (
128138 < div className = "space-y-2" >
129139 { Object . entries ( env ) . map ( ( [ key , value ] , idx ) => (
130- < div key = { idx } className = "grid grid-cols-[1fr,auto] gap-2 " >
131- < div className = "space-y-1 " >
140+ < div key = { idx } className = "space-y-2 pb-4 " >
141+ < div className = "flex gap-2 " >
132142 < Input
133143 placeholder = "Key"
134144 value = { key }
135145 onChange = { ( e ) => {
146+ const newKey = e . target . value ;
136147 const newEnv = { ...env } ;
137148 delete newEnv [ key ] ;
138- newEnv [ e . target . value ] = value ;
149+ newEnv [ newKey ] = value ;
139150 setEnv ( newEnv ) ;
151+ setShownEnvVars ( ( prev ) => {
152+ const { [ key ] : shown , ...rest } = prev ;
153+ return shown ? { ...rest , [ newKey ] : true } : rest ;
154+ } ) ;
140155 } }
141156 className = "font-mono"
142157 />
158+ < Button
159+ variant = "destructive"
160+ size = "icon"
161+ className = "h-9 w-9 p-0 shrink-0"
162+ onClick = { ( ) => {
163+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
164+ const { [ key ] : _removed , ...rest } = env ;
165+ setEnv ( rest ) ;
166+ } }
167+ >
168+ ×
169+ </ Button >
170+ </ div >
171+ < div className = "flex gap-2" >
143172 < Input
173+ type = { shownEnvVars [ key ] ? "text" : "password" }
144174 placeholder = "Value"
145175 value = { value }
146176 onChange = { ( e ) => {
@@ -150,25 +180,35 @@ const Sidebar = ({
150180 } }
151181 className = "font-mono"
152182 />
183+ < Button
184+ variant = "outline"
185+ size = "icon"
186+ className = "h-9 w-9 p-0 shrink-0"
187+ onClick = { ( ) => {
188+ setShownEnvVars ( ( prev ) => ( {
189+ ...prev ,
190+ [ key ] : ! prev [ key ] ,
191+ } ) ) ;
192+ } }
193+ >
194+ { shownEnvVars [ key ] ? (
195+ < Eye className = "h-4 w-4" />
196+ ) : (
197+ < EyeOff className = "h-4 w-4" />
198+ ) }
199+ </ Button >
153200 </ div >
154- < Button
155- variant = "destructive"
156- onClick = { ( ) => {
157- // eslint-disable-next-line @typescript-eslint/no-unused-vars
158- const { [ key ] : removed , ...rest } = env ;
159- setEnv ( rest ) ;
160- } }
161- >
162- Remove
163- </ Button >
164201 </ div >
165202 ) ) }
166203 < Button
167204 variant = "outline"
205+ className = "w-full mt-2"
168206 onClick = { ( ) => {
207+ const key = "" ;
169208 const newEnv = { ...env } ;
170- newEnv [ "" ] = "" ;
209+ newEnv [ key ] = "" ;
171210 setEnv ( newEnv ) ;
211+ setShownEnvVars ( { } ) ;
172212 } }
173213 >
174214 Add Environment Variable
@@ -243,18 +283,33 @@ const Sidebar = ({
243283 </ Select >
244284
245285 < div className = "flex items-center space-x-2" >
246- < a href = "https://modelcontextprotocol.io/docs/tools/inspector" target = "_blank" rel = "noopener noreferrer" >
286+ < a
287+ href = "https://modelcontextprotocol.io/docs/tools/inspector"
288+ target = "_blank"
289+ rel = "noopener noreferrer"
290+ >
247291 < Button variant = "ghost" title = "Inspector Documentation" >
248292 < CircleHelp className = "w-4 h-4 text-gray-800" />
249293 </ Button >
250294 </ a >
251- < a href = "https://modelcontextprotocol.io/docs/tools/debugging" target = "_blank" rel = "noopener noreferrer" >
295+ < a
296+ href = "https://modelcontextprotocol.io/docs/tools/debugging"
297+ target = "_blank"
298+ rel = "noopener noreferrer"
299+ >
252300 < Button variant = "ghost" title = "Debugging Guide" >
253301 < Bug className = "w-4 h-4 text-gray-800" />
254302 </ Button >
255303 </ a >
256- < a href = "https://github.com/modelcontextprotocol/inspector" target = "_blank" rel = "noopener noreferrer" >
257- < Button variant = "ghost" title = "Report bugs or contribute on GitHub" >
304+ < a
305+ href = "https://github.com/modelcontextprotocol/inspector"
306+ target = "_blank"
307+ rel = "noopener noreferrer"
308+ >
309+ < Button
310+ variant = "ghost"
311+ title = "Report bugs or contribute on GitHub"
312+ >
258313 < Github className = "w-4 h-4 text-gray-800" />
259314 </ Button >
260315 </ a >
0 commit comments