Skip to content

Commit fa8155d

Browse files
committed
Update tab management by removing delete button hover effects and simplifying clear button behavior
1 parent 8f9fd80 commit fa8155d

8 files changed

Lines changed: 17 additions & 100 deletions

File tree

‎apps/editor/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gemini-coder",
33
"displayName": "Code Web Chat",
44
"description": "Free AI coding in chatbots (CWC)",
5-
"version": "1.814.0",
5+
"version": "1.815.0",
66
"scripts": {
77
"build": "npx vsce package --no-dependencies",
88
"vscode:prepublish": "rimraf out && npm run compile",

‎apps/editor/src/views/panel/backend/message-handlers/handle-edit-context.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ export const handle_edit_context = async (
308308
panel_provider.open_editors_provider
309309
)
310310

311-
let instructions = panel_provider.edit_context_instructions
311+
let instructions = panel_provider.current_edit_context_instruction
312312

313313
if (!instructions) {
314314
vscode.window.showWarningMessage(

‎apps/editor/src/views/panel/backend/message-handlers/handle-prune-context.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export const handle_prune_context = async (
287287
panel_provider.open_editors_provider
288288
)
289289

290-
let instructions = panel_provider.prune_context_instructions
290+
let instructions = panel_provider.current_prune_context_instruction
291291

292292
if (!instructions) {
293293
vscode.window.showWarningMessage(

‎packages/ui/src/components/editor/panel/PromptField/PromptField.module.scss‎

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -581,35 +581,5 @@
581581
font-size: 11px;
582582
}
583583
}
584-
585-
&-delete {
586-
position: absolute;
587-
top: 0;
588-
left: 0;
589-
width: 100%;
590-
height: 100%;
591-
display: flex;
592-
align-items: center;
593-
justify-content: center;
594-
opacity: 0;
595-
pointer-events: none;
596-
597-
&::before {
598-
font-family: 'codicon';
599-
content: '\ea76';
600-
font-size: 11px;
601-
}
602-
}
603-
604-
&--active:hover:not(.tabs__tab--suppress-hover) {
605-
.tabs__tab-icon {
606-
opacity: 0;
607-
}
608-
609-
.tabs__tab-delete {
610-
opacity: 1;
611-
color: var(--vscode-errorForeground);
612-
}
613-
}
614584
}
615585
}

‎packages/ui/src/components/editor/panel/PromptField/PromptField.tsx‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { use_ghost_text } from './hooks/use-ghost-text'
1010
import { use_drag_drop } from './hooks/use-drag-drop'
1111
import { use_keyboard_shortcuts } from './hooks/use-keyboard-shortcuts'
1212
import { use_edit_format_compacting } from './hooks/use-edit-format-compacting'
13-
import { use_suppressed_hover_tab } from './hooks/use-suppressed-hover-tab'
1413
import { DropdownMenu } from '../../common/DropdownMenu'
1514
import { use_is_mac } from '@shared/hooks'
1615
import {
@@ -94,8 +93,6 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
9493
const [hovered_edit_format, set_hovered_edit_format] =
9594
useState<EditFormat | null>(null)
9695
const [is_recording_hovered, set_is_recording_hovered] = useState(false)
97-
const { suppressed_hover_tab_index, handle_mouse_over } =
98-
use_suppressed_hover_tab(props.active_tab_index)
9996

10097
const [prune_instructions, set_prune_instructions] = useState(
10198
props.prune_context_instructions_prefix
@@ -208,9 +205,7 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
208205
is_chatbots_mode: props.is_chatbots_mode,
209206
tabs_config: {
210207
count: props.tabs_count,
211-
active_index: props.active_tab_index,
212-
can_delete: true,
213-
suppressed_index: suppressed_hover_tab_index ?? undefined
208+
active_index: props.active_tab_index
214209
}
215210
})
216211
}, [
@@ -220,8 +215,7 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
220215
props.context_file_paths,
221216
props.is_chatbots_mode,
222217
props.tabs_count,
223-
props.active_tab_index,
224-
suppressed_hover_tab_index
218+
props.active_tab_index
225219
])
226220

227221
useEffect(() => {
@@ -350,7 +344,6 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
350344
(!!props.current_selection || !props.currently_open_file_path),
351345
[styles['container__inner--selecting']]: is_text_selecting
352346
})}
353-
onMouseOver={handle_mouse_over}
354347
onKeyDown={handle_container_key_down}
355348
onClick={() => input_ref.current?.focus()}
356349
>

‎packages/ui/src/components/editor/panel/PromptField/hooks/use-handlers.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,6 @@ export const use_handlers = (
729729
const clear_button = target.closest('[data-role="clear-button"]')
730730
const tab_item = target.closest('[data-role="tab-item"]')
731731
const tab_new = target.closest('[data-role="tab-new"]')
732-
const tab_delete = target.closest('[data-role="tab-delete"]')
733732

734733
if (icon_element) {
735734
e.preventDefault()
@@ -819,17 +818,19 @@ export const use_handlers = (
819818
} else if (clear_button) {
820819
e.preventDefault()
821820
e.stopPropagation()
822-
handle_clear()
821+
if (props.value) {
822+
handle_clear()
823+
} else if (props.tabs_count > 1) {
824+
props.on_tab_delete(props.active_tab_index)
825+
}
823826
if (params.input_ref.current) {
824827
params.input_ref.current.focus()
825828
}
826829
} else if (tab_item) {
827830
e.preventDefault()
828831
e.stopPropagation()
829832
const index = parseInt((tab_item as HTMLElement).dataset.index || '0')
830-
if (index == props.active_tab_index) {
831-
props.on_tab_delete?.(index)
832-
} else {
833+
if (index !== props.active_tab_index) {
833834
props.on_tab_change?.(index)
834835
}
835836
} else if (tab_new) {

‎packages/ui/src/components/editor/panel/PromptField/hooks/use-suppressed-hover-tab.ts‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎packages/ui/src/components/editor/panel/PromptField/utils/get-highlighted-text.tsx‎

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ export const get_highlighted_text = (params: {
5151
tabs_config?: {
5252
count: number
5353
active_index: number
54-
can_delete: boolean
55-
suppressed_index?: number
5654
}
5755
}): string => {
5856
const saved_context_regex_part =
@@ -268,7 +266,9 @@ export const get_highlighted_text = (params: {
268266
})
269267
.join('')
270268

271-
if (params.text) {
269+
const show_clear_button =
270+
!!params.text || (params.tabs_config && params.tabs_config.count > 1)
271+
if (show_clear_button) {
272272
result =
273273
`<span class="${cn(
274274
styles['clear-button'],
@@ -278,26 +278,16 @@ export const get_highlighted_text = (params: {
278278
}
279279

280280
if (params.tabs_config) {
281-
const { count, active_index, can_delete, suppressed_index } =
282-
params.tabs_config
281+
const { count, active_index } = params.tabs_config
283282
let tabs_items = ''
284283

285284
if (count > 1) {
286285
for (let i = 0; i < count; i++) {
287286
const is_active = i == active_index
288-
const is_suppressed = i == suppressed_index
289-
const delete_btn = can_delete
290-
? `<span class="${cn(
291-
styles['tabs__tab-delete']
292-
)}" data-role="tab-delete" data-index="${i}"></span>`
293-
: ''
294287

295288
tabs_items += `<span class="${cn(styles['tabs__tab'], {
296-
[styles['tabs__tab--active']]: is_active,
297-
[styles['tabs__tab--suppress-hover']]: is_suppressed
298-
})}" data-role="tab-item" data-index="${i}"><span class="${
299-
styles['tabs__tab-icon']
300-
}"></span>${delete_btn}</span>`
289+
[styles['tabs__tab--active']]: is_active
290+
})}" data-role="tab-item" data-index="${i}"><span class="${styles['tabs__tab-icon']}"></span></span>`
301291
}
302292
}
303293

0 commit comments

Comments
 (0)