Skip to content

Commit df9c8e2

Browse files
authored
Trevhud/vite auto (RooCodeInc#3448)
* move enable all * add tooltip * changeset * fix spacing and move notifications to other section
1 parent 4d480ea commit df9c8e2

File tree

4 files changed

+59
-51
lines changed

4 files changed

+59
-51
lines changed

.changeset/hip-buttons-smile.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": patch
3+
---
4+
5+
Remove vite files and make enable all the first item

webview-ui/.vite-port

Lines changed: 0 additions & 1 deletion
This file was deleted.

webview-ui/src/components/chat/auto-approve-menu/AutoApproveMenu.tsx

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ export interface ActionMetadata {
2727
}
2828

2929
const ACTION_METADATA: ActionMetadata[] = [
30+
{
31+
id: "enableAll",
32+
label: "Enable all",
33+
shortName: "All",
34+
description: "Enable all actions.",
35+
icon: "codicon-checklist",
36+
},
3037
{
3138
id: "readFiles",
3239
label: "Read project files",
@@ -87,22 +94,16 @@ const ACTION_METADATA: ActionMetadata[] = [
8794
description: "Allows Cline to use configured MCP servers which may modify filesystem or interact with APIs.",
8895
icon: "codicon-server",
8996
},
90-
{
91-
id: "enableAll",
92-
label: "Enable all",
93-
shortName: "All",
94-
description: "Enable all actions.",
95-
icon: "codicon-checklist",
96-
},
97-
{
98-
id: "enableNotifications",
99-
label: "Enable notifications",
100-
shortName: "Notifications",
101-
description: "Receive system notifications when Cline requires approval to proceed or when a task is completed.",
102-
icon: "codicon-bell",
103-
},
10497
]
10598

99+
const NOTIFICATIONS_SETTING: ActionMetadata = {
100+
id: "enableNotifications",
101+
label: "Enable notifications",
102+
shortName: "Notifications",
103+
description: "Receive system notifications when Cline requires approval to proceed or when a task is completed.",
104+
icon: "codicon-bell",
105+
}
106+
106107
const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
107108
const { autoApprovalSettings } = useExtensionState()
108109
const [isExpanded, setIsExpanded] = useState(false)
@@ -265,8 +266,8 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
265266

266267
// Render a favorited item with a checkbox
267268
const renderFavoritedItem = (favId: string) => {
268-
// Regular action item
269-
const action = ACTION_METADATA.flatMap((a) => [a, a.subAction]).find((a) => a?.id === favId)
269+
const actions = [...ACTION_METADATA.flatMap((a) => [a, a.subAction]), NOTIFICATIONS_SETTING]
270+
const action = actions.find((a) => a?.id === favId)
270271
if (!action) return null
271272

272273
return (
@@ -380,18 +381,15 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
380381
placement="top">
381382
<span style={{ color: getAsVar(VSC_FOREGROUND) }}>Auto-approve</span>
382383
</HeroTooltip>
383-
<span className="codicon codicon-chevron-down" />
384+
<span className="codicon codicon-chevron-down" style={{ paddingRight: "4px" }} />
384385
</div>
385386

386387
<div
387388
ref={itemsContainerRef}
388389
style={{
389-
display: containerWidth > breakpoint ? "grid" : "flex",
390-
gridTemplateColumns: containerWidth > breakpoint ? "1fr 1fr" : "1fr",
391-
gridAutoRows: "min-content",
392-
flexDirection: "column",
393-
gap: "4px",
394-
margin: "8px 0",
390+
columnCount: containerWidth > breakpoint ? 2 : 1,
391+
columnGap: "4px",
392+
margin: "4px 0 8px 0",
395393
position: "relative", // For absolute positioning of the separator
396394
}}>
397395
{/* Vertical separator line - only visible in two-column mode */}
@@ -412,35 +410,42 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
412410

413411
{/* All items in a single list - CSS Grid will handle the column distribution */}
414412
{ACTION_METADATA.map((action) => (
415-
<div key={action.id} style={{ breakInside: "avoid" }}>
416-
<AutoApproveMenuItem
417-
action={action}
418-
isChecked={isChecked}
419-
isFavorited={isFavorited}
420-
onToggle={updateAction}
421-
onToggleFavorite={toggleFavorite}
422-
/>
423-
</div>
413+
<AutoApproveMenuItem
414+
key={action.id}
415+
action={action}
416+
isChecked={isChecked}
417+
isFavorited={isFavorited}
418+
onToggle={updateAction}
419+
onToggleFavorite={toggleFavorite}
420+
/>
424421
))}
425422
</div>
426423
<div
427424
style={{
428425
height: "0.5px",
429426
background: getAsVar(VSC_TITLEBAR_INACTIVE_FOREGROUND),
430-
margin: "10px 0",
427+
margin: "8px 0",
431428
opacity: 0.2,
432429
}}
433430
/>
431+
<AutoApproveMenuItem
432+
key={NOTIFICATIONS_SETTING.id}
433+
action={NOTIFICATIONS_SETTING}
434+
isChecked={isChecked}
435+
isFavorited={isFavorited}
436+
onToggle={updateAction}
437+
onToggleFavorite={toggleFavorite}
438+
/>
434439
<HeroTooltip
435440
content="Cline will automatically make this many API requests before asking for approval to proceed with the task."
436441
placement="top">
437442
<div
438443
style={{
444+
margin: "2px 10px 10px 5px",
439445
display: "flex",
440446
alignItems: "center",
441447
gap: "8px",
442448
width: "100%",
443-
paddingBottom: "10px",
444449
}}>
445450
<span className="codicon codicon-settings" style={{ color: "#CCCCCC", fontSize: "14px" }} />
446451
<span style={{ color: "#CCCCCC", fontSize: "12px", fontWeight: 500 }}>Max Requests:</span>

webview-ui/src/components/chat/auto-approve-menu/AutoApproveMenuItem.tsx

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const SubOptionAnimateIn = styled.div<{ show: boolean }>`
6767
`
6868

6969
const ActionButtonContainer = styled.div`
70-
margin: 4px;
70+
padding: 2px;
7171
`
7272

7373
const AutoApproveMenuItem = ({
@@ -78,41 +78,40 @@ const AutoApproveMenuItem = ({
7878
onToggleFavorite,
7979
condensed = false,
8080
}: AutoApproveMenuItemProps) => {
81-
const [isSubOptionOpen, setIsSubOptionOpen] = useState(isChecked(action))
8281
const checked = isChecked(action)
8382
const favorited = isFavorited?.(action)
8483

8584
const onChange = (e: Event) => {
8685
e.stopPropagation()
87-
const newChecked = !checked
88-
setIsSubOptionOpen(newChecked)
89-
onToggle(action, newChecked)
86+
onToggle(action, !checked)
9087
}
9188

9289
const content = (
93-
<div>
90+
<>
9491
<ActionButtonContainer>
95-
<HeroTooltip content={action.description} delay={200}>
92+
<HeroTooltip content={action.description} delay={500}>
9693
<CheckboxContainer isFavorited={favorited} onClick={onChange}>
9794
<div className="left-content">
9895
<VSCodeCheckbox checked={checked} />
9996
<span className={`codicon ${action.icon} icon`}></span>
10097
<span className="label">{condensed ? action.shortName : action.label}</span>
10198
</div>
10299
{onToggleFavorite && !condensed && (
103-
<span
104-
className={`codicon codicon-${favorited ? "star-full" : "star-empty"} star`}
105-
onClick={(e) => {
106-
e.stopPropagation()
107-
onToggleFavorite?.(action.id)
108-
}}
109-
/>
100+
<HeroTooltip content={favorited ? "Remove from quick-access menu" : "Add to quick-access menu"}>
101+
<span
102+
className={`codicon codicon-${favorited ? "star-full" : "star-empty"} star`}
103+
onClick={(e) => {
104+
e.stopPropagation()
105+
onToggleFavorite?.(action.id)
106+
}}
107+
/>
108+
</HeroTooltip>
110109
)}
111110
</CheckboxContainer>
112111
</HeroTooltip>
113112
</ActionButtonContainer>
114113
{action.subAction && !condensed && (
115-
<SubOptionAnimateIn show={isSubOptionOpen}>
114+
<SubOptionAnimateIn show={checked}>
116115
<AutoApproveMenuItem
117116
action={action.subAction}
118117
isChecked={isChecked}
@@ -122,7 +121,7 @@ const AutoApproveMenuItem = ({
122121
/>
123122
</SubOptionAnimateIn>
124123
)}
125-
</div>
124+
</>
126125
)
127126

128127
return content

0 commit comments

Comments
 (0)