1- import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
1+ import { VSCodeCheckbox , VSCodeButton } from "@vscode/webview-ui-toolkit/react"
22import { useCallback , useState } from "react"
33import { useExtensionState } from "../../context/ExtensionStateContext"
44import { useAppTranslation } from "../../i18n/TranslationContext"
@@ -10,7 +10,6 @@ interface AutoApproveAction {
1010 id : string
1111 label : string
1212 enabled : boolean
13- shortName : string
1413 description : string
1514}
1615
@@ -47,56 +46,48 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
4746 {
4847 id : "readFiles" ,
4948 label : t ( "chat:autoApprove.actions.readFiles.label" ) ,
50- shortName : t ( "chat:autoApprove.actions.readFiles.shortName" ) ,
5149 enabled : alwaysAllowReadOnly ?? false ,
5250 description : t ( "chat:autoApprove.actions.readFiles.description" ) ,
5351 } ,
5452 {
5553 id : "editFiles" ,
5654 label : t ( "chat:autoApprove.actions.editFiles.label" ) ,
57- shortName : t ( "chat:autoApprove.actions.editFiles.shortName" ) ,
5855 enabled : alwaysAllowWrite ?? false ,
5956 description : t ( "chat:autoApprove.actions.editFiles.description" ) ,
6057 } ,
6158 {
6259 id : "executeCommands" ,
6360 label : t ( "chat:autoApprove.actions.executeCommands.label" ) ,
64- shortName : t ( "chat:autoApprove.actions.executeCommands.shortName" ) ,
6561 enabled : alwaysAllowExecute ?? false ,
6662 description : t ( "chat:autoApprove.actions.executeCommands.description" ) ,
6763 } ,
6864 {
6965 id : "useBrowser" ,
7066 label : t ( "chat:autoApprove.actions.useBrowser.label" ) ,
71- shortName : t ( "chat:autoApprove.actions.useBrowser.shortName" ) ,
7267 enabled : alwaysAllowBrowser ?? false ,
7368 description : t ( "chat:autoApprove.actions.useBrowser.description" ) ,
7469 } ,
7570 {
7671 id : "useMcp" ,
7772 label : t ( "chat:autoApprove.actions.useMcp.label" ) ,
78- shortName : t ( "chat:autoApprove.actions.useMcp.shortName" ) ,
7973 enabled : alwaysAllowMcp ?? false ,
8074 description : t ( "chat:autoApprove.actions.useMcp.description" ) ,
8175 } ,
8276 {
8377 id : "switchModes" ,
8478 label : t ( "chat:autoApprove.actions.switchModes.label" ) ,
85- shortName : t ( "chat:autoApprove.actions.switchModes.shortName" ) ,
8679 enabled : alwaysAllowModeSwitch ?? false ,
8780 description : t ( "chat:autoApprove.actions.switchModes.description" ) ,
8881 } ,
8982 {
9083 id : "subtasks" ,
9184 label : t ( "chat:autoApprove.actions.subtasks.label" ) ,
92- shortName : t ( "chat:autoApprove.actions.subtasks.shortName" ) ,
9385 enabled : alwaysAllowSubtasks ?? false ,
9486 description : t ( "chat:autoApprove.actions.subtasks.description" ) ,
9587 } ,
9688 {
9789 id : "retryRequests" ,
9890 label : t ( "chat:autoApprove.actions.retryRequests.label" ) ,
99- shortName : t ( "chat:autoApprove.actions.retryRequests.shortName" ) ,
10091 enabled : alwaysApproveResubmit ?? false ,
10192 description : t ( "chat:autoApprove.actions.retryRequests.description" ) ,
10293 } ,
@@ -108,7 +99,7 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
10899
109100 const enabledActionsList = actions
110101 . filter ( ( action ) => action . enabled )
111- . map ( ( action ) => action . shortName )
102+ . map ( ( action ) => action . label )
112103 . join ( ", " )
113104
114105 // Individual checkbox handlers - each one only updates its own state
@@ -260,23 +251,46 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
260251 } }
261252 />
262253 </ div >
263- { actions . map ( ( action ) => (
264- < div key = { action . id } style = { { margin : "6px 0" } } >
265- < div onClick = { ( e ) => e . stopPropagation ( ) } >
266- < VSCodeCheckbox checked = { action . enabled } onChange = { actionHandlers [ action . id ] } >
267- { action . label }
268- </ VSCodeCheckbox >
269- </ div >
270- < div
271- style = { {
272- marginLeft : "28px" ,
273- color : "var(--vscode-descriptionForeground)" ,
274- fontSize : "12px" ,
275- } } >
276- { action . description }
277- </ div >
278- </ div >
279- ) ) }
254+ < div
255+ className = "flex flex-row gap-2 [@media(min-width:400px)]:gap-4 flex-wrap justify-center"
256+ style = { { paddingBottom : "2rem" } } >
257+ { actions . map ( ( action ) => {
258+ const iconMap : Record < string , string > = {
259+ readFiles : "eye" ,
260+ editFiles : "edit" ,
261+ executeCommands : "terminal" ,
262+ useBrowser : "globe" ,
263+ useMcp : "plug" ,
264+ switchModes : "sync" ,
265+ subtasks : "discard" ,
266+ retryRequests : "refresh" ,
267+ }
268+ const codicon = iconMap [ action . id ] || "question"
269+ return (
270+ < VSCodeButton
271+ key = { action . id }
272+ appearance = { action . enabled ? "primary" : "secondary" }
273+ onClick = { ( e ) => {
274+ e . stopPropagation ( )
275+ actionHandlers [ action . id ] ( )
276+ } }
277+ title = { action . description }
278+ className = "aspect-square min-h-[80px] min-w-[80px] max-h-[100px] max-w-[100px]"
279+ style = { { flexBasis : "20%" } } >
280+ < span className = "flex flex-col items-center gap-1 h-full" >
281+ < span
282+ className = { `codicon codicon-${ codicon } text-base ` }
283+ style = { {
284+ fontSize : "1.5rem" ,
285+ paddingTop : "0.5rem" ,
286+ } }
287+ />
288+ < span className = "text-sm text-center" > { action . label } </ span >
289+ </ span >
290+ </ VSCodeButton >
291+ )
292+ } ) }
293+ </ div >
280294 </ div >
281295 ) }
282296 </ div >
0 commit comments