Skip to content

Commit 0e85f96

Browse files
committed
Add response history to landscape header placeholders for edit files
└── apps └── editor └── src └── views └── prompt └── frontend └── Main └── MainView ├── MainView.tsx └── components └── Header ├── Header.module.scss ├── Header.tsx └── index.ts
1 parent 6aa6eae commit 0e85f96

2 files changed

Lines changed: 136 additions & 60 deletions

File tree

‎apps/editor/src/views/prompt/frontend/Main/MainView/MainView.tsx‎

Lines changed: 65 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ export const MainView: React.FC<Props> = (props) => {
280280
is_browser_connection_status_bar_closed={browser_connection.is_closed}
281281
is_content_scrollable={is_content_scrollable}
282282
is_api_warning_visible={is_api_warning_visible}
283+
response_history={props.response_history}
283284
/>
284285
)
285286

@@ -503,40 +504,74 @@ export const MainView: React.FC<Props> = (props) => {
503504

504505
const configurations_placeholder_above = (
505506
<>
506-
{props.target == TARGET.WEB && !browser_connection.is_closed && (
507+
{props.target == TARGET.WEB && (
507508
<>
508-
<UiStatusBar
509-
icon="codicon-debug-disconnect"
510-
label=""
511-
actions={[
512-
{
513-
id: 'install',
514-
icon: 'codicon-add',
515-
label: '',
516-
title: '',
517-
on_click: () => {}
518-
}
519-
]}
520-
/>
521-
<UiSpacer height={6} />
509+
{!browser_connection.is_closed && (
510+
<>
511+
<UiStatusBar
512+
icon="codicon-debug-disconnect"
513+
label=""
514+
actions={[
515+
{
516+
id: 'install',
517+
icon: 'codicon-add',
518+
label: '',
519+
title: '',
520+
on_click: () => {}
521+
}
522+
]}
523+
/>
524+
<UiSpacer height={6} />
525+
</>
526+
)}
527+
{props.response_history.length > 0 &&
528+
props.web_prompt_type === 'edit-files' && (
529+
<UiResponses
530+
response_history={props.response_history}
531+
on_response_history_item_click={() => {}}
532+
on_selected_history_item_change={() => {}}
533+
on_response_history_item_remove={() => {}}
534+
translations={{
535+
applied_manually: '',
536+
reject: ''
537+
}}
538+
/>
539+
)}
522540
</>
523541
)}
524-
{props.target == TARGET.API && is_api_warning_visible && (
542+
{props.target == TARGET.API && (
525543
<>
526-
<UiStatusBar
527-
icon="codicon-warning"
528-
label=""
529-
actions={[
530-
{
531-
id: 'settings',
532-
icon: 'codicon-gear',
533-
label: '',
534-
title: '',
535-
on_click: () => {}
536-
}
537-
]}
538-
/>
539-
<UiSpacer height={6} />
544+
{is_api_warning_visible && (
545+
<>
546+
<UiStatusBar
547+
icon="codicon-warning"
548+
label=""
549+
actions={[
550+
{
551+
id: 'settings',
552+
icon: 'codicon-gear',
553+
label: '',
554+
title: '',
555+
on_click: () => {}
556+
}
557+
]}
558+
/>
559+
<UiSpacer height={6} />
560+
</>
561+
)}
562+
{props.response_history.length > 0 &&
563+
props.api_prompt_type === 'edit-files' && (
564+
<UiResponses
565+
response_history={props.response_history}
566+
on_response_history_item_click={() => {}}
567+
on_selected_history_item_change={() => {}}
568+
on_response_history_item_remove={() => {}}
569+
translations={{
570+
applied_manually: '',
571+
reject: ''
572+
}}
573+
/>
574+
)}
540575
</>
541576
)}
542577
</>

‎apps/editor/src/views/prompt/frontend/Main/MainView/components/Header/Header.tsx‎

Lines changed: 71 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {
1212
import { use_translation } from '@/views/prompt/frontend/i18n/use-translation'
1313
import { StatusBar as UiStatusBar } from '@ui/components/editor/prompt/StatusBar'
1414
import { Spacer as UiSpacer } from '@ui/components/editor/prompt/Spacer'
15+
import { Responses as UiResponses } from '@ui/components/editor/prompt/Responses'
16+
import { ResponseHistoryItem } from '@shared/types/response-history-item'
1517

1618
type Props = {
1719
target: Target
@@ -25,6 +27,7 @@ type Props = {
2527
is_browser_connection_status_bar_closed: boolean
2628
is_content_scrollable: boolean
2729
is_api_warning_visible: boolean
30+
response_history: ResponseHistoryItem[]
2831
}
2932

3033
export const Header: React.FC<Props> = (props) => {
@@ -51,7 +54,9 @@ export const Header: React.FC<Props> = (props) => {
5154
<div className={styles.header__types}>
5255
{props.is_landscape &&
5356
props.target == TARGET.WEB &&
54-
!props.is_browser_connection_status_bar_closed &&
57+
(!props.is_browser_connection_status_bar_closed ||
58+
(props.response_history.length > 0 &&
59+
props.web_prompt_type === 'edit-files')) &&
5560
!props.is_content_scrollable && (
5661
<>
5762
<div
@@ -61,26 +66,45 @@ export const Header: React.FC<Props> = (props) => {
6166
width: 0
6267
}}
6368
>
64-
<UiStatusBar
65-
icon="codicon-debug-disconnect"
66-
label=""
67-
actions={[
68-
{
69-
id: 'install',
70-
icon: 'codicon-add',
71-
label: '',
72-
title: '',
73-
on_click: () => {}
74-
}
75-
]}
76-
/>
77-
<UiSpacer height={6} />
69+
{!props.is_browser_connection_status_bar_closed && (
70+
<>
71+
<UiStatusBar
72+
icon="codicon-debug-disconnect"
73+
label=""
74+
actions={[
75+
{
76+
id: 'install',
77+
icon: 'codicon-add',
78+
label: '',
79+
title: '',
80+
on_click: () => {}
81+
}
82+
]}
83+
/>
84+
<UiSpacer height={6} />
85+
</>
86+
)}
87+
{props.response_history.length > 0 &&
88+
props.web_prompt_type === 'edit-files' && (
89+
<UiResponses
90+
response_history={props.response_history}
91+
on_response_history_item_click={() => {}}
92+
on_selected_history_item_change={() => {}}
93+
on_response_history_item_remove={() => {}}
94+
translations={{
95+
applied_manually: '',
96+
reject: ''
97+
}}
98+
/>
99+
)}
78100
</div>
79101
</>
80102
)}
81103
{props.is_landscape &&
82104
props.target == TARGET.API &&
83-
props.is_api_warning_visible &&
105+
(props.is_api_warning_visible ||
106+
(props.response_history.length > 0 &&
107+
props.api_prompt_type === 'edit-files')) &&
84108
!props.is_content_scrollable && (
85109
<>
86110
<div
@@ -90,20 +114,37 @@ export const Header: React.FC<Props> = (props) => {
90114
width: 0
91115
}}
92116
>
93-
<UiStatusBar
94-
icon="codicon-warning"
95-
label=""
96-
actions={[
97-
{
98-
id: 'settings',
99-
icon: 'codicon-gear',
100-
label: '',
101-
title: '',
102-
on_click: () => {}
103-
}
104-
]}
105-
/>
106-
<UiSpacer height={6} />
117+
{props.is_api_warning_visible && (
118+
<>
119+
<UiStatusBar
120+
icon="codicon-warning"
121+
label=""
122+
actions={[
123+
{
124+
id: 'settings',
125+
icon: 'codicon-gear',
126+
label: '',
127+
title: '',
128+
on_click: () => {}
129+
}
130+
]}
131+
/>
132+
<UiSpacer height={6} />
133+
</>
134+
)}
135+
{props.response_history.length > 0 &&
136+
props.api_prompt_type === 'edit-files' && (
137+
<UiResponses
138+
response_history={props.response_history}
139+
on_response_history_item_click={() => {}}
140+
on_selected_history_item_change={() => {}}
141+
on_response_history_item_remove={() => {}}
142+
translations={{
143+
applied_manually: '',
144+
reject: ''
145+
}}
146+
/>
147+
)}
107148
</div>
108149
</>
109150
)}

0 commit comments

Comments
 (0)