-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: replace auto-approve text labels with icons in collapsed view #6500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
228c9c7
cfa2081
782174e
e5b41c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -129,18 +129,8 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => { | |||
| setIsExpanded((prev) => !prev) | ||||
| }, []) | ||||
|
|
||||
| const enabledActionsList = Object.entries(toggles) | ||||
| .filter(([_key, value]) => !!value) | ||||
| .map(([key]) => t(autoApproveSettingsConfig[key as AutoApproveSetting].labelKey)) | ||||
| .join(", ") | ||||
|
|
||||
| // Update displayed text logic | ||||
| const displayText = useMemo(() => { | ||||
| if (!effectiveAutoApprovalEnabled || !hasEnabledOptions) { | ||||
| return t("chat:autoApprove.none") | ||||
| } | ||||
| return enabledActionsList || t("chat:autoApprove.none") | ||||
| }, [effectiveAutoApprovalEnabled, hasEnabledOptions, enabledActionsList, t]) | ||||
| // Get all icons for display and highlight based on toggle state | ||||
| const allConfigs = useMemo(() => Object.values(autoApproveSettingsConfig), []) | ||||
|
|
||||
| const handleOpenSettings = useCallback( | ||||
| () => | ||||
|
|
@@ -213,8 +203,44 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => { | |||
| whiteSpace: "nowrap", | ||||
| flex: 1, | ||||
| minWidth: 0, | ||||
| }}> | ||||
| {displayText} | ||||
| display: "flex", | ||||
| alignItems: "center", | ||||
| gap: "6px", | ||||
| }} | ||||
| onClick={(e) => e.stopPropagation()}> | ||||
| {allConfigs.map(({ key, icon, labelKey }) => { | ||||
| const isEnabled = !!toggles[key] | ||||
| return ( | ||||
| <StandardTooltip key={key} content={t(labelKey)}> | ||||
| <button | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding an accessible aria-label to the icon button (e.g., aria-label={t(labelKey)}) to ensure screen reader users can understand its purpose. This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX. |
||||
| className={`codicon codicon-${icon}`} | ||||
| data-active={isEnabled ? "true" : "false"} | ||||
| onClick={() => onAutoApproveToggle(key, !isEnabled)} | ||||
| style={{ | ||||
| fontSize: "14px", | ||||
| flexShrink: 0, | ||||
| opacity: isEnabled ? 1 : 0.5, | ||||
| color: isEnabled | ||||
| ? "var(--vscode-foreground)" | ||||
| : "var(--vscode-descriptionForeground)", | ||||
| background: "transparent", | ||||
| border: "none", | ||||
| cursor: "pointer", | ||||
| padding: "2px", | ||||
| borderRadius: "3px", | ||||
| transition: "background-color 0.1s", | ||||
| }} | ||||
| onMouseEnter={(e) => { | ||||
| e.currentTarget.style.backgroundColor = | ||||
| "var(--vscode-toolbar-hoverBackground)" | ||||
| }} | ||||
| onMouseLeave={(e) => { | ||||
| e.currentTarget.style.backgroundColor = "transparent" | ||||
| }} | ||||
|
||||
| }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The onClick handler
e.stopPropagation()on the span element is redundant since each individual button already handles its own click events. This could be removed to simplify the code.