|
13 | 13 | // limitations under the License. |
14 | 14 |
|
15 | 15 | import m from 'mithril'; |
| 16 | +import {classNames} from '../base/classnames'; |
16 | 17 | import {AppImpl} from '../core/app_impl'; |
17 | 18 | import {CookieConsent} from '../core/cookie_consent'; |
18 | 19 | import {featureFlags} from '../core/feature_flags'; |
| 20 | +import {OmniboxMode} from '../core/omnibox_manager'; |
19 | 21 | import {LinearProgress} from '../widgets/linear_progress'; |
20 | 22 | import {maybeRenderFullscreenModalDialog} from '../widgets/modal'; |
21 | 23 | import {initCssConstants} from './css_constants'; |
@@ -57,17 +59,33 @@ export class UiMain implements m.ClassComponent { |
57 | 59 | (trace?.engine.numRequestsPending ?? 0) > 0 || |
58 | 60 | taskTracker.hasPendingTasks(); |
59 | 61 |
|
| 62 | + const zenMode = app.zenModeEnabled; |
| 63 | + const showStatusBar = showStatusBarFlag.get() && !zenMode; |
| 64 | + |
| 65 | + // In zen mode, topbar visibility is controlled by CSS classes |
| 66 | + // Show topbar when: not in search mode, has text, or should focus |
| 67 | + const shouldShowTopbarInZenMode = |
| 68 | + app.omnibox.mode !== OmniboxMode.Search || |
| 69 | + app.omnibox.text.length > 0 || |
| 70 | + app.omnibox.focusOmniboxNextRender; |
| 71 | + |
60 | 72 | return m('main.pf-ui-main', [ |
61 | | - m(Sidebar), |
62 | | - m(Topbar, {trace}), |
| 73 | + app.sidebar.enabled && m(Sidebar), |
| 74 | + m(Topbar, { |
| 75 | + trace, |
| 76 | + className: classNames( |
| 77 | + zenMode && 'pf-zen-mode', |
| 78 | + zenMode && shouldShowTopbarInZenMode && 'pf-zen-mode--show', |
| 79 | + ), |
| 80 | + }), |
63 | 81 | m(LinearProgress, { |
64 | 82 | className: 'pf-ui-main__loading', |
65 | 83 | state: isSomethingLoading ? 'indeterminate' : 'none', |
66 | 84 | }), |
67 | 85 | m('.pf-ui-main__page-container', app.pages.renderPageForCurrentRoute()), |
68 | 86 | m(CookieConsent), |
69 | 87 | maybeRenderFullscreenModalDialog(), |
70 | | - showStatusBarFlag.get() && renderStatusBar(trace), |
| 88 | + showStatusBar && renderStatusBar(trace), |
71 | 89 | app.perfDebugging.renderPerfStats(), |
72 | 90 | ]); |
73 | 91 | } |
|
0 commit comments