Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions webview-ui/src/components/chat/AutoApproveMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
const [isExpanded, setIsExpanded] = useState(false)

const {
autoApprovalEnabled,
setAutoApprovalEnabled,
alwaysAllowReadOnly,
alwaysAllowWrite,
Expand Down Expand Up @@ -107,6 +106,8 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
],
)

const hasAnyAutoApprovedAction = Object.values(toggles).some((value) => !!value)

const enabledActionsList = Object.entries(toggles)
.filter(([_key, value]) => !!value)
.map(([key]) => t(autoApproveSettingsConfig[key as AutoApproveSetting].labelKey))
Expand Down Expand Up @@ -140,11 +141,16 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
onClick={toggleExpanded}>
<div onClick={(e) => e.stopPropagation()}>
<VSCodeCheckbox
checked={autoApprovalEnabled ?? false}
checked={hasAnyAutoApprovedAction}
onChange={() => {
const newValue = !(autoApprovalEnabled ?? false)
const newValue = !hasAnyAutoApprovedAction
setAutoApprovalEnabled(newValue)
vscode.postMessage({ type: "autoApprovalEnabled", bool: newValue })

// Toggle all individual auto-approve settings
Object.keys(autoApproveSettingsConfig).forEach((key) => {
onAutoApproveToggle(key as AutoApproveSetting, newValue)
})
}}
/>
</div>
Expand Down