From df9c8e2e809a16c4e481ea49c817d317812b0ae7 Mon Sep 17 00:00:00 2001 From: Trevor Hudson Date: Sun, 11 May 2025 16:47:59 -0700 Subject: [PATCH] Trevhud/vite auto (#3448) * move enable all * add tooltip * changeset * fix spacing and move notifications to other section --- .changeset/hip-buttons-smile.md | 5 ++ webview-ui/.vite-port | 1 - .../auto-approve-menu/AutoApproveMenu.tsx | 73 ++++++++++--------- .../auto-approve-menu/AutoApproveMenuItem.tsx | 31 ++++---- 4 files changed, 59 insertions(+), 51 deletions(-) create mode 100644 .changeset/hip-buttons-smile.md delete mode 100644 webview-ui/.vite-port diff --git a/.changeset/hip-buttons-smile.md b/.changeset/hip-buttons-smile.md new file mode 100644 index 0000000000..34476a02f7 --- /dev/null +++ b/.changeset/hip-buttons-smile.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Remove vite files and make enable all the first item diff --git a/webview-ui/.vite-port b/webview-ui/.vite-port deleted file mode 100644 index 085e304c4e..0000000000 --- a/webview-ui/.vite-port +++ /dev/null @@ -1 +0,0 @@ -25463 \ No newline at end of file diff --git a/webview-ui/src/components/chat/auto-approve-menu/AutoApproveMenu.tsx b/webview-ui/src/components/chat/auto-approve-menu/AutoApproveMenu.tsx index 827197e561..88a485cd6e 100644 --- a/webview-ui/src/components/chat/auto-approve-menu/AutoApproveMenu.tsx +++ b/webview-ui/src/components/chat/auto-approve-menu/AutoApproveMenu.tsx @@ -27,6 +27,13 @@ export interface ActionMetadata { } const ACTION_METADATA: ActionMetadata[] = [ + { + id: "enableAll", + label: "Enable all", + shortName: "All", + description: "Enable all actions.", + icon: "codicon-checklist", + }, { id: "readFiles", label: "Read project files", @@ -87,22 +94,16 @@ const ACTION_METADATA: ActionMetadata[] = [ description: "Allows Cline to use configured MCP servers which may modify filesystem or interact with APIs.", icon: "codicon-server", }, - { - id: "enableAll", - label: "Enable all", - shortName: "All", - description: "Enable all actions.", - icon: "codicon-checklist", - }, - { - id: "enableNotifications", - label: "Enable notifications", - shortName: "Notifications", - description: "Receive system notifications when Cline requires approval to proceed or when a task is completed.", - icon: "codicon-bell", - }, ] +const NOTIFICATIONS_SETTING: ActionMetadata = { + id: "enableNotifications", + label: "Enable notifications", + shortName: "Notifications", + description: "Receive system notifications when Cline requires approval to proceed or when a task is completed.", + icon: "codicon-bell", +} + const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => { const { autoApprovalSettings } = useExtensionState() const [isExpanded, setIsExpanded] = useState(false) @@ -265,8 +266,8 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => { // Render a favorited item with a checkbox const renderFavoritedItem = (favId: string) => { - // Regular action item - const action = ACTION_METADATA.flatMap((a) => [a, a.subAction]).find((a) => a?.id === favId) + const actions = [...ACTION_METADATA.flatMap((a) => [a, a.subAction]), NOTIFICATIONS_SETTING] + const action = actions.find((a) => a?.id === favId) if (!action) return null return ( @@ -380,18 +381,15 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => { placement="top"> Auto-approve - +
breakpoint ? "grid" : "flex", - gridTemplateColumns: containerWidth > breakpoint ? "1fr 1fr" : "1fr", - gridAutoRows: "min-content", - flexDirection: "column", - gap: "4px", - margin: "8px 0", + columnCount: containerWidth > breakpoint ? 2 : 1, + columnGap: "4px", + margin: "4px 0 8px 0", position: "relative", // For absolute positioning of the separator }}> {/* Vertical separator line - only visible in two-column mode */} @@ -412,35 +410,42 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => { {/* All items in a single list - CSS Grid will handle the column distribution */} {ACTION_METADATA.map((action) => ( -
- -
+ ))}
+
Max Requests: diff --git a/webview-ui/src/components/chat/auto-approve-menu/AutoApproveMenuItem.tsx b/webview-ui/src/components/chat/auto-approve-menu/AutoApproveMenuItem.tsx index 570c6d92a1..6283edbfb2 100644 --- a/webview-ui/src/components/chat/auto-approve-menu/AutoApproveMenuItem.tsx +++ b/webview-ui/src/components/chat/auto-approve-menu/AutoApproveMenuItem.tsx @@ -67,7 +67,7 @@ const SubOptionAnimateIn = styled.div<{ show: boolean }>` ` const ActionButtonContainer = styled.div` - margin: 4px; + padding: 2px; ` const AutoApproveMenuItem = ({ @@ -78,21 +78,18 @@ const AutoApproveMenuItem = ({ onToggleFavorite, condensed = false, }: AutoApproveMenuItemProps) => { - const [isSubOptionOpen, setIsSubOptionOpen] = useState(isChecked(action)) const checked = isChecked(action) const favorited = isFavorited?.(action) const onChange = (e: Event) => { e.stopPropagation() - const newChecked = !checked - setIsSubOptionOpen(newChecked) - onToggle(action, newChecked) + onToggle(action, !checked) } const content = ( -
+ <> - +
@@ -100,19 +97,21 @@ const AutoApproveMenuItem = ({ {condensed ? action.shortName : action.label}
{onToggleFavorite && !condensed && ( - { - e.stopPropagation() - onToggleFavorite?.(action.id) - }} - /> + + { + e.stopPropagation() + onToggleFavorite?.(action.id) + }} + /> + )}
{action.subAction && !condensed && ( - + )} -
+ ) return content