From 9d1aced1e748773310e4da9b02da2d98ab8d8873 Mon Sep 17 00:00:00 2001 From: Cole Goldsmith Date: Mon, 6 Oct 2025 12:02:36 -0500 Subject: [PATCH] refactor the grid layout to inlcude banner and header rows --- frontend/src/app/globals.css | 31 ++++++-- frontend/src/app/knowledge/chunks/page.tsx | 2 - frontend/src/components/layout-wrapper.tsx | 89 ++++++++++------------ frontend/src/contexts/layout-context.tsx | 34 --------- 4 files changed, 64 insertions(+), 92 deletions(-) delete mode 100644 frontend/src/contexts/layout-context.tsx diff --git a/frontend/src/app/globals.css b/frontend/src/app/globals.css index e3f4c154..630cdf53 100644 --- a/frontend/src/app/globals.css +++ b/frontend/src/app/globals.css @@ -110,31 +110,46 @@ } @layer components { - .app-grid-cols-arrangement { + .app-grid-arrangement { --sidebar-width: 0px; --notifications-width: 0px; --filters-width: 0px; + --app-header-height: 53px; + --top-banner-height: 0px; @media (width >= 48rem) { --sidebar-width: 288px; } - &.notifications-open { --notifications-width: 320px; } &.filters-open { --filters-width: 320px; } + &.banner-visible { + --top-banner-height: 52px; + } display: grid; - height: calc(100% - var(--app-header-height)); - grid-template-columns: var(--sidebar-width) 1fr var(--notifications-width) var( - --filters-width - ); - transition: grid-template-columns 0.3s ease-in-out; + height: 100%; + width: 100%; + grid-template-rows: + var(--top-banner-height) + var(--app-header-height) + 1fr; + grid-template-columns: + var(--sidebar-width) + 1fr + var(--notifications-width) + var(--filters-width); + grid-template-areas: + "banner banner banner banner" + "header header header header" + "nav main notifications filters"; + transition: grid-template-columns 0.25s ease-in-out; } .header-arrangement { - @apply flex w-full h-[53px] items-center justify-between border-b border-border; + @apply flex w-full items-center justify-between border-b border-border; } .header-start-display { diff --git a/frontend/src/app/knowledge/chunks/page.tsx b/frontend/src/app/knowledge/chunks/page.tsx index e1ea9ed9..3c8b4339 100644 --- a/frontend/src/app/knowledge/chunks/page.tsx +++ b/frontend/src/app/knowledge/chunks/page.tsx @@ -6,8 +6,6 @@ import { useRouter, useSearchParams } from "next/navigation"; import { ProtectedRoute } from "@/components/protected-route"; import { Button } from "@/components/ui/button"; import { useKnowledgeFilter } from "@/contexts/knowledge-filter-context"; -import { useLayout } from "@/contexts/layout-context"; -import { useTask } from "@/contexts/task-context"; import { type ChunkResult, type File, diff --git a/frontend/src/components/layout-wrapper.tsx b/frontend/src/components/layout-wrapper.tsx index b89ab5d5..dbd04fea 100644 --- a/frontend/src/components/layout-wrapper.tsx +++ b/frontend/src/components/layout-wrapper.tsx @@ -16,7 +16,6 @@ import { UserNav } from "@/components/user-nav"; import { useAuth } from "@/contexts/auth-context"; import { useChat } from "@/contexts/chat-context"; import { useKnowledgeFilter } from "@/contexts/knowledge-filter-context"; -import { LayoutProvider } from "@/contexts/layout-context"; // import { GitHubStarButton } from "@/components/github-star-button" // import { DiscordLink } from "@/components/discord-link" import { useTask } from "@/contexts/task-context"; @@ -34,7 +33,7 @@ export function LayoutWrapper({ children }: { children: React.ReactNode }) { refreshConversations, startNewConversation, } = useChat(); - const { isLoading: isSettingsLoading, data: settings } = useGetSettingsQuery({ + const { isLoading: isSettingsLoading } = useGetSettingsQuery({ enabled: isAuthenticated || isNoAuthMode, }); const { @@ -75,14 +74,6 @@ export function LayoutWrapper({ children }: { children: React.ReactNode }) { const isUnhealthy = health?.status === "unhealthy" || isError; const isBannerVisible = !isHealthLoading && isUnhealthy; - // Dynamic height calculations based on banner visibility - const headerHeight = 53; - const bannerHeight = 52; // Approximate banner height - const totalTopOffset = isBannerVisible - ? headerHeight + bannerHeight - : headerHeight; - const mainContentHeight = `calc(100vh - ${totalTopOffset}px)`; - // Show loading state when backend isn't ready if (isLoading || isSettingsLoading) { return ( @@ -102,9 +93,18 @@ export function LayoutWrapper({ children }: { children: React.ReactNode }) { // For all other pages, render with Langflow-styled navigation and task menu return ( -
- -
+
+
+ +
+
{/* Logo/Title */}
@@ -144,44 +144,37 @@ export function LayoutWrapper({ children }: { children: React.ReactNode }) {
-
- {/* Sidebar Navigation */} - - {/* Main Content */} -
-
- {children} -
-
+ {/* Sidebar Navigation */} + - {/* Task Notifications Panel */} - + {/* Main Content */} +
+
+ {children} +
+
- {/* Knowledge Filter Panel */} - -
+ {/* Task Notifications Panel */} + + + {/* Knowledge Filter Panel */} +
); } diff --git a/frontend/src/contexts/layout-context.tsx b/frontend/src/contexts/layout-context.tsx deleted file mode 100644 index f40ea28c..00000000 --- a/frontend/src/contexts/layout-context.tsx +++ /dev/null @@ -1,34 +0,0 @@ -"use client"; - -import { createContext, useContext } from "react"; - -interface LayoutContextType { - headerHeight: number; - totalTopOffset: number; -} - -const LayoutContext = createContext(undefined); - -export function useLayout() { - const context = useContext(LayoutContext); - if (context === undefined) { - throw new Error("useLayout must be used within a LayoutProvider"); - } - return context; -} - -export function LayoutProvider({ - children, - headerHeight, - totalTopOffset -}: { - children: React.ReactNode; - headerHeight: number; - totalTopOffset: number; -}) { - return ( - - {children} - - ); -} \ No newline at end of file