+ {!layout.header?.hide && (
+
+ )}
+
+ {cloudAppState === "error" &&
+ layout.errorScreen?.position === "default" && (
+
+
+
+ )}
+
+ {renderApp && (
+ <>
+
+ {loading && (
+
+ )}
+
+ {!layout.leftPanel?.hide &&
+ layout.leftPanel?.components?.length && (
+
+ {layout.leftPanel?.components.map(
+ (component: LayoutComponent, index: number) => {
+ const panelComponent = renderLayoutComponent(component);
+
+ if (index > 0) {
+ return (
+
+ {panelComponent}
+
+ );
+ }
+ return panelComponent;
+ },
+ )}
+
+ )}
+
+
+
+
+
+ setSelectedItems(nodeId ? [nodeId] : [])
+ }
+ />
+
+
+
+ {metadata.data && (
+ {
+ expand(path);
+ setSelectedItems([path]);
+ }}
+ />
+ )}
+
+
+
+
+
+ {!layout.bottomPanel?.hide && (
+
+ {layout.bottomPanel?.components?.map(
+ (component: LayoutComponent, index: number) => {
+ const panelComponent = renderLayoutComponent(component);
+ if (
+ layout.bottomPanel?.components?.length &&
+ layout.bottomPanel.components.length > 1 &&
+ index !== layout.bottomPanel.components.length - 1
+ ) {
+ return (
+
+ {panelComponent}
+
+ );
+ }
+ return panelComponent;
+ },
+ )}
+
+ )}
+
+ {cloudAppState === "error" &&
+ layout.errorScreen?.position === "bottom" && (
+ <>
+
+
+
+
+
+
+
+ >
+ )}
+ >
+ )}
+
+ {!layout.statusBar?.hide && (
+
+ )}
+
+ >
+ );
+};
diff --git a/apps/wing-console/console/ui/src/layout/header.tsx b/apps/wing-console/console/ui/src/layout/header.tsx
index a40e15b0027..bf9e64b01b2 100644
--- a/apps/wing-console/console/ui/src/layout/header.tsx
+++ b/apps/wing-console/console/ui/src/layout/header.tsx
@@ -1,28 +1,15 @@
-import { MoonIcon, SunIcon } from "@heroicons/react/24/outline";
import { useTheme } from "@wingconsole/design-system";
import classNames from "classnames";
-import { useCallback, useMemo } from "react";
+
+import { ThemeToggle } from "./theme-toggle.js";
export interface HeaderProps {
title: string;
+ showThemeToggle?: boolean;
}
-export const Header = ({ title }: HeaderProps) => {
- const { theme, setThemeMode, mode, mediaTheme } = useTheme();
-
- const currentTheme = useMemo(() => {
- if (mode === "auto") {
- return mediaTheme;
- }
- return mode;
- }, [mode, mediaTheme]);
-
- const toggleThemeMode = useCallback(() => {
- const newMode =
- // eslint-disable-next-line unicorn/no-nested-ternary
- mode === "light" ? "auto" : mode === "auto" ? "dark" : "light";
- setThemeMode?.(newMode);
- }, [setThemeMode, mode]);
+export const Header = ({ title, showThemeToggle = true }: HeaderProps) => {
+ const { theme } = useTheme();
return (