Skip to content

Commit 54d501b

Browse files
committed
Adjust landscape header layout to accommodate API warning status bar
- in target:api we can show a warning status bar, should account for space taken by it in the landscape header └── apps └── editor └── src └── views └── prompt └── frontend └── Main └── MainView ├── MainView.tsx └── components └── Header ├── Header.module.scss ├── Header.tsx └── index.ts
1 parent b7adf61 commit 54d501b

2 files changed

Lines changed: 57 additions & 24 deletions

File tree

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

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,11 @@ export const MainView: React.FC<Props> = (props) => {
262262
}
263263
})
264264

265+
const is_api_warning_visible =
266+
props.target == TARGET.API &&
267+
!!props.setup_progress &&
268+
(!props.setup_progress.has_provider || props.api_configurations.length == 0)
269+
265270
const header = (
266271
<Header
267272
target={props.target}
@@ -274,6 +279,7 @@ export const MainView: React.FC<Props> = (props) => {
274279
is_landscape={is_landscape}
275280
is_browser_connection_status_bar_closed={browser_connection.is_closed}
276281
is_content_scrollable={is_content_scrollable}
282+
is_api_warning_visible={is_api_warning_visible}
277283
/>
278284
)
279285

@@ -295,30 +301,27 @@ export const MainView: React.FC<Props> = (props) => {
295301
}}
296302
/>
297303

298-
{props.target == TARGET.API &&
299-
props.setup_progress &&
300-
(!props.setup_progress.has_provider ||
301-
props.api_configurations.length == 0) && (
302-
<>
303-
<UiStatusBar
304-
theme="warning"
305-
icon="codicon-warning"
306-
label={t('configurations.api-setup-incomplete')}
307-
actions={[
308-
{
309-
id: 'settings',
310-
icon: 'codicon-gear',
311-
label: t('action.settings'),
312-
title: t('action.settings'),
313-
on_click: !props.setup_progress.has_provider
314-
? props.on_manage_providers
315-
: props.on_manage_models
316-
}
317-
]}
318-
/>
319-
<UiSpacer height={6} />
320-
</>
321-
)}
304+
{is_api_warning_visible && (
305+
<>
306+
<UiStatusBar
307+
theme="warning"
308+
icon="codicon-warning"
309+
label={t('configurations.api-setup-incomplete')}
310+
actions={[
311+
{
312+
id: 'settings',
313+
icon: 'codicon-gear',
314+
label: t('action.settings'),
315+
title: t('action.settings'),
316+
on_click: !props.setup_progress!.has_provider
317+
? props.on_manage_providers
318+
: props.on_manage_models
319+
}
320+
]}
321+
/>
322+
<UiSpacer height={6} />
323+
</>
324+
)}
322325

323326
{props.response_history.length > 0 &&
324327
(props.target == TARGET.WEB

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type Props = {
2424
is_landscape: boolean
2525
is_browser_connection_status_bar_closed: boolean
2626
is_content_scrollable: boolean
27+
is_api_warning_visible: boolean
2728
}
2829

2930
export const Header: React.FC<Props> = (props) => {
@@ -77,6 +78,35 @@ export const Header: React.FC<Props> = (props) => {
7778
</div>
7879
</>
7980
)}
81+
{props.is_landscape &&
82+
props.target == TARGET.API &&
83+
props.is_api_warning_visible &&
84+
!props.is_content_scrollable && (
85+
<>
86+
<div
87+
style={{
88+
visibility: 'hidden',
89+
pointerEvents: 'none',
90+
width: 0
91+
}}
92+
>
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} />
107+
</div>
108+
</>
109+
)}
80110
{props.target == TARGET.WEB && (
81111
<>
82112
<div className={styles.header__types__inner}>

0 commit comments

Comments
 (0)