From 15e3a12bd3ebf6e055c22b57362d8815bf1e6fc2 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Mon, 2 Jun 2025 23:11:44 -0700 Subject: [PATCH] fix: Fix demo banner layout conflict with sidebar - Extract demo banner from global fixed positioning to prevent sidebar overlap - Create reusable DemoBanner component with proper positioning logic - Consolidate header structure across all app pages using new Header component - Remove duplicate header code from agents, inbox, chat, rag, tools, and playground pages - Fix visual bug where demo banner was being cut off by the sidebar layout Resolves layout conflict where the fixed-positioned demo banner would overlap or be clipped by the sidebar navigation structure. --- apps/web/src/app/(app)/agents/page.tsx | 23 ++++++------- apps/web/src/app/(app)/inbox/page.tsx | 24 ++++++------- apps/web/src/app/(app)/layout.tsx | 16 --------- apps/web/src/app/(app)/page.tsx | 11 +++--- apps/web/src/app/(app)/rag/page.tsx | 23 ++++++------- apps/web/src/app/(app)/tools/page.tsx | 26 +++++++------- .../src/app/(app)/tools/playground/page.tsx | 34 +++++++++---------- apps/web/src/components/ui/demo.tsx | 29 ++++++++++++++++ apps/web/src/components/ui/header.tsx | 17 ++++++++++ 9 files changed, 114 insertions(+), 89 deletions(-) create mode 100644 apps/web/src/components/ui/demo.tsx create mode 100644 apps/web/src/components/ui/header.tsx diff --git a/apps/web/src/app/(app)/agents/page.tsx b/apps/web/src/app/(app)/agents/page.tsx index f7538363..d9a67ed1 100644 --- a/apps/web/src/app/(app)/agents/page.tsx +++ b/apps/web/src/app/(app)/agents/page.tsx @@ -7,6 +7,7 @@ import { BreadcrumbList, BreadcrumbPage, } from "@/components/ui/breadcrumb"; +import { Header } from "@/components/ui/header"; import { SidebarTrigger } from "@/components/ui/sidebar"; import { Toaster } from "@/components/ui/sonner"; import React from "react"; @@ -19,18 +20,16 @@ export default function AgentsPage(): React.ReactNode { return ( Loading (layout)...}> -
-
- - - - - Agents - - - -
-
+
+ + + + + Agents + + + +
); diff --git a/apps/web/src/app/(app)/inbox/page.tsx b/apps/web/src/app/(app)/inbox/page.tsx index e85a97c4..6b39200f 100644 --- a/apps/web/src/app/(app)/inbox/page.tsx +++ b/apps/web/src/app/(app)/inbox/page.tsx @@ -5,6 +5,7 @@ import React from "react"; import { ThreadsProvider } from "@/components/agent-inbox/contexts/ThreadContext"; import { SidebarTrigger } from "@/components/ui/sidebar"; import { Toaster } from "@/components/ui/sonner"; +import { Header } from "@/components/ui/header"; import { InboxSidebar, InboxSidebarTrigger } from "@/components/inbox-sidebar"; import { SidebarProvider } from "@/components/ui/sidebar"; import { @@ -22,19 +23,16 @@ export default function InboxPage(): React.ReactNode {
{/* Header */}
-
-
- - - - - - Inbox - - - -
-
+
+ + + + + Inbox + + + +
{/* Main content */}
diff --git a/apps/web/src/app/(app)/layout.tsx b/apps/web/src/app/(app)/layout.tsx index d7d1bb30..58c4908b 100644 --- a/apps/web/src/app/(app)/layout.tsx +++ b/apps/web/src/app/(app)/layout.tsx @@ -5,7 +5,6 @@ import React from "react"; import { NuqsAdapter } from "nuqs/adapters/next/app"; import { SidebarLayout } from "@/components/sidebar"; import { AuthProvider } from "@/providers/Auth"; -import { DOCS_LINK } from "@/constants"; const inter = Inter({ subsets: ["latin"], @@ -23,7 +22,6 @@ export default function RootLayout({ }: Readonly<{ children: React.ReactNode; }>) { - const isDemoApp = process.env.NEXT_PUBLIC_DEMO_APP === "true"; return ( @@ -35,20 +33,6 @@ export default function RootLayout({ )} - {isDemoApp && ( -
- You're currently using the demo application. To use your own agents, - and run in production, check out the{" "} - - documentation - -
- )} {children} diff --git a/apps/web/src/app/(app)/page.tsx b/apps/web/src/app/(app)/page.tsx index 2f87a452..2089e034 100644 --- a/apps/web/src/app/(app)/page.tsx +++ b/apps/web/src/app/(app)/page.tsx @@ -2,6 +2,7 @@ import ChatInterface from "@/features/chat"; import { SidebarTrigger } from "@/components/ui/sidebar"; +import { Header } from "@/components/ui/header"; import { Toaster } from "@/components/ui/sonner"; import React from "react"; import { ChatBreadcrumb } from "@/features/chat/components/chat-breadcrumb"; @@ -14,12 +15,10 @@ export default function ChatPage(): React.ReactNode { return ( Loading (layout)...
}> -
-
- - -
-
+
+ + +
); diff --git a/apps/web/src/app/(app)/rag/page.tsx b/apps/web/src/app/(app)/rag/page.tsx index 4c05538b..bfea0faa 100644 --- a/apps/web/src/app/(app)/rag/page.tsx +++ b/apps/web/src/app/(app)/rag/page.tsx @@ -7,6 +7,7 @@ import { BreadcrumbList, BreadcrumbPage, } from "@/components/ui/breadcrumb"; +import { Header } from "@/components/ui/header"; import { SidebarTrigger } from "@/components/ui/sidebar"; import { Toaster } from "@/components/ui/sonner"; import React from "react"; @@ -19,18 +20,16 @@ export default function RAGPage(): React.ReactNode { return ( Loading (layout)...
}> -
-
- - - - - RAG - - - -
-
+
+ + + + + RAG + + + +
); diff --git a/apps/web/src/app/(app)/tools/page.tsx b/apps/web/src/app/(app)/tools/page.tsx index b67f0cfc..6d46bf01 100644 --- a/apps/web/src/app/(app)/tools/page.tsx +++ b/apps/web/src/app/(app)/tools/page.tsx @@ -1,5 +1,7 @@ "use client"; +import React from "react"; + import ToolsInterface from "@/features/tools"; import { Breadcrumb, @@ -9,7 +11,7 @@ import { } from "@/components/ui/breadcrumb"; import { SidebarTrigger } from "@/components/ui/sidebar"; import { Toaster } from "@/components/ui/sonner"; -import React from "react"; +import { Header } from "@/components/ui/header"; /** * The /tools page. @@ -19,18 +21,16 @@ export default function ToolsPage(): React.ReactNode { return ( Loading (layout)...
}> -
-
- - - - - Tools - - - -
-
+
+ + + + + Tools + + + +
); diff --git a/apps/web/src/app/(app)/tools/playground/page.tsx b/apps/web/src/app/(app)/tools/playground/page.tsx index 3607fd51..fdf49529 100644 --- a/apps/web/src/app/(app)/tools/playground/page.tsx +++ b/apps/web/src/app/(app)/tools/playground/page.tsx @@ -1,5 +1,7 @@ "use client"; +import React from "react"; + import ToolsPlaygroundInterface from "@/features/tools/playground"; import { Breadcrumb, @@ -11,7 +13,7 @@ import { } from "@/components/ui/breadcrumb"; import { SidebarTrigger } from "@/components/ui/sidebar"; import { Toaster } from "@/components/ui/sonner"; -import React from "react"; +import { Header } from "@/components/ui/header"; /** * The /tools page. @@ -21,22 +23,20 @@ export default function ToolsPage(): React.ReactNode { return ( Loading (layout)...}> -
-
- - - - - Tools - - - - Playground - - - -
-
+
+ + + + + Tools + + + + Playground + + + +
); diff --git a/apps/web/src/components/ui/demo.tsx b/apps/web/src/components/ui/demo.tsx new file mode 100644 index 00000000..991ffd3b --- /dev/null +++ b/apps/web/src/components/ui/demo.tsx @@ -0,0 +1,29 @@ +import { DOCS_LINK } from "@/constants"; + +const isDemoApp = process.env.NEXT_PUBLIC_DEMO_APP === "true"; + +/** + * A banner that appears at the top of the page if the app is a demo app. + */ +function DemoBanner() { + if (!isDemoApp) { + return + } + + return ( +
+ You're currently using the demo application. To use your own agents, + and run in production, check out the{" "} + + documentation + +
+ ) +} + +export { DemoBanner }; \ No newline at end of file diff --git a/apps/web/src/components/ui/header.tsx b/apps/web/src/components/ui/header.tsx new file mode 100644 index 00000000..11101179 --- /dev/null +++ b/apps/web/src/components/ui/header.tsx @@ -0,0 +1,17 @@ +import { DemoBanner } from "./demo"; + +/** + * A header component that can be used to display a header with a sidebar trigger and a breadcrumb. + */ +function Header({ children }: React.PropsWithChildren) { + return ( +
+ +
+ {children} +
+
+ ) +} + +export { Header }; \ No newline at end of file