diff --git a/core/schemas/bifrost.go b/core/schemas/bifrost.go index 86cb870de..7ff75fe8d 100644 --- a/core/schemas/bifrost.go +++ b/core/schemas/bifrost.go @@ -107,6 +107,7 @@ const ( FileRetrieveRequest RequestType = "file_retrieve" FileDeleteRequest RequestType = "file_delete" FileContentRequest RequestType = "file_content" + UnknownRequest RequestType = "unknown" ) // BifrostContextKey is a type for context keys used in Bifrost. diff --git a/ui/app/clientLayout.tsx b/ui/app/clientLayout.tsx index e09fb9036..1f166167c 100644 --- a/ui/app/clientLayout.tsx +++ b/ui/app/clientLayout.tsx @@ -16,52 +16,52 @@ import { useEffect } from "react"; import { toast, Toaster } from "sonner"; function AppContent({ children }: { children: React.ReactNode }) { - const { data: bifrostConfig, error, isLoading } = useGetCoreConfigQuery({}); + const { data: bifrostConfig, error, isLoading } = useGetCoreConfigQuery({}); - useEffect(() => { - if (error) { - toast.error(getErrorMessage(error)); - } - }, [error]); + useEffect(() => { + if (error) { + toast.error(getErrorMessage(error)); + } + }, [error]); - return ( - - - - - - {isLoading ? : {children}} - - - - - ); + return ( + + + + + + {isLoading ? : {children}} + + + + + ); } -function FullPage({config, children}: {config: BifrostConfig|undefined, children: React.ReactNode}) { - const pathname = usePathname(); - if (config && config.is_db_connected) { - return children - } - if (config && config.is_logs_connected && pathname.startsWith("/workspace/logs")) { - return children; - } - return +function FullPage({ config, children }: { config: BifrostConfig | undefined; children: React.ReactNode }) { + const pathname = usePathname(); + if (config && config.is_db_connected) { + return children; + } + if (config && config.is_logs_connected && pathname.startsWith("/workspace/logs")) { + return children; + } + return ; } export function ClientLayout({ children }: { children: React.ReactNode }) { - return ( - - - - - - - {children} - - - - - - ); -} \ No newline at end of file + return ( + + + + + + + {children} + + + + + + ); +} diff --git a/ui/components/sidebar.tsx b/ui/components/sidebar.tsx index 420ee6f0d..d95ee1e26 100644 --- a/ui/components/sidebar.tsx +++ b/ui/components/sidebar.tsx @@ -60,7 +60,8 @@ import moment from "moment"; import { useTheme } from "next-themes"; import Image from "next/image"; import Link from "next/link"; -import { usePathname, useRouter, useSearchParams } from "next/navigation"; +import { usePathname, useRouter } from "next/navigation"; +import { useQueryState } from "nuqs"; import { useEffect, useMemo, useState } from "react"; import { ThemeToggle } from "./themeToggle"; import { Badge } from "./ui/badge"; @@ -160,7 +161,6 @@ const SidebarItemView = ({ onToggle, pathname, router, - searchParams, }: { item: SidebarItem; isActive: boolean; @@ -171,16 +171,15 @@ const SidebarItemView = ({ onToggle?: () => void; pathname: string; router: ReturnType; - searchParams: ReturnType; }) => { const hasSubItems = "subItems" in item && item.subItems && item.subItems.length > 0; - const currentTab = searchParams.get("tab"); + const [currentConfigTab] = useQueryState("tab"); const isAnySubItemActive = hasSubItems && item.subItems?.some((subItem) => { // For query param based subitems, check if tab matches if (subItem.queryParam) { - return pathname === subItem.url && currentTab === subItem.queryParam; + return pathname === subItem.url && currentConfigTab === subItem.queryParam; } // For path based subitems, check if pathname starts with url return pathname.startsWith(subItem.url); @@ -244,7 +243,7 @@ const SidebarItemView = ({ {item.subItems?.map((subItem: SidebarItem) => { // For query param based subitems, check if tab matches const isSubItemActive = subItem.queryParam - ? pathname === subItem.url && currentTab === subItem.queryParam + ? pathname === subItem.url && currentConfigTab === subItem.queryParam : pathname.startsWith(subItem.url); const SubItemIcon = subItem.icon; return ( @@ -316,7 +315,6 @@ const compareVersions = (v1: string, v2: string): number => { export default function AppSidebar() { const pathname = usePathname(); const router = useRouter(); - const searchParams = useSearchParams(); const [mounted, setMounted] = useState(false); const [expandedItems, setExpandedItems] = useState>(new Set()); const [areCardsEmpty, setAreCardsEmpty] = useState(false); @@ -737,7 +735,6 @@ export default function AppSidebar() { onToggle={() => toggleItem(item.title)} pathname={pathname} router={router} - searchParams={searchParams} /> ); })} diff --git a/ui/components/ui/alert.tsx b/ui/components/ui/alert.tsx index a7ae3a9ef..7020d27de 100644 --- a/ui/components/ui/alert.tsx +++ b/ui/components/ui/alert.tsx @@ -9,7 +9,8 @@ const alertVariants = cva( variants: { variant: { default: "bg-card text-card-foreground", - destructive: "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90", + destructive: + "border-red-200/30 bg-red-50/30 text-red-900 dark:border-red-800/30 dark:bg-red-950/30 dark:text-red-100 [&>svg]:text-red-600 dark:[&>svg]:text-red-400 *:data-[slot=alert-description]:text-red-700 dark:*:data-[slot=alert-description]:text-red-300", info: "border-blue-200/30 bg-blue-50/30 text-blue-900 dark:border-blue-800/30 dark:bg-blue-950/30 dark:text-blue-100 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-400 *:data-[slot=alert-description]:text-blue-700 dark:*:data-[slot=alert-description]:text-blue-300", }, }, @@ -40,4 +41,3 @@ function AlertDescription({ className, ...props }: React.ComponentProps<"div">) } export { Alert, AlertDescription, AlertTitle }; -