-
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 1 commit
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,12 @@ 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 enabled icons for display | ||||
| const enabledIcons = useMemo(() => { | ||||
| return Object.entries(toggles) | ||||
| .filter(([_key, value]) => !!value) | ||||
| .map(([key]) => autoApproveSettingsConfig[key as AutoApproveSetting].icon) | ||||
| }, [toggles]) | ||||
|
|
||||
| const handleOpenSettings = useCallback( | ||||
| () => | ||||
|
|
@@ -213,8 +207,22 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => { | |||
| whiteSpace: "nowrap", | ||||
| flex: 1, | ||||
| minWidth: 0, | ||||
| display: "flex", | ||||
| alignItems: "center", | ||||
| gap: "6px", | ||||
| }}> | ||||
| {displayText} | ||||
| {!effectiveAutoApprovalEnabled || !hasEnabledOptions | ||||
|
||||
| ? t("chat:autoApprove.none") | ||||
| : enabledIcons.map((icon, index) => ( | ||||
|
||||
| <span | ||||
|
||||
| key={index} | ||||
|
||||
| className={`codicon codicon-${icon}`} | ||||
| style={{ | ||||
| fontSize: "14px", | ||||
| flexShrink: 0, | ||||
| }} | ||||
|
||||
| }} |
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 dependency array includes the entire toggles object. For better performance, consider memoizing based on just the enabled state values or using a more specific dependency array.