|
1 | 1 | import { HTMLAttributes, useState } from "react" |
2 | | -import { X } from "lucide-react" |
| 2 | +import { X, CheckCheck } from "lucide-react" |
3 | 3 |
|
4 | 4 | import { useAppTranslation } from "@/i18n/TranslationContext" |
5 | 5 | import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react" |
@@ -114,57 +114,68 @@ export const AutoApproveSettings = ({ |
114 | 114 |
|
115 | 115 | return ( |
116 | 116 | <div {...props}> |
117 | | - <SectionHeader description={t("settings:autoApprove.description")}> |
| 117 | + <SectionHeader> |
118 | 118 | <div className="flex items-center gap-2"> |
119 | | - {!hasEnabledOptions ? ( |
120 | | - <StandardTooltip content={t("settings:autoApprove.selectOptionsFirst")}> |
121 | | - <VSCodeCheckbox |
122 | | - checked={effectiveAutoApprovalEnabled} |
123 | | - disabled={!hasEnabledOptions} |
124 | | - aria-label={t("settings:autoApprove.disabledAriaLabel")} |
125 | | - onChange={() => { |
126 | | - // Do nothing when no options are enabled |
127 | | - return |
128 | | - }} |
129 | | - /> |
130 | | - </StandardTooltip> |
131 | | - ) : ( |
132 | | - <VSCodeCheckbox |
133 | | - checked={effectiveAutoApprovalEnabled} |
134 | | - disabled={!hasEnabledOptions} |
135 | | - aria-label={t("settings:autoApprove.toggleAriaLabel")} |
136 | | - onChange={() => { |
137 | | - const newValue = !(autoApprovalEnabled ?? false) |
138 | | - setAutoApprovalEnabled(newValue) |
139 | | - vscode.postMessage({ type: "autoApprovalEnabled", bool: newValue }) |
140 | | - }} |
141 | | - /> |
142 | | - )} |
143 | | - <span className="codicon codicon-check w-4" /> |
| 119 | + <CheckCheck className="w-4 h-4" /> |
144 | 120 | <div>{t("settings:sections.autoApprove")}</div> |
145 | 121 | </div> |
146 | 122 | </SectionHeader> |
147 | 123 |
|
148 | 124 | <Section> |
149 | | - <AutoApproveToggle |
150 | | - alwaysAllowReadOnly={alwaysAllowReadOnly} |
151 | | - alwaysAllowWrite={alwaysAllowWrite} |
152 | | - alwaysAllowBrowser={alwaysAllowBrowser} |
153 | | - alwaysApproveResubmit={alwaysApproveResubmit} |
154 | | - alwaysAllowMcp={alwaysAllowMcp} |
155 | | - alwaysAllowModeSwitch={alwaysAllowModeSwitch} |
156 | | - alwaysAllowSubtasks={alwaysAllowSubtasks} |
157 | | - alwaysAllowExecute={alwaysAllowExecute} |
158 | | - alwaysAllowFollowupQuestions={alwaysAllowFollowupQuestions} |
159 | | - alwaysAllowUpdateTodoList={alwaysAllowUpdateTodoList} |
160 | | - onToggle={(key, value) => setCachedStateField(key, value)} |
161 | | - /> |
162 | | - <MaxLimitInputs |
163 | | - allowedMaxRequests={allowedMaxRequests} |
164 | | - allowedMaxCost={allowedMaxCost} |
165 | | - onMaxRequestsChange={(value) => setCachedStateField("allowedMaxRequests", value)} |
166 | | - onMaxCostChange={(value) => setCachedStateField("allowedMaxCost", value)} |
167 | | - /> |
| 125 | + <div className="space-y-4"> |
| 126 | + <div> |
| 127 | + {!hasEnabledOptions ? ( |
| 128 | + <StandardTooltip content={t("settings:autoApprove.selectOptionsFirst")}> |
| 129 | + <VSCodeCheckbox |
| 130 | + checked={effectiveAutoApprovalEnabled} |
| 131 | + disabled={!hasEnabledOptions} |
| 132 | + aria-label={t("settings:autoApprove.disabledAriaLabel")} |
| 133 | + onChange={() => { |
| 134 | + // Do nothing when no options are enabled |
| 135 | + return |
| 136 | + }}> |
| 137 | + <span className="font-medium">Auto-Approve Enabled</span> |
| 138 | + </VSCodeCheckbox> |
| 139 | + </StandardTooltip> |
| 140 | + ) : ( |
| 141 | + <VSCodeCheckbox |
| 142 | + checked={effectiveAutoApprovalEnabled} |
| 143 | + disabled={!hasEnabledOptions} |
| 144 | + aria-label={t("settings:autoApprove.toggleAriaLabel")} |
| 145 | + onChange={() => { |
| 146 | + const newValue = !(autoApprovalEnabled ?? false) |
| 147 | + setAutoApprovalEnabled(newValue) |
| 148 | + vscode.postMessage({ type: "autoApprovalEnabled", bool: newValue }) |
| 149 | + }}> |
| 150 | + <span className="font-medium">{t("settings:autoApprove.enabled")}</span> |
| 151 | + </VSCodeCheckbox> |
| 152 | + )} |
| 153 | + <div className="text-vscode-descriptionForeground text-sm mt-1"> |
| 154 | + {t("settings:autoApprove.description")} |
| 155 | + </div> |
| 156 | + </div> |
| 157 | + |
| 158 | + <AutoApproveToggle |
| 159 | + alwaysAllowReadOnly={alwaysAllowReadOnly} |
| 160 | + alwaysAllowWrite={alwaysAllowWrite} |
| 161 | + alwaysAllowBrowser={alwaysAllowBrowser} |
| 162 | + alwaysApproveResubmit={alwaysApproveResubmit} |
| 163 | + alwaysAllowMcp={alwaysAllowMcp} |
| 164 | + alwaysAllowModeSwitch={alwaysAllowModeSwitch} |
| 165 | + alwaysAllowSubtasks={alwaysAllowSubtasks} |
| 166 | + alwaysAllowExecute={alwaysAllowExecute} |
| 167 | + alwaysAllowFollowupQuestions={alwaysAllowFollowupQuestions} |
| 168 | + alwaysAllowUpdateTodoList={alwaysAllowUpdateTodoList} |
| 169 | + onToggle={(key, value) => setCachedStateField(key, value)} |
| 170 | + /> |
| 171 | + |
| 172 | + <MaxLimitInputs |
| 173 | + allowedMaxRequests={allowedMaxRequests} |
| 174 | + allowedMaxCost={allowedMaxCost} |
| 175 | + onMaxRequestsChange={(value) => setCachedStateField("allowedMaxRequests", value)} |
| 176 | + onMaxCostChange={(value) => setCachedStateField("allowedMaxCost", value)} |
| 177 | + /> |
| 178 | + </div> |
168 | 179 |
|
169 | 180 | {/* ADDITIONAL SETTINGS */} |
170 | 181 |
|
|
0 commit comments