Skip to content

Commit c5cf8a8

Browse files
committed
Remove visibility logic for the Apply and Undo buttons from the LayoutContext to ensure they are always displayed in the panel footer
1 parent bbd9c24 commit c5cf8a8

3 files changed

Lines changed: 26 additions & 40 deletions

File tree

‎packages/vscode/src/views/panel/frontend/Panel.tsx‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ export const Panel = () => {
171171
}
172172

173173
const layout_context_value = {
174-
is_apply_visible: active_view == 'main' && mode == MODE.WEB,
175-
is_undo_visible: active_view == 'main',
176174
can_undo,
177175
has_changes_to_commit,
178176
on_apply_click: handle_apply_click,

‎packages/vscode/src/views/panel/frontend/components/Footer/Footer.tsx‎

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { LayoutContext } from '../../contexts/LayoutContext'
66

77
export const Footer: React.FC = () => {
88
const {
9-
is_apply_visible,
10-
is_undo_visible,
119
can_undo,
1210
has_changes_to_commit,
1311
on_apply_click,
@@ -83,40 +81,34 @@ export const Footer: React.FC = () => {
8381
</div>
8482

8583
<div>
86-
{is_apply_visible && (
87-
<button
84+
<button
85+
className={cn(
86+
styles['footer__action-button'],
87+
styles['footer__action-button--no-shrink']
88+
)}
89+
onClick={handle_apply_click}
90+
title={'Integrate copied chat response or a single code block'}
91+
disabled={is_apply_disabled_temporarily}
92+
>
93+
Apply
94+
</button>
95+
<button
96+
className={styles['footer__action-button']}
97+
onClick={on_undo_click}
98+
title={
99+
'Restore saved state of the codebase after chat/API response integration'
100+
}
101+
disabled={!can_undo}
102+
>
103+
<span className={styles['footer__action-button__text']}>Undo</span>
104+
<span
88105
className={cn(
89-
styles['footer__action-button'],
90-
styles['footer__action-button--no-shrink']
106+
styles['footer__action-button__icon'],
107+
'codicon',
108+
'codicon-redo'
91109
)}
92-
onClick={handle_apply_click}
93-
title={'Integrate copied chat response or a single code block'}
94-
disabled={is_apply_disabled_temporarily}
95-
>
96-
Apply
97-
</button>
98-
)}
99-
{is_undo_visible && (
100-
<button
101-
className={styles['footer__action-button']}
102-
onClick={on_undo_click}
103-
title={
104-
'Restore saved state of the codebase after chat/API response integration'
105-
}
106-
disabled={!can_undo}
107-
>
108-
<span className={styles['footer__action-button__text']}>
109-
Undo
110-
</span>
111-
<span
112-
className={cn(
113-
styles['footer__action-button__icon'],
114-
'codicon',
115-
'codicon-redo'
116-
)}
117-
/>
118-
</button>
119-
)}
110+
/>
111+
</button>
120112
<button
121113
className={styles['footer__action-button']}
122114
onClick={handle_commit_click}

‎packages/vscode/src/views/panel/frontend/contexts/LayoutContext.tsx‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { createContext } from 'react'
22

33
type LayoutContextType = {
4-
is_apply_visible: boolean
5-
is_undo_visible: boolean
64
can_undo: boolean
75
has_changes_to_commit: boolean
86
on_apply_click: () => void
@@ -12,8 +10,6 @@ type LayoutContextType = {
1210
}
1311

1412
export const LayoutContext = createContext<LayoutContextType>({
15-
is_apply_visible: false,
16-
is_undo_visible: false,
1713
can_undo: false,
1814
has_changes_to_commit: false,
1915
on_apply_click: () => {},

0 commit comments

Comments
 (0)