Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

fix: sidenav, page headers, and dashboard UI consistency (#1313)

Aman Agarwal152edb68d8d5
diff --git a/src/client/next.config.js b/src/client/next.config.js
index 804469c6..a52abc15 100644
--- a/src/client/next.config.js
+++ b/src/client/next.config.js
@@ -7,8 +7,9 @@ const contentSecurityPolicy = [
"form-action 'self'",
"img-src 'self' data: blob: https:",
"font-src 'self' data:",
- "style-src 'self' 'unsafe-inline'",
- "script-src 'self' 'unsafe-inline' 'unsafe-eval'",
+ "style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net",
+ "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdn.jsdelivr.net",
+ "worker-src 'self' blob:",
"connect-src 'self' https: wss:",
].join("; ");
diff --git a/src/client/src/__tests__/components/sidebar.test.tsx b/src/client/src/__tests__/components/sidebar.test.tsx
index 39ea7427..bc449eb2 100644
--- a/src/client/src/__tests__/components/sidebar.test.tsx
+++ b/src/client/src/__tests__/components/sidebar.test.tsx
@@ -1,6 +1,10 @@
import { fireEvent, render, screen } from "@testing-library/react";
import Sidebar from "@/components/(playground)/sidebar";
import { TooltipProvider } from "@/components/ui/tooltip";
+import {
+ SidebarLayoutProvider,
+ useSidebarLayout,
+} from "@/components/(playground)/sidebar-layout-context";
const pushMock = jest.fn();
let pathname = "/home";
@@ -72,14 +76,35 @@ jest.mock("@/components/ui/command", () => ({
CommandItem: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
}));
+function LayoutControls() {
+ const { isExpanded, toggleSidebar } = useSidebarLayout();
+ return (
+ <div>
+ <span data-testid="layout-state">
+ {isExpanded ? "expanded" : "collapsed"}
+ </span>
+ <button type="button" onClick={toggleSidebar}>
+ Toggle sidebar
+ </button>
+ </div>
+ );
+}
+
function renderSidebar() {
return render(
- <TooltipProvider>
- <Sidebar />
- </TooltipProvider>
+ <SidebarLayoutProvider>
+ <TooltipProvider>
+ <LayoutControls />
+ <Sidebar />
+ </TooltipProvider>
+ </SidebarLayoutProvider>
);
}
+function collapse() {
+ fireEvent.click(screen.getByRole("button", { name: "Toggle sidebar" }));
+}
+
describe("Sidebar", () => {
beforeEach(() => {
pushMock.mockClear();
@@ -88,51 +113,54 @@ describe("Sidebar", () => {
window.localStorage.clear();
});
- it("keeps the brand logo rendered and hides brand copy without removing layout space when collapsed", () => {
+ it("shows the Browse/Otter shortcuts when expanded and hides them when collapsed", () => {
renderSidebar();
- expect(screen.getByAltText("OpenLIT logo")).toBeInTheDocument();
- expect(screen.getByText("OpenLIT").parentElement).not.toHaveClass("invisible");
+ expect(screen.getByTestId("layout-state")).toHaveTextContent("expanded");
+ expect(screen.getByRole("button", { name: "Browse" })).toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "Otter" })).toBeInTheDocument();
- fireEvent.click(screen.getByRole("button", { name: "Collapse sidebar" }));
+ collapse();
- expect(screen.getByAltText("OpenLIT logo")).toBeInTheDocument();
- expect(screen.getByText("OpenLIT").parentElement).toHaveClass(
- "invisible",
- "opacity-0",
- "pointer-events-none"
- );
+ expect(screen.getByTestId("layout-state")).toHaveTextContent("collapsed");
+ expect(screen.queryByRole("button", { name: "Browse" })).not.toBeInTheDocument();
+ expect(screen.queryByRole("link", { name: "Otter" })).not.toBeInTheDocument();
+ // Navigation items stay accessible (label kept for screen readers).
expect(screen.getByRole("link", { name: "Home" })).toBeInTheDocument();
});
- it("expands the sidebar when clicking a collapsed action item", () => {
+ it("navigates without expanding when clicking a collapsed action item", () => {
renderSidebar();
- fireEvent.click(screen.getByRole("button", { name: "Collapse sidebar" }));
+ collapse();
+ expect(screen.getByTestId("layout-state")).toHaveTextContent("collapsed");
+
fireEvent.click(screen.getByRole("link", { name: "Home" }));
- expect(screen.getByRole("button", { name: "Collapse sidebar" })).toBeInTheDocument();
- expect(screen.getByText("OpenLIT").parentElement).not.toHaveClass("invisible");
+ // The rail stays collapsed: navigation should not auto-expand the sidebar.
+ expect(screen.getByTestId("layout-state")).toHaveTextContent("collapsed");
});
- it("expands the sidebar and opens a secondary panel when clicking a collapsed section item", () => {
+ it("opens a secondary panel without expanding when clicking a collapsed section item", () => {
renderSidebar();
- fireEvent.click(screen.getByRole("button", { name: "Collapse sidebar" }));
+ collapse();
fireEvent.click(screen.getByRole("button", { name: "R" }));
- expect(screen.getByRole("button", { name: "Collapse sidebar" })).toHaveClass("right-2");
- expect(screen.getAllByText("Resources")).toHaveLength(2);
+ expect(screen.getByTestId("layout-state")).toHaveTextContent("collapsed");
expect(screen.getByRole("link", { name: "Prompt Hub" })).toBeInTheDocument();
+ expect(screen.getAllByText("Resources").length).toBeGreaterThanOrEqual(1);
});
- it("expands before opening command search from the collapsed search button", () => {
+ it("opens command search without expanding from the collapsed search button", () => {
renderSidebar();
- fireEvent.click(screen.getByRole("button", { name: "Collapse sidebar" }));
+ collapse();
fireEvent.click(screen.getByRole("button", { name: "Search navigation" }));
- expect(screen.getByRole("button", { name: "Collapse sidebar" })).toBeInTheDocument();
- expect(screen.getByPlaceholderText("Search OpenLIT navigation...")).toBeInTheDocument();
+ expect(screen.getByTestId("layout-state")).toHaveTextContent("collapsed");
+ expect(
+ screen.getByPlaceholderText("Search OpenLIT navigation...")
+ ).toBeInTheDocument();
});
});
diff --git a/src/client/src/__tests__/selectors/dashboards.test.ts b/src/client/src/__tests__/selectors/dashboards.test.ts
index d3267437..143fefaa 100644
--- a/src/client/src/__tests__/selectors/dashboards.test.ts
+++ b/src/client/src/__tests__/selectors/dashboards.test.ts
@@ -5,31 +5,35 @@ jest.mock('@/store', () => ({
import { useDashboardPageSearch, useSetDashboardPageSearch } from '@/selectors/dashboards';
import { useRootStore } from '@/store';
+const mockStore = {
+ dashboards: {
+ page: { search: '' },
+ setPageSearch: jest.fn(),
+ },
+};
+
describe('useDashboardPageSearch', () => {
+ beforeEach(() => {
+ mockStore.dashboards.page.search = '';
+ (useRootStore as jest.Mock).mockImplementation((selector) => selector(mockStore));
+ });
+
it('returns dashboards.page.search from store', () => {
- const mockSearch = 'my query';
- (useRootStore as jest.Mock).mockReturnValue({
- dashboards: { page: { search: mockSearch }, setPageSearch: jest.fn() },
- });
- const result = useDashboardPageSearch();
- expect(result).toBe(mockSearch);
+ mockStore.dashboards.page.search = 'my query';
+ expect(useDashboardPageSearch()).toBe('my query');
});
it('returns empty string when search is empty', () => {
- (useRootStore as jest.Mock).mockReturnValue({
- dashboards: { page: { search: '' }, setPageSearch: jest.fn() },
- });
expect(useDashboardPageSearch()).toBe('');
});
});
describe('useSetDashboardPageSearch', () => {
+ beforeEach(() => {
+ (useRootStore as jest.Mock).mockImplementation((selector) => selector(mockStore));
+ });
+
it('returns dashboards.setPageSearch from store', () => {
- const mockSetPageSearch = jest.fn();
- (useRootStore as jest.Mock).mockReturnValue({
- dashboards: { page: { search: '' }, setPageSearch: mockSetPageSearch },
- });
- const result = useSetDashboardPageSearch();
- expect(result).toBe(mockSetPageSearch);
+ expect(useSetDashboardPageSearch()).toBe(mockStore.dashboards.setPageSearch);
});
});
diff --git a/src/client/src/__tests__/utils/active-app.test.ts b/src/client/src/__tests__/utils/active-app.test.ts
new file mode 100644
index 00000000..ce196930
--- /dev/null
+++ b/src/client/src/__tests__/utils/active-app.test.ts
@@ -0,0 +1,49 @@
+import { getActiveApp } from '@/utils/active-app';
+
+describe('getActiveApp', () => {
+ it('returns Prompts for prompt hub routes', () => {
+ expect(getActiveApp('/prompt-hub')).toEqual({
+ title: 'Prompts',
+ href: '/prompt-hub',
+ });
+ expect(getActiveApp('/prompt-hub/my-prompt')).toEqual({
+ title: 'Prompts',
+ href: '/prompt-hub',
+ });
+ });
+
+ it('returns sidebar apps for other routes', () => {
+ expect(getActiveApp('/agents')).toEqual({
+ title: 'Agents',
+ href: '/agents',
+ });
+ expect(getActiveApp('/context')).toEqual({
+ title: 'Contexts',
+ href: '/context',
+ });
+ expect(getActiveApp('/home')).toEqual({
+ title: 'Home',
+ href: '/home',
+ });
+ });
+
+ it('maps coding-agents routes to Agents', () => {
+ expect(getActiveApp('/coding-agents/users/[email protected]')).toEqual({
+ title: 'Agents',
+ href: '/agents',
+ });
+ });
+
+ it('maps dashboard uuid routes to Dashboards', () => {
+ expect(
+ getActiveApp('/d/12345678-1234-1234-1234-123456789012')
+ ).toEqual({
+ title: 'Dashboards',
+ href: '/dashboards',
+ });
+ });
+
+ it('returns null for onboarding', () => {
+ expect(getActiveApp('/onboarding')).toBeNull();
+ });
+});
diff --git a/src/client/src/__tests__/utils/breadcrumbs.test.ts b/src/client/src/__tests__/utils/breadcrumbs.test.ts
index 217fab3e..42348fab 100644
--- a/src/client/src/__tests__/utils/breadcrumbs.test.ts
+++ b/src/client/src/__tests__/utils/breadcrumbs.test.ts
@@ -60,14 +60,12 @@ describe('generatePageHeader', () => {
expect(header.breadcrumbs).toEqual([]);
});
- it('generates header with breadcrumbs for individual dashboard view', () => {
+ it('generates header with empty title for individual dashboard view', () => {
const header = generatePageHeader(
'/d/123e4567-e89b-12d3-a456-426614174000'
);
- expect(header.title).toBe('Dashboard');
- expect(header.breadcrumbs).toEqual([
- { title: 'Dashboards', href: '/dashboards' },
- ]);
+ expect(header.title).toBe('');
+ expect(header.breadcrumbs).toEqual([]);
});
it('generates correct header for /requests', () => {
@@ -84,16 +82,14 @@ describe('generatePageHeader', () => {
it('generates correct header for /prompt-hub', () => {
const header = generatePageHeader('/prompt-hub');
- expect(header.title).toBe('Prompt Hub');
+ expect(header.title).toBe('Prompts');
expect(header.breadcrumbs).toEqual([]);
});
- it('generates breadcrumbs for /prompt-hub/:id', () => {
+ it('generates empty title for /prompt-hub/:id until data loads', () => {
const header = generatePageHeader('/prompt-hub/abc-123');
- expect(header.title).toBe('Prompt Details');
- expect(header.breadcrumbs).toEqual([
- { title: 'Prompt Hub', href: '/prompt-hub' },
- ]);
+ expect(header.title).toBe('');
+ expect(header.breadcrumbs).toEqual([]);
});
it('generates correct header for /vault', () => {
@@ -102,29 +98,22 @@ describe('generatePageHeader', () => {
expect(header.breadcrumbs).toEqual([]);
});
- it('generates breadcrumbs for /vault/:id', () => {
+ it('generates empty title for /vault/:id until data loads', () => {
const header = generatePageHeader('/vault/my-secret');
- expect(header.title).toBe('Vault Item');
- expect(header.breadcrumbs).toEqual([
- { title: 'Vault', href: '/vault' },
- ]);
+ expect(header.title).toBe('');
+ expect(header.breadcrumbs).toEqual([]);
});
it('generates correct header for /settings/profile', () => {
const header = generatePageHeader('/settings/profile');
expect(header.title).toBe('User Profile');
- expect(header.breadcrumbs).toEqual([
- { title: 'Settings', href: '/settings' },
- ]);
+ expect(header.breadcrumbs).toEqual([]);
});
- it('generates correct header for /settings/api-keys', () => {
+ it('generates a title for /settings/api-keys matching the sidebar label exactly', () => {
const header = generatePageHeader('/settings/api-keys');
- expect(header.title).toBe('API Keys');
- expect(header.breadcrumbs).toContainEqual({
- title: 'Settings',
- href: '/settings',
- });
+ expect(header.title).toBe('Api Keys');
+ expect(header.breadcrumbs).toEqual([]);
});
it('generates breadcrumbs for /dashboards/board', () => {
@@ -188,10 +177,16 @@ describe('generatePageHeader', () => {
expect(header.breadcrumbs).toContainEqual({ title: 'Settings', href: '/settings' });
});
- it('generates breadcrumbs for /fleet-hub/:id', () => {
- const header = generatePageHeader('/fleet-hub/agent-1');
+ it('generates a title for /fleet-hub matching the sidebar label exactly', () => {
+ const header = generatePageHeader('/fleet-hub');
expect(header.title).toBe('Fleet Hub');
- expect(header.breadcrumbs).toContainEqual({ title: 'Fleet Hub', href: '/fleet-hub' });
+ expect(header.breadcrumbs).toEqual([]);
+ });
+
+ it('generates empty title for /fleet-hub/:id until data loads', () => {
+ const header = generatePageHeader('/fleet-hub/agent-1');
+ expect(header.title).toBe('');
+ expect(header.breadcrumbs).toEqual([]);
});
it('falls back gracefully for unknown routes', () => {
@@ -211,11 +206,9 @@ describe('generatePageHeader', () => {
expect(header.breadcrumbs).toEqual([]);
});
- it('generates breadcrumbs for /prompt-hub/:id without params (no id extracted)', () => {
- // Covers the "Prompt" branch in prompt-hub title when params.id is absent
- // This is reached when title fn is called with no params
+ it('generates empty title for /prompt-hub/:id without params', () => {
const header = generatePageHeader('/prompt-hub/abc');
- expect(typeof header.title).toBe('string');
+ expect(header.title).toBe('');
});
});
diff --git a/src/client/src/app/(playground)/agents/page.tsx b/src/client/src/app/(playground)/agents/page.tsx
index e37ee80a..3b8a5967 100644
--- a/src/client/src/app/(playground)/agents/page.tsx
+++ b/src/client/src/app/(playground)/agents/page.tsx
@@ -2,7 +2,7 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { usePathname, useSearchParams, useRouter } from "next/navigation";
-import { RefreshCw, Plus } from "lucide-react";
+import { Bot, RefreshCw, Plus } from "lucide-react";
import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
import { getFilterDetails, getUpdateFilter } from "@/selectors/filter";
import { useRootStore } from "@/store";
@@ -31,6 +31,7 @@ import {
} from "@/components/ui/dialog";
import ComboDropdown from "@/components/(playground)/filter/combo-dropdown";
import Filter from "@/components/(playground)/filter";
+import FeaturePageHeader from "@/components/(playground)/feature-page-header";
import getMessage from "@/constants/messages";
import NoController from "./no-controller";
import NoCodingAgents from "./no-coding-agents";
@@ -601,7 +602,61 @@ export default function AgentsPage() {
}, []);
return (
- <div className="flex flex-col w-full gap-4 p-1 overflow-y-auto">
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <FeaturePageHeader
+ eyebrow="Monitoring"
+ title={getMessage().FEATURE_AGENTS}
+ icon={<Bot className="h-4 w-4" />}
+ tone="border-teal-200 bg-teal-50 text-teal-700 dark:border-teal-900/70 dark:bg-teal-950/40 dark:text-teal-300"
+ actions={(
+ <div className="flex min-w-0 flex-wrap items-center justify-end gap-2">
+ <div className="flex flex-wrap items-center gap-2">
+ {(
+ [
+ { id: "services", label: getMessage().AGENTS_TAB_SERVICES },
+ { id: "coding", label: getMessage().AGENTS_TAB_CODING },
+ { id: "controllers", label: getMessage().AGENTS_TAB_CONTROLLERS },
+ ] as const
+ ).map((tab) => (
+ <button
+ key={tab.id}
+ onClick={() => setActiveTab(tab.id)}
+ className={`inline-flex items-center gap-2 rounded-md border px-2.5 py-1.5 text-xs transition ${
+ activeTab === tab.id
+ ? "border-teal-200 bg-teal-50 text-teal-700 dark:border-teal-900/70 dark:bg-teal-950/40 dark:text-teal-300"
+ : "border-stone-200 bg-stone-50 text-stone-600 hover:bg-stone-100 dark:border-stone-800 dark:bg-stone-900 dark:text-stone-300 dark:hover:bg-stone-800"
+ }`}
+ >
+ <span className="font-medium">{tab.label}</span>
+ </button>
+ ))}
+ </div>
+ {activeTab === "controllers" && (
+ <Button
+ variant="outline"
+ size="sm"
+ className="h-8"
+ onClick={() => setSetupModal("controller")}
+ >
+ <Plus className="w-3 h-3 mr-1.5" />
+ {getMessage().AGENTS_ADD_CONTROLLER}
+ </Button>
+ )}
+ {activeTab === "coding" && (
+ <Button
+ variant="outline"
+ size="sm"
+ className="h-8"
+ onClick={() => setSetupModal("coding")}
+ >
+ <Plus className="w-3 h-3 mr-1.5" />
+ {getMessage().AGENTS_ADD_CODING_AGENT}
+ </Button>
+ )}
+ </div>
+ )}
+ />
+ <section className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4">
{/* Toolbar */}
<div className="flex items-center w-full gap-4">
<Filter />
@@ -804,61 +859,6 @@ export default function AgentsPage() {
</div>
)}
- {/* Tab switcher. Ordering reflects expected
- usage frequency: most teams will spend most
- of their time on Applications and Coding
- Agents; Controllers is a setup-time tab. We
- drop the count badge from Coding Agents
- intentionally — the tab name carries the
- affordance and the row count is already on
- the table itself; the badge was creating
- visual noise on the most-clicked tab. */}
- <div className="flex items-center border-b border-stone-200 dark:border-stone-700">
- {(
- [
- { id: "services", label: getMessage().AGENTS_TAB_SERVICES },
- { id: "coding", label: getMessage().AGENTS_TAB_CODING },
- { id: "controllers", label: getMessage().AGENTS_TAB_CONTROLLERS },
- ] as const
- ).map((tab) => (
- <button
- key={tab.id}
- onClick={() => {
- setActiveTab(tab.id);
- }}
- className={`px-4 py-2.5 text-sm font-medium transition-colors border-b-2 inline-flex items-center gap-1.5 ${
- activeTab === tab.id
- ? "border-stone-900 dark:border-stone-100 text-stone-900 dark:text-stone-100"
- : "border-transparent text-stone-500 dark:text-stone-400 hover:text-stone-700 dark:hover:text-stone-300"
- }`}
- >
- {tab.label}
- </button>
- ))}
- {activeTab === "controllers" && (
- <Button
- variant="outline"
- size="default"
- className="ml-auto text-xs h-auto py-1.5 px-3"
- onClick={() => setSetupModal("controller")}
- >
- <Plus className="w-3 h-3 mr-1.5" />
- {getMessage().AGENTS_ADD_CONTROLLER}
- </Button>
- )}
- {activeTab === "coding" && (
- <Button
- variant="outline"
- size="default"
- className="ml-auto text-xs h-auto py-1.5 px-3"
- onClick={() => setSetupModal("coding")}
- >
- <Plus className="w-3 h-3 mr-1.5" />
- {getMessage().AGENTS_ADD_CODING_AGENT}
- </Button>
- )}
- </div>
-
{/* Content. Each tab owns its own empty state so
the install instructions match the tab — a
user landing on Coding Agents shouldn't see
@@ -932,6 +932,7 @@ export default function AgentsPage() {
)}
</>
)}
+ </section>
<Dialog
open={setupModal !== null}
diff --git a/src/client/src/app/(playground)/coding-agents/users/[userId]/page.tsx b/src/client/src/app/(playground)/coding-agents/users/[userId]/page.tsx
index 5dc8eb89..d9ae2a51 100644
--- a/src/client/src/app/(playground)/coding-agents/users/[userId]/page.tsx
+++ b/src/client/src/app/(playground)/coding-agents/users/[userId]/page.tsx
@@ -284,7 +284,7 @@ export default function CodingAgentUserPage() {
if (!digest) return null;
return (
- <div className="flex flex-col w-full h-full gap-5 overflow-y-auto p-1 pb-8">
+ <div className="flex flex-col w-full h-full gap-5 overflow-y-auto p-4 pb-8">
<div className="space-y-2">
{/* Back button + email styled to match the trace
full-view header (see trace-detail-page.tsx).
diff --git a/src/client/src/app/(playground)/context/[id]/page.tsx b/src/client/src/app/(playground)/context/[id]/page.tsx
index 8bdab0c3..49264e02 100644
--- a/src/client/src/app/(playground)/context/[id]/page.tsx
+++ b/src/client/src/app/(playground)/context/[id]/page.tsx
@@ -34,6 +34,7 @@ import { usePageHeader } from "@/selectors/page";
import RuleForm from "@/components/(playground)/rule-engine/form";
import Link from "next/link";
import getMessage from "@/constants/messages";
+import ContextHeader from "@/components/(playground)/context/header";
function parseTags(raw: any): string[] {
if (Array.isArray(raw)) return raw.map(String);
@@ -110,7 +111,7 @@ export default function ContextDetailPage() {
loadContextIntoState(ctx);
setHeader({
title: ctx.name,
- breadcrumbs: [{ title: m.CONTEXT_TITLE, href: "/context" }],
+ breadcrumbs: [],
});
}
},
@@ -224,12 +225,17 @@ export default function ContextDetailPage() {
const linkedRules = ((allRules as any[]) || []).filter((r: any) => linkedRuleIds.has(r.id));
const unlinkdRules = ((allRules as any[]) || []).filter((r: any) => !linkedRuleIds.has(r.id));
+ const contextHeaderTone = "border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/70 dark:bg-blue-950/40 dark:text-blue-300";
+
if (isLoading && !context) {
return (
- <div className="flex flex-col w-full h-full overflow-hidden gap-4 items-center justify-center">
- <div className="h-4 w-1/5 bg-stone-200 dark:bg-stone-700 rounded animate-pulse" />
- <div className="h-4 w-3/5 bg-stone-200 dark:bg-stone-700 rounded animate-pulse" />
- <div className="h-4 w-2/3 bg-stone-200 dark:bg-stone-700 rounded animate-pulse" />
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <ContextHeader title={m.LOADING} />
+ <div className="flex flex-col w-full h-full overflow-hidden gap-4 items-center justify-center">
+ <div className="h-4 w-1/5 bg-stone-200 dark:bg-stone-700 rounded animate-pulse" />
+ <div className="h-4 w-3/5 bg-stone-200 dark:bg-stone-700 rounded animate-pulse" />
+ <div className="h-4 w-2/3 bg-stone-200 dark:bg-stone-700 rounded animate-pulse" />
+ </div>
</div>
);
}
@@ -241,7 +247,9 @@ export default function ContextDetailPage() {
const displayMeta = parseMeta(ctx.meta_properties);
return (
- <div className="grid grid-cols-3 w-full h-full overflow-hidden gap-4">
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <ContextHeader title={ctx.name} />
+ <div className="grid grid-cols-3 w-full h-full overflow-hidden gap-4 p-4">
{/* Left: Context info + content */}
<Card className="col-span-2 overflow-hidden flex flex-col border border-stone-200 dark:border-stone-800">
<CardHeader className="p-4 pb-3 border-b border-stone-100 dark:border-stone-800 flex-shrink-0">
@@ -652,5 +660,6 @@ export default function ContextDetailPage() {
</CardContent>
</Card>
</div>
+ </div>
);
}
diff --git a/src/client/src/app/(playground)/context/new/page.tsx b/src/client/src/app/(playground)/context/new/page.tsx
index bb120059..7c544e73 100644
--- a/src/client/src/app/(playground)/context/new/page.tsx
+++ b/src/client/src/app/(playground)/context/new/page.tsx
@@ -18,12 +18,12 @@ import { Textarea } from "@/components/ui/textarea";
import { usePageHeader } from "@/selectors/page";
import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
import { ArrowLeftIcon, PlusIcon, XIcon } from "lucide-react";
-import Link from "next/link";
import { useRouter } from "next/navigation";
import { KeyboardEvent, useCallback, useEffect, useState } from "react";
import ReactMarkdown from "react-markdown";
import { toast } from "sonner";
import getMessage from "@/constants/messages";
+import ContextHeader from "@/components/(playground)/context/header";
export default function NewContextPage() {
const posthog = usePostHog();
@@ -111,27 +111,25 @@ export default function NewContextPage() {
}, [name, content, description, status, tags, metaProps]);
return (
- <div className="flex flex-col w-full h-full gap-4 overflow-hidden">
- {/* Topbar */}
- <div className="flex items-center justify-between flex-shrink-0">
- <Link
- href="/context"
- className="flex items-center gap-1.5 text-sm text-stone-500 dark:text-stone-400 hover:text-stone-800 dark:hover:text-stone-200 transition-colors"
- >
- <ArrowLeftIcon className="w-4 h-4" />
- {m.CONTEXT_BACK_TO_LIST}
- </Link>
- <Button
- onClick={handleSubmit}
- disabled={isLoading}
- className={isLoading ? "animate-pulse" : ""}
- >
- {m.CONTEXT_SAVE}
- </Button>
- </div>
+ <div className="flex flex-col w-full h-full overflow-hidden">
+ <ContextHeader createNew={false} extraButtons={(
+ <>
+ <Button variant="outline" size="sm" className="h-8" onClick={() => router.back()}>
+ <ArrowLeftIcon className="mr-1.5 size-3.5" />
+ {getMessage().BACK}
+ </Button>
+ <Button
+ onClick={handleSubmit}
+ disabled={isLoading}
+ className={`${isLoading ? "animate-pulse" : ""} h-8`}
+ >
+ {m.CONTEXT_SAVE}
+ </Button>
+ </>
+ )} />
{/* Body */}
- <div className="grid grid-cols-3 gap-4 flex-1 overflow-hidden">
+ <div className="grid grid-cols-3 gap-4 flex-1 overflow-hidden p-4">
{/* Left: name + description + markdown editor */}
<Card className="col-span-2 flex flex-col overflow-hidden border border-stone-200 dark:border-stone-800">
<CardContent className="flex flex-col gap-4 p-4 flex-1 overflow-hidden">
diff --git a/src/client/src/app/(playground)/context/page.tsx b/src/client/src/app/(playground)/context/page.tsx
index 5623ec0d..a21a4582 100644
--- a/src/client/src/app/(playground)/context/page.tsx
+++ b/src/client/src/app/(playground)/context/page.tsx
@@ -131,27 +131,29 @@ export default function ContextPage() {
}, [pingStatus]);
return (
- <div className="flex flex-col w-full h-full gap-4">
- <ContextHeader successCallback={fetchData} />
- <DataTable
- columns={columns}
- data={data || []}
- isFetched={isFetched || pingStatus === "failure"}
- isLoading={isLoading || isDeleting}
- visibilityColumns={{
- name: true,
- description: true,
- status: true,
- createdBy: true,
- createdAt: true,
- actions: true,
- }}
- onClick={(row: Context) => router.push(`/context/${row.id}`)}
- extraFunctions={{
- handleDelete: deleteContext,
- successCallback: fetchData,
- }}
- />
+ <div className="flex flex-col w-full h-full">
+ <ContextHeader />
+ <div className="flex flex-col w-full h-full p-4">
+ <DataTable
+ columns={columns}
+ data={data || []}
+ isFetched={isFetched || pingStatus === "failure"}
+ isLoading={isLoading || isDeleting}
+ visibilityColumns={{
+ name: true,
+ description: true,
+ status: true,
+ createdBy: true,
+ createdAt: true,
+ actions: true,
+ }}
+ onClick={(row: Context) => router.push(`/context/${row.id}`)}
+ extraFunctions={{
+ handleDelete: deleteContext,
+ successCallback: fetchData,
+ }}
+ />
+ </div>
</div>
);
}
diff --git a/src/client/src/app/(playground)/d/[id]/page.tsx b/src/client/src/app/(playground)/d/[id]/page.tsx
index f157e361..48d54aa1 100644
--- a/src/client/src/app/(playground)/d/[id]/page.tsx
+++ b/src/client/src/app/(playground)/d/[id]/page.tsx
@@ -153,7 +153,7 @@ export default function DashboardPage() {
};
return (
- <div className="flex flex-col w-full justify-between h-full">
+ <div className="flex flex-col w-full h-full">
{
!isLoading && (error as Error) && (
<div className="flex flex-col items-center w-full justify-center h-full">
@@ -175,7 +175,7 @@ export default function DashboardPage() {
}
{!isLoading && initialConfig && (
<Dashboard
- className="h-100 overflow-y-auto"
+ className="h-100 overflow-y-auto px-4"
initialConfig={initialConfig}
runQuery={runQuery}
onSave={handleSave}
diff --git a/src/client/src/app/(playground)/dashboards/layout.tsx b/src/client/src/app/(playground)/dashboards/layout.tsx
index 964da988..14d8521c 100644
--- a/src/client/src/app/(playground)/dashboards/layout.tsx
+++ b/src/client/src/app/(playground)/dashboards/layout.tsx
@@ -1,54 +1,99 @@
"use client";
-import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
+
import Link from "next/link";
-import { usePathname } from "next/navigation";
-import { FolderIcon, LayoutDashboardIcon, ComponentIcon } from "lucide-react";
+import { usePathname, useRouter } from "next/navigation";
import { useSetDashboardPageSearch } from "@/selectors/dashboards";
+import Search from "@/components/(playground)/manage-dashboard/common/search";
+import {
+ DashboardHeaderActionsProvider,
+ useDashboardHeaderActions,
+} from "@/components/(playground)/manage-dashboard/dashboard-header-actions-context";
+import {
+ DASHBOARD_VIEWS,
+ getActiveDashboardView,
+} from "@/components/(playground)/manage-dashboard/dashboard-views";
+import RootActions from "@/components/(playground)/manage-dashboard/explorer/root-actions";
+import { cn } from "@/lib/utils";
+import FeaturePageHeader from "@/components/(playground)/feature-page-header";
-export default function LayoutManageDashboard({
- children,
-}: {
- children: React.ReactNode;
-}) {
+function DashboardLayoutFrame({ children }: { children: React.ReactNode }) {
const pathname = usePathname();
+ const router = useRouter();
const setPageSearch = useSetDashboardPageSearch();
- const resetSearch = () => {
- setPageSearch("");
+ const { actions } = useDashboardHeaderActions();
+ const activeView = getActiveDashboardView(pathname);
+ const ActiveIcon = activeView.icon;
+
+ const resetSearch = () => setPageSearch("");
+
+ const openCreate = () => {
+ if (actions?.onCreate) {
+ actions.onCreate();
+ return;
+ }
+ router.push("/dashboards/explorer");
+ };
+
+ if (pathname.includes("/dashboards/board/")) {
+ return <>{children}</>;
}
return (
- <div className="flex flex-col w-full h-full gap-4">
- {!pathname.includes("/dashboards/board/") && (
- <div className="flex">
- <Tabs defaultValue={pathname.split("/")[2] || "explorer"} className="">
- <TabsList className="p-0 h-[30px] px-[1px]">
- <TabsTrigger value="explorer" className="p-0 w-[100px] text-xs rounded-md">
- <Link
- className="py-1.5 w-full flex items-center justify-center gap-2 px-2"
- href="/dashboards/explorer"
- onClick={resetSearch}
- >
- <FolderIcon className="h-3 w-3" />
- Explorer
- </Link>
- </TabsTrigger>
- <TabsTrigger value="board" className="p-0 w-[100px] text-xs rounded-md">
- <Link className="py-1.5 w-full flex items-center justify-center gap-2 px-2" href="/dashboards/dashboard" onClick={resetSearch}>
- <LayoutDashboardIcon className="h-3 w-3" />
- Dashboard
- </Link>
- </TabsTrigger>
- <TabsTrigger value="widget" className="p-0 w-[100px] text-xs rounded-md">
- <Link className="py-1.5 w-full flex items-center justify-center gap-2 px-2" href="/dashboards/widget" onClick={resetSearch}>
- <ComponentIcon className="h-3 w-3" />
- Widget
- </Link>
- </TabsTrigger>
- </TabsList>
- </Tabs>
- </div>
- )}
- {children}
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <FeaturePageHeader
+ eyebrow="Dashboards"
+ title={activeView.label}
+ icon={<ActiveIcon className="h-4 w-4" />}
+ tone={activeView.tone}
+ actions={(
+ <div className="flex min-w-0 flex-wrap items-center justify-end gap-2">
+ <div className="flex flex-wrap items-center gap-2">
+ {DASHBOARD_VIEWS.map((view) => {
+ const Icon = view.icon;
+ const isActive = view.key === activeView.key;
+ return (
+ <Link
+ key={view.key}
+ href={view.href}
+ onClick={resetSearch}
+ className={cn(
+ "inline-flex items-center gap-2 rounded-md border px-2.5 py-1.5 text-xs transition",
+ isActive
+ ? view.tone
+ : "border-stone-200 bg-stone-50 text-stone-600 hover:bg-stone-100 dark:border-stone-800 dark:bg-stone-900 dark:text-stone-300 dark:hover:bg-stone-800"
+ )}
+ >
+ <Icon className="size-4" />
+ <span className="font-medium">{view.label}</span>
+ </Link>
+ );
+ })}
+ </div>
+ <div className="flex shrink-0 items-center gap-2">
+ <Search />
+ <RootActions
+ openAddDialog={openCreate}
+ importBoardLayout={actions?.onImport}
+ />
+ </div>
+ </div>
+ )}
+ />
+ <section className="min-h-0 flex-1 overflow-auto p-4">
+ {children}
+ </section>
</div>
);
}
+
+export default function LayoutManageDashboard({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <DashboardHeaderActionsProvider>
+ <DashboardLayoutFrame>{children}</DashboardLayoutFrame>
+ </DashboardHeaderActionsProvider>
+ );
+}
diff --git a/src/client/src/app/(playground)/evaluations/settings/page.tsx b/src/client/src/app/(playground)/evaluations/settings/page.tsx
index 68b790c7..c4ce96b4 100644
--- a/src/client/src/app/(playground)/evaluations/settings/page.tsx
+++ b/src/client/src/app/(playground)/evaluations/settings/page.tsx
@@ -163,33 +163,40 @@ export default function EvaluationSettingsPage() {
});
};
+ const header = (
+ <FeaturePageHeader
+ eyebrow="Configuration"
+ title={getMessage().EVALUATION_ENGINE_TITLE}
+ icon={<Settings2 className="h-4 w-4" />}
+ tone="border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-900/70 dark:bg-orange-950/40 dark:text-orange-300"
+ actions={
+ <Button asChild variant="outline" size="sm" className="h-8">
+ <Link href="/evaluations/types">
+ <Layers className="mr-1.5 h-3.5 w-3.5" />
+ Evaluation Types
+ </Link>
+ </Button>
+ }
+ />
+ );
+
if (isLoadingConfig && !config) {
return (
- <div className="flex flex-1 h-full w-full p-6">
- <div className="animate-pulse grid gap-4 w-full max-w-3xl">
- <div className="h-40 bg-stone-100 dark:bg-stone-900 rounded-xl" />
+ <div className="flex flex-col h-full w-full overflow-hidden">
+ {header}
+ <div className="flex flex-1 w-full p-4">
+ <div className="animate-pulse grid gap-4 w-full max-w-3xl">
+ <div className="h-40 bg-stone-100 dark:bg-stone-900" />
+ </div>
</div>
</div>
);
}
return (
- <div className="flex flex-col flex-1 h-full w-full overflow-auto gap-4">
- <FeaturePageHeader
- eyebrow="Configuration"
- title={getMessage().EVALUATION_ENGINE_TITLE}
- description="Continuously grade AI outputs with automated and manual checks that turn quality signals into action."
- icon={<Settings2 className="h-4 w-4" />}
- tone="border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-900/70 dark:bg-orange-950/40 dark:text-orange-300"
- actions={
- <Button asChild variant="outline" size="sm" className="h-8">
- <Link href="/evaluations/types">
- <Layers className="mr-1.5 h-3.5 w-3.5" />
- Evaluation Types
- </Link>
- </Button>
- }
- />
+ <div className="flex flex-col h-full w-full overflow-hidden">
+ {header}
+ <div className="flex flex-col flex-1 w-full overflow-auto gap-4 p-4">
<Card className="border-blue-200 dark:border-blue-900/50 bg-blue-50/50 dark:bg-blue-950/20">
<CardContent className="pt-6">
<div className="flex gap-3">
@@ -397,13 +404,14 @@ export default function EvaluationSettingsPage() {
<li>{getMessage().EVALUATION_MANUAL_STEP_2}</li>
<li>{getMessage().EVALUATION_MANUAL_STEP_3}</li>
</ol>
- <Link href="/requests">
- <Button variant="default">{getMessage().EVALUATION_GO_TO_REQUESTS}</Button>
+ <Link href="/telemetry">
+ <Button variant="default">{getMessage().EVALUATION_GO_TO_TRACES}</Button>
</Link>
</CardContent>
</Card>
</div>
</div>
</div>
+ </div>
);
}
diff --git a/src/client/src/app/(playground)/evaluations/types/[id]/page.tsx b/src/client/src/app/(playground)/evaluations/types/[id]/page.tsx
index bf074c2f..0e077ade 100644
--- a/src/client/src/app/(playground)/evaluations/types/[id]/page.tsx
+++ b/src/client/src/app/(playground)/evaluations/types/[id]/page.tsx
@@ -194,41 +194,47 @@ export default function EvaluationTypeDetailPage() {
const displayLabel = et?.label || config?.label || typeId;
const displayDescription = et?.description || config?.description || "";
+ const header = (
+ <FeaturePageHeader
+ eyebrow="Configuration"
+ title={displayLabel}
+ icon={<Layers className="h-4 w-4" />}
+ tone="border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-900/70 dark:bg-orange-950/40 dark:text-orange-300"
+ actions={
+ <div className="flex flex-wrap items-center gap-2">
+ {isCustom && (
+ <Badge variant="outline" className="h-8 gap-1 border-primary/30 text-primary">
+ <Sparkles className="size-3" />
+ Custom
+ </Badge>
+ )}
+ <Button asChild variant="outline" size="sm" className="h-8">
+ <Link href="/evaluations/types">
+ <ArrowLeft className="mr-1.5 h-3.5 w-3.5" />
+ Evaluation Types
+ </Link>
+ </Button>
+ </div>
+ }
+ />
+ );
+
if (!et && !config) {
return (
- <div className="flex flex-1 h-full w-full p-6 items-center justify-center">
- <p className="text-stone-500">Loading...</p>
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ {header}
+ <div className="flex flex-1 w-full items-center justify-center p-4">
+ <p className="text-stone-500">Loading...</p>
+ </div>
</div>
);
}
return (
- <div className="flex flex-col flex-1 h-full w-full overflow-auto gap-4">
- <FeaturePageHeader
- eyebrow="Configuration"
- title={displayLabel}
- description={displayDescription}
- icon={<Layers className="h-4 w-4" />}
- tone="border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-900/70 dark:bg-orange-950/40 dark:text-orange-300"
- actions={
- <div className="flex flex-wrap items-center gap-2">
- {isCustom && (
- <Badge variant="outline" className="h-8 gap-1 border-primary/30 text-primary">
- <Sparkles className="size-3" />
- Custom
- </Badge>
- )}
- <Button asChild variant="outline" size="sm" className="h-8">
- <Link href="/evaluations/types">
- <ArrowLeft className="mr-1.5 h-3.5 w-3.5" />
- Evaluation Types
- </Link>
- </Button>
- </div>
- }
- />
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ {header}
- <div className="grid grid-cols-3 gap-4">
+ <div className="grid flex-1 grid-cols-3 gap-4 overflow-auto p-4">
<div className="grid col-span-2 gap-4">
<Card className="border-stone-200 dark:border-stone-800 shadow-sm">
<CardHeader className="pb-4">
@@ -371,7 +377,7 @@ export default function EvaluationTypeDetailPage() {
</div>
<div className="flex flex-col gap-4">
<Button onClick={handleSave} disabled={isSaving} className="w-full sm:w-auto bg-primary dark:bg-primary text-white dark:text-white hover:bg-primary/90 dark:hover:bg-primary/90">
- {isSaving ? "Saving..." : "Save Changes"}
+ {isSaving ? "Saving..." : "Save Changes"}
</Button>
{isCustom && (
<Button
diff --git a/src/client/src/app/(playground)/evaluations/types/new/page.tsx b/src/client/src/app/(playground)/evaluations/types/new/page.tsx
index 4555d206..406ca74c 100644
--- a/src/client/src/app/(playground)/evaluations/types/new/page.tsx
+++ b/src/client/src/app/(playground)/evaluations/types/new/page.tsx
@@ -96,11 +96,10 @@ export default function CreateCustomEvaluationTypePage() {
};
return (
- <div className="flex flex-col flex-1 h-full w-full overflow-auto gap-4">
+ <div className="flex h-full w-full flex-col overflow-hidden">
<FeaturePageHeader
eyebrow="Configuration"
title="Create Custom Evaluation Type"
- description="Define a domain-specific judge that scores traces against the behavior, policy, and quality criteria your product needs."
icon={<Sparkles className="h-4 w-4" />}
tone="border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-900/70 dark:bg-orange-950/40 dark:text-orange-300"
actions={
@@ -113,7 +112,7 @@ export default function CreateCustomEvaluationTypePage() {
}
/>
- <div className="grid grid-cols-3 gap-4">
+ <div className="grid flex-1 grid-cols-3 gap-4 overflow-auto p-4">
<div className="col-span-2 space-y-4">
{/* Type ID & Label */}
<Card className="border-stone-200 dark:border-stone-800 shadow-sm">
diff --git a/src/client/src/app/(playground)/evaluations/types/page.tsx b/src/client/src/app/(playground)/evaluations/types/page.tsx
index e894ef76..293a5747 100644
--- a/src/client/src/app/(playground)/evaluations/types/page.tsx
+++ b/src/client/src/app/(playground)/evaluations/types/page.tsx
@@ -154,51 +154,52 @@ export default function EvaluationTypesPage() {
};
return (
- <div className="flex flex-1 h-full w-full overflow-auto">
- <div className="w-full space-y-4">
- <FeaturePageHeader
- eyebrow="Configuration"
- title="Evaluation Types"
- description="Shape what quality means for your AI system with built-in checks, custom judges, and rule-driven context."
- icon={<Layers className="h-4 w-4" />}
- tone="border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-900/70 dark:bg-orange-950/40 dark:text-orange-300"
- actions={
- <div className="flex flex-wrap items-center gap-2">
- <Button asChild variant="outline" size="sm" className="h-8">
- <Link href="/evaluations/settings">
- <Settings2 className="mr-1.5 h-3.5 w-3.5" />
- Settings
- </Link>
- </Button>
- <Button asChild size="sm" className="h-8">
- <Link href="/evaluations/types/new">
- <Plus className="mr-1.5 h-3.5 w-3.5" />
- Create Custom Type
- </Link>
- </Button>
- </div>
- }
- />
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <FeaturePageHeader
+ eyebrow="Configuration"
+ title="Evaluation Types"
+ icon={<Layers className="h-4 w-4" />}
+ tone="border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-900/70 dark:bg-orange-950/40 dark:text-orange-300"
+ actions={
+ <div className="flex flex-wrap items-center gap-2">
+ <Button asChild variant="outline" size="sm" className="h-8">
+ <Link href="/evaluations/settings">
+ <Settings2 className="mr-1.5 h-3.5 w-3.5" />
+ Settings
+ </Link>
+ </Button>
+ <Button asChild size="sm" className="h-8">
+ <Link href="/evaluations/types/new">
+ <Plus className="mr-1.5 h-3.5 w-3.5" />
+ Create Custom Type
+ </Link>
+ </Button>
+ </div>
+ }
+ />
- {/* Built-in types */}
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
- {displayBuiltIn.map((et) => renderTypeCard(et, false))}
- </div>
+ <div className="flex-1 w-full overflow-auto p-4">
+ <div className="w-full space-y-4">
+ {/* Built-in types */}
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
+ {displayBuiltIn.map((et) => renderTypeCard(et, false))}
+ </div>
- {/* Custom types */}
- {customTypes.length > 0 && (
- <>
- <div className="flex items-center gap-2 pt-2">
- <Sparkles className="size-4 text-primary" />
- <h3 className="text-sm font-semibold text-stone-700 dark:text-stone-300">
- Custom Evaluation Types
- </h3>
- </div>
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
- {customTypes.map((ct) => renderTypeCard(ct, true))}
- </div>
- </>
- )}
+ {/* Custom types */}
+ {customTypes.length > 0 && (
+ <>
+ <div className="flex items-center gap-2 pt-2">
+ <Sparkles className="size-4 text-primary" />
+ <h3 className="text-sm font-semibold text-stone-700 dark:text-stone-300">
+ Custom Evaluation Types
+ </h3>
+ </div>
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
+ {customTypes.map((ct) => renderTypeCard(ct, true))}
+ </div>
+ </>
+ )}
+ </div>
</div>
</div>
);
diff --git a/src/client/src/app/(playground)/fleet-hub/[id]/agent.tsx b/src/client/src/app/(playground)/fleet-hub/[id]/agent.tsx
index f3d34071..44fbce10 100644
--- a/src/client/src/app/(playground)/fleet-hub/[id]/agent.tsx
+++ b/src/client/src/app/(playground)/fleet-hub/[id]/agent.tsx
@@ -18,6 +18,8 @@ import { usePageHeader } from "@/selectors/page"
import { usePostHog } from "posthog-js/react"
import { CLIENT_EVENTS } from "@/constants/events"
import { toast } from "sonner"
+import FeaturePageHeader from "@/components/(playground)/feature-page-header"
+import OpenTelemetrySvg from "@/components/svg/opentelemetry"
interface AgentDetailProps {
agent: Agent,
@@ -38,17 +40,19 @@ export default function AgentDetail({ agent, fetchAgentInfo }: AgentDetailProps)
useEffect(() => {
setHeader({
title: getAttributeValue(agent, "Status.agent_description.identifying_attributes", "service.name"),
- breadcrumbs: [
- {
- title: "Fleet Hub",
- href: "/fleet-hub"
- }
- ]
+ breadcrumbs: [],
})
- }, [agent]);
+ }, [agent, setHeader]);
return (
- <div className="space-y-6 overflow-auto w-full flex flex-col grow">
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <FeaturePageHeader
+ eyebrow="Monitoring"
+ title={getAttributeValue(agent, "Status.agent_description.identifying_attributes", "service.name")}
+ icon={<OpenTelemetrySvg className="h-4 w-4" />}
+ tone="border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-900/70 dark:bg-sky-950/40 dark:text-sky-300"
+ />
+ <div className="space-y-6 overflow-auto w-full flex flex-col grow p-4">
<Card>
<CardHeader className="flex flex-row items-center gap-8 space-y-0 p-4">
<CardTitle>{getAttributeValue(agent, "Status.agent_description.identifying_attributes", "service.name")}</CardTitle>
@@ -122,6 +126,7 @@ export default function AgentDetail({ agent, fetchAgentInfo }: AgentDetailProps)
</CardFooter>
</Card>
<ConfigDetails agent={agent} fetchAgentInfo={fetchAgentInfo} />
+ </div>
</div>
)
}
diff --git a/src/client/src/app/(playground)/fleet-hub/list.tsx b/src/client/src/app/(playground)/fleet-hub/list.tsx
index 33b58851..4d1043af 100644
--- a/src/client/src/app/(playground)/fleet-hub/list.tsx
+++ b/src/client/src/app/(playground)/fleet-hub/list.tsx
@@ -139,16 +139,18 @@ export default function List({ agents, isLoading, isFetched }: {
}
return (
- <div className="flex flex-col w-full h-full gap-3">
- <FeaturePageHeader eyebrow="Monitoring" title={getMessage().FEATURE_FLEET_HUB} description="Operate every collector from one control plane—health, configuration, and ownership stay visible as your telemetry footprint grows." icon={<OpenTelemetrySvg className="h-4 w-4" />} tone="border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-900/70 dark:bg-sky-950/40 dark:text-sky-300" actions={<VisibilityColumns columns={columns} pageName={"fleethub"} />} />
- <DataTable
- columns={columns}
- data={agents}
- isFetched={isFetched}
- isLoading={isLoading}
- visibilityColumns={visibilityColumns}
- onClick={handleClick}
- />
+ <div className="flex flex-col w-full h-full">
+ <FeaturePageHeader eyebrow="Monitoring" title={getMessage().FEATURE_FLEET_HUB} icon={<OpenTelemetrySvg className="h-4 w-4" />} tone="border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-900/70 dark:bg-sky-950/40 dark:text-sky-300" actions={<VisibilityColumns columns={columns} pageName={"fleethub"} />} />
+ <div className="flex flex-col w-full h-full p-4">
+ <DataTable
+ columns={columns}
+ data={agents}
+ isFetched={isFetched}
+ isLoading={isLoading}
+ visibilityColumns={visibilityColumns}
+ onClick={handleClick}
+ />
+ </div>
</div>
);
}
diff --git a/src/client/src/app/(playground)/getting-started/page.tsx b/src/client/src/app/(playground)/getting-started/page.tsx
index 19bf5a6f..02312544 100644
--- a/src/client/src/app/(playground)/getting-started/page.tsx
+++ b/src/client/src/app/(playground)/getting-started/page.tsx
@@ -262,7 +262,7 @@ openlit.init();`}
];
return (
- <div className="flex flex-col w-full flex-1 overflow-auto relative bg-stone-100/50 dark:bg-stone-900/50 p-4 rounded-md">
+ <div className="flex flex-col w-full flex-1 overflow-auto relative bg-stone-100/50 dark:bg-stone-900/50 p-4">
<div className="mb-6">
<h1 className="text-2xl font-bold mb-4 text-stone-950 dark:text-stone-100">
Get started with AI Observability
diff --git a/src/client/src/app/(playground)/home/page.tsx b/src/client/src/app/(playground)/home/page.tsx
index 42f7d083..05803e12 100644
--- a/src/client/src/app/(playground)/home/page.tsx
+++ b/src/client/src/app/(playground)/home/page.tsx
@@ -20,7 +20,6 @@ import {
getDatabaseConfigListIsLoading,
} from "@/selectors/database-config";
import { getFilterParamsForDashboard } from "@/helpers/client/filter";
-import { fetchProjectList } from "@/helpers/client/project";
import { fetchDatabaseConfigList } from "@/helpers/client/database-config";
import Loader from "@/components/common/loader";
import { usePageHeader } from "@/selectors/page";
@@ -28,8 +27,6 @@ import { usePostHog } from "posthog-js/react";
import { CLIENT_EVENTS } from "@/constants/events";
import { toast } from "sonner";
import BoardList from "./board-list";
-import DescriptionTooltip from "@/components/common/description-tooltip";
-import { BookText } from "lucide-react";
export default function DashboardPage() {
const router = useRouter();
@@ -57,12 +54,6 @@ export default function DashboardPage() {
projects === undefined ||
(hasProject && databaseConfigs === undefined);
- useEffect(() => {
- if (currentOrg?.id) {
- fetchProjectList(currentOrg.id);
- }
- }, [currentOrg?.id]);
-
useEffect(() => {
if (currentProject?.id) {
fetchDatabaseConfigList(() => {});
@@ -150,14 +141,7 @@ export default function DashboardPage() {
return (
<>
- <div className="flex w-full items-center justify-between mb-4 gap-4">
- {initialConfig?.description && (
- <DescriptionTooltip
- description={initialConfig.description}
- className="ml-2 h-4 w-4"
- icon={<BookText className="text-stone-500 cursor-pointer" />}
- />
- )}
+ <div className="flex w-full items-center justify-between gap-4 px-4 pt-3 mb-4">
<Filter />
<BoardList dashboardId={dashboardId} />
</div>
@@ -168,7 +152,7 @@ export default function DashboardPage() {
) : null}
{initialConfig ? (
<Dashboard
- className="h-100 overflow-y-auto"
+ className="h-100 overflow-y-auto px-4"
initialConfig={initialConfig}
readonly
runQuery={runQuery}
diff --git a/src/client/src/app/(playground)/layout.tsx b/src/client/src/app/(playground)/layout.tsx
index fcb02fec..72239cd5 100644
--- a/src/client/src/app/(playground)/layout.tsx
+++ b/src/client/src/app/(playground)/layout.tsx
@@ -1,5 +1,3 @@
-import Sidebar from "@/components/(playground)/sidebar";
-import Header from "@/components/(playground)/header";
import { Suspense } from "react";
import ClickhouseConnectivityWrapper from "@/components/(playground)/clickhouse-connectivity-wrapper";
import { TooltipProvider } from "@/components/ui/tooltip";
@@ -8,6 +6,7 @@ import NavigationEvents from "@/components/common/navigation-events";
import AppInit from "@/components/common/app-init";
import { PortalProvider } from "@/components/(playground)/header-portal";
import ChatFloatingButton from "@/components/(playground)/chat/chat-floating-button";
+import PlaygroundShell from "@/components/(playground)/playground-shell";
import {
EnterpriseFeatureAccessProvider,
EnterpriseFeatureRouteGate,
@@ -27,19 +26,13 @@ export default async function PlaygroundLayout({
<TooltipProvider>
<EnterpriseFeatureAccessProvider snapshot={enterpriseFeatureAccess}>
<PortalProvider>
- <div className="flex h-screen w-full gap-4 overflow-hidden p-2">
- <Sidebar />
- <div className="flex flex-col grow w-full">
- <Header />
- <main className="flex flex-col grow flex-1 items-start p-0 overflow-hidden">
- <ClickhouseConnectivityWrapper>
- <EnterpriseFeatureRouteGate>
- {children}
- </EnterpriseFeatureRouteGate>
- </ClickhouseConnectivityWrapper>
- </main>
- </div>
- </div>
+ <PlaygroundShell>
+ <ClickhouseConnectivityWrapper>
+ <EnterpriseFeatureRouteGate>
+ {children}
+ </EnterpriseFeatureRouteGate>
+ </ClickhouseConnectivityWrapper>
+ </PlaygroundShell>
<ChatFloatingButton />
</PortalProvider>
</EnterpriseFeatureAccessProvider>
diff --git a/src/client/src/app/(playground)/manage-models/page.tsx b/src/client/src/app/(playground)/manage-models/page.tsx
index cfb7daeb..1851af94 100644
--- a/src/client/src/app/(playground)/manage-models/page.tsx
+++ b/src/client/src/app/(playground)/manage-models/page.tsx
@@ -190,7 +190,7 @@ export default function ManageModelsPage() {
return (
<div className="flex flex-col h-full w-full overflow-hidden">
<div className="shrink-0">
- <FeaturePageHeader eyebrow="Configuration" title={m.OPENGROUND_MANAGE_MODELS} description="Curate provider models, pricing, and defaults so experiments and production runs use trusted options." icon={<SettingsIcon className="h-4 w-4" />} tone="border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-900/70 dark:bg-violet-950/40 dark:text-violet-300" actions={<div className="flex items-center gap-2">
+ <FeaturePageHeader eyebrow="Configuration" title={m.OPENGROUND_MANAGE_MODELS} icon={<SettingsIcon className="h-4 w-4" />} tone="border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-900/70 dark:bg-violet-950/40 dark:text-violet-300" actions={<div className="flex items-center gap-2">
<Tooltip>
<TooltipTrigger>
<Button
@@ -257,143 +257,146 @@ export default function ManageModelsPage() {
</Tooltip>
</div>} />
</div>
+ <div className="flex flex-col grow overflow-hidden p-4">
+ <div className="flex flex-col w-full h-full border border-stone-200 dark:border-stone-800 rounded-md">
+ {/* SDK Pricing URL bar */}
+ {pricingUrl && (
+ <div className="flex items-center gap-3 px-4 py-2.5 bg-stone-50 dark:bg-stone-950 border-b border-stone-200 dark:border-stone-800 shrink-0 rounded-t-md">
+ <LinkIcon className="h-3.5 w-3.5 text-stone-400 shrink-0" />
+ <span className="text-xs font-medium text-stone-500 dark:text-stone-400 shrink-0">
+ {m.MANAGE_MODELS_PRICING_URL_LABEL}
+ </span>
+ <Input
+ readOnly
+ value={pricingUrl}
+ onFocus={(e) => e.target.select()}
+ className="font-mono text-xs h-8 flex-1 min-w-0"
+ />
+ <Button
+ variant="outline"
+ size="sm"
+ className="gap-1.5 shrink-0 h-8"
+ onClick={copyUrl}
+ >
+ <Copy className="h-3.5 w-3.5" />
+ {m.COPY}
+ </Button>
+ </div>
+ )}
- {/* SDK Pricing URL bar */}
- {pricingUrl && (
- <div className="flex items-center gap-3 px-4 py-2.5 bg-stone-50 dark:bg-stone-950 border-b border-stone-200 dark:border-stone-800 shrink-0">
- <LinkIcon className="h-3.5 w-3.5 text-stone-400 shrink-0" />
- <span className="text-xs font-medium text-stone-500 dark:text-stone-400 shrink-0">
- {m.MANAGE_MODELS_PRICING_URL_LABEL}
- </span>
- <Input
- readOnly
- value={pricingUrl}
- onFocus={(e) => e.target.select()}
- className="font-mono text-xs h-8 flex-1 min-w-0"
- />
- <Button
- variant="outline"
- size="sm"
- className="gap-1.5 shrink-0 h-8"
- onClick={copyUrl}
- >
- <Copy className="h-3.5 w-3.5" />
- {m.COPY}
- </Button>
- </div>
- )}
-
- {/* Main Content - Split Layout */}
- <div className="flex flex-1 overflow-hidden min-h-0">
- <ModelListSidebar
- providers={providers || []}
- customModels={customModels || {}}
- loading={loadingProviders || loadingCustom}
- selectedModel={selectedModel}
- selectedProvider={selectedProvider}
- selectedIsCustom={isCustomModel}
- onSelectModel={handleSelectModel}
- onAddNew={handleAddNew}
- onEditProvider={handleEditProvider}
- />
-
- <div className="flex-1 overflow-auto bg-stone-50 dark:bg-stone-950">
- {selectedModel || isAddingNew ? (
- <ModelEditorPanel
- model={selectedModel}
- provider={selectedProvider}
- isCustomModel={isCustomModel}
- isAddingNew={isAddingNew}
- onSave={handleModelSaved}
- onDelete={handleModelDeleted}
- onCancel={() => {
- setSelectedModel(null);
- setSelectedProvider(null);
- setIsAddingNew(false);
- }}
+ {/* Main Content - Split Layout */}
+ <div className="flex flex-1 overflow-hidden min-h-0">
+ <ModelListSidebar
+ providers={providers || []}
+ customModels={customModels || {}}
+ loading={loadingProviders || loadingCustom}
+ selectedModel={selectedModel}
+ selectedProvider={selectedProvider}
+ selectedIsCustom={isCustomModel}
+ onSelectModel={handleSelectModel}
+ onAddNew={handleAddNew}
+ onEditProvider={handleEditProvider}
/>
- ) : (
- <div className="flex flex-col items-center justify-center h-full p-8 text-center">
- <SettingsIcon className="h-16 w-16 text-stone-300 dark:text-stone-700 mb-4" />
- <h3 className="text-lg font-medium text-stone-900 dark:text-stone-100 mb-2">
- {m.OPENGROUND_SELECT_MODEL_TO_VIEW}
- </h3>
- <p className="text-sm text-stone-500 dark:text-stone-400 max-w-md">
- {m.OPENGROUND_SELECT_MODEL_TO_VIEW_DESCRIPTION}
- </p>
- {pricingUrl && (
- <Button
- variant="outline"
- size="sm"
- className="gap-2 mt-6"
- onClick={() => setShowSdkUsage(true)}
- >
- <Code2 className="h-4 w-4" />
- {m.MANAGE_MODELS_SDK_USAGE}
- </Button>
+
+ <div className="flex-1 overflow-auto bg-stone-50 dark:bg-stone-950">
+ {selectedModel || isAddingNew ? (
+ <ModelEditorPanel
+ model={selectedModel}
+ provider={selectedProvider}
+ isCustomModel={isCustomModel}
+ isAddingNew={isAddingNew}
+ onSave={handleModelSaved}
+ onDelete={handleModelDeleted}
+ onCancel={() => {
+ setSelectedModel(null);
+ setSelectedProvider(null);
+ setIsAddingNew(false);
+ }}
+ />
+ ) : (
+ <div className="flex flex-col items-center justify-center h-full p-8 text-center">
+ <SettingsIcon className="h-16 w-16 text-stone-300 dark:text-stone-700 mb-4" />
+ <h3 className="text-lg font-medium text-stone-900 dark:text-stone-100 mb-2">
+ {m.OPENGROUND_SELECT_MODEL_TO_VIEW}
+ </h3>
+ <p className="text-sm text-stone-500 dark:text-stone-400 max-w-md">
+ {m.OPENGROUND_SELECT_MODEL_TO_VIEW_DESCRIPTION}
+ </p>
+ {pricingUrl && (
+ <Button
+ variant="outline"
+ size="sm"
+ className="gap-2 mt-6"
+ onClick={() => setShowSdkUsage(true)}
+ >
+ <Code2 className="h-4 w-4" />
+ {m.MANAGE_MODELS_SDK_USAGE}
+ </Button>
+ )}
+ </div>
)}
</div>
- )}
- </div>
- </div>
+ </div>
- {/* Import Dialog */}
- <Dialog open={showImport} onOpenChange={setShowImport}>
- <DialogContent className="sm:max-w-lg">
- <DialogHeader>
- <DialogTitle>{m.MANAGE_MODELS_IMPORT_DIALOG_TITLE}</DialogTitle>
- <DialogDescription>
- {m.MANAGE_MODELS_IMPORT_DIALOG_DESCRIPTION}
- </DialogDescription>
- </DialogHeader>
- <Textarea
- placeholder={`{
- "providers": [
- {
- "providerId": "my-provider",
- "displayName": "My Provider",
- "description": "Custom LLM provider"
- }
- ],
- "models": [
- {
- "provider": "my-provider",
- "model_id": "my-model-v1",
- "displayName": "My Model v1",
- "inputPricePerMToken": 2.5,
- "outputPricePerMToken": 10
- }
- ]
-}`}
- value={importJson}
- onChange={(e) => setImportJson(e.target.value)}
- className="min-h-[200px] text-xs dark:text-stone-100 text-stone-800"
- />
- <DialogFooter>
- <Button variant="outline" onClick={() => setShowImport(false)}>
- {m.CANCEL}
- </Button>
- <Button onClick={handleImport} disabled={importing || !importJson.trim()}>
- {importing ? m.SAVING : m.MANAGE_MODELS_IMPORT_PRICING}
- </Button>
- </DialogFooter>
- </DialogContent>
- </Dialog>
+ {/* Import Dialog */}
+ <Dialog open={showImport} onOpenChange={setShowImport}>
+ <DialogContent className="sm:max-w-lg">
+ <DialogHeader>
+ <DialogTitle>{m.MANAGE_MODELS_IMPORT_DIALOG_TITLE}</DialogTitle>
+ <DialogDescription>
+ {m.MANAGE_MODELS_IMPORT_DIALOG_DESCRIPTION}
+ </DialogDescription>
+ </DialogHeader>
+ <Textarea
+ placeholder={`{
+ "providers": [
+ {
+ "providerId": "my-provider",
+ "displayName": "My Provider",
+ "description": "Custom LLM provider"
+ }
+ ],
+ "models": [
+ {
+ "provider": "my-provider",
+ "model_id": "my-model-v1",
+ "displayName": "My Model v1",
+ "inputPricePerMToken": 2.5,
+ "outputPricePerMToken": 10
+ }
+ ]
+ }`}
+ value={importJson}
+ onChange={(e) => setImportJson(e.target.value)}
+ className="min-h-[200px] text-xs dark:text-stone-100 text-stone-800"
+ />
+ <DialogFooter>
+ <Button variant="outline" onClick={() => setShowImport(false)}>
+ {m.CANCEL}
+ </Button>
+ <Button onClick={handleImport} disabled={importing || !importJson.trim()}>
+ {importing ? m.SAVING : m.MANAGE_MODELS_IMPORT_PRICING}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
- {/* SDK Usage Dialog */}
- <SdkUsageDialog
- open={showSdkUsage}
- onOpenChange={setShowSdkUsage}
- pricingUrl={pricingUrl}
- />
+ {/* SDK Usage Dialog */}
+ <SdkUsageDialog
+ open={showSdkUsage}
+ onOpenChange={setShowSdkUsage}
+ pricingUrl={pricingUrl}
+ />
- {/* Provider Editor Dialog */}
- <ProviderEditorDialog
- open={showProviderEditor}
- onOpenChange={setShowProviderEditor}
- provider={editingProvider}
- onSaved={handleProviderSaved}
- />
+ {/* Provider Editor Dialog */}
+ <ProviderEditorDialog
+ open={showProviderEditor}
+ onOpenChange={setShowProviderEditor}
+ provider={editingProvider}
+ onSaved={handleProviderSaved}
+ />
+ </div>
+ </div>
</div>
);
}
diff --git a/src/client/src/app/(playground)/observability/exceptions/[id]/page.tsx b/src/client/src/app/(playground)/observability/exceptions/[id]/page.tsx
deleted file mode 100644
index c121fc38..00000000
--- a/src/client/src/app/(playground)/observability/exceptions/[id]/page.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { redirect } from "next/navigation";
-
-export default function ExceptionRedirect({
- params,
- searchParams,
-}: {
- params: { id: string };
- searchParams: Record<string, string | string[] | undefined>;
-}) {
- const query = new URLSearchParams();
- Object.entries(searchParams).forEach(([key, value]) => {
- if (Array.isArray(value)) {
- value.forEach((item) => query.append(key, item));
- return;
- }
- if (value) query.set(key, value);
- });
- redirect(`/telemetry/exceptions/${params.id}${query.toString() ? `?${query.toString()}` : ""}`);
-}
diff --git a/src/client/src/app/(playground)/observability/metrics/[name]/page.tsx b/src/client/src/app/(playground)/observability/metrics/[name]/page.tsx
deleted file mode 100644
index aad8195f..00000000
--- a/src/client/src/app/(playground)/observability/metrics/[name]/page.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { redirect } from "next/navigation";
-
-export default function MetricRedirect({
- params,
- searchParams,
-}: {
- params: { name: string };
- searchParams: Record<string, string | string[] | undefined>;
-}) {
- const query = new URLSearchParams();
- Object.entries(searchParams).forEach(([key, value]) => {
- if (Array.isArray(value)) {
- value.forEach((item) => query.append(key, item));
- return;
- }
- if (value) query.set(key, value);
- });
- redirect(`/telemetry/metrics/${params.name}${query.toString() ? `?${query.toString()}` : ""}`);
-}
diff --git a/src/client/src/app/(playground)/observability/page.tsx b/src/client/src/app/(playground)/observability/page.tsx
deleted file mode 100644
index 7ed2d6b4..00000000
--- a/src/client/src/app/(playground)/observability/page.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { redirect } from "next/navigation";
-
-export default function ObservabilityRedirect({
- searchParams,
-}: {
- searchParams: Record<string, string | string[] | undefined>;
-}) {
- const params = new URLSearchParams();
- Object.entries(searchParams).forEach(([key, value]) => {
- if (Array.isArray(value)) {
- value.forEach((item) => params.append(key, item));
- return;
- }
- if (value) params.set(key, value);
- });
- redirect(`/telemetry${params.toString() ? `?${params.toString()}` : ""}`);
-}
diff --git a/src/client/src/app/(playground)/observability/traces/[id]/page.tsx b/src/client/src/app/(playground)/observability/traces/[id]/page.tsx
deleted file mode 100644
index f1160842..00000000
--- a/src/client/src/app/(playground)/observability/traces/[id]/page.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { redirect } from "next/navigation";
-
-export default function TraceRedirect({
- params,
- searchParams,
-}: {
- params: { id: string };
- searchParams: Record<string, string | string[] | undefined>;
-}) {
- const query = new URLSearchParams();
- Object.entries(searchParams).forEach(([key, value]) => {
- if (Array.isArray(value)) {
- value.forEach((item) => query.append(key, item));
- return;
- }
- if (value) query.set(key, value);
- });
- redirect(`/telemetry/traces/${params.id}${query.toString() ? `?${query.toString()}` : ""}`);
-}
diff --git a/src/client/src/app/(playground)/openground/[id]/page.tsx b/src/client/src/app/(playground)/openground/[id]/page.tsx
index d56bd212..423037e5 100644
--- a/src/client/src/app/(playground)/openground/[id]/page.tsx
+++ b/src/client/src/app/(playground)/openground/[id]/page.tsx
@@ -1,7 +1,7 @@
"use client";
import { usePostHog } from "posthog-js/react";
import { CLIENT_EVENTS } from "@/constants/events";
-import OpengroundHeader from "@/components/(playground)/openground/header";
+import OpengroundHeader, { OpengroundActions } from "@/components/(playground)/openground/header";
import { OpengroundRecord } from "@/lib/platform/openground-clickhouse";
import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
import { useCallback, useEffect } from "react";
@@ -13,8 +13,9 @@ import PerformanceWaterfall from "@/components/(playground)/openground/performan
import CostBreakdown from "@/components/(playground)/openground/cost-breakdown";
import ProviderResultCard from "@/components/(playground)/openground/provider-result-card";
import Link from "next/link";
-import { Component } from "lucide-react";
+import { Component, MonitorPlay } from "lucide-react";
import getMessage from "@/constants/messages";
+import FeaturePageHeader from "@/components/(playground)/feature-page-header";
export default function OpengroundRequest({
params,
@@ -41,24 +42,32 @@ export default function OpengroundRequest({
fetchData();
}, []);
+ const opengroundHeaderTone = "border-indigo-200 bg-indigo-50 text-indigo-700 dark:border-indigo-900/70 dark:bg-indigo-950/40 dark:text-indigo-300";
+
if (isLoading || !isFetched)
return (
- <div className="flex w-full h-full text-stone-600 dark:text-stone-400 items-center justify-center">
- {getMessage().LOADING}
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <OpengroundHeader title={getMessage().LOADING} />
+ <div className="flex w-full h-full text-stone-600 dark:text-stone-400 items-center justify-center">
+ {getMessage().LOADING}
+ </div>
</div>
);
if (!data)
return (
- <div className="flex w-full h-full text-error items-center justify-center">
- {getMessage().NO_DATA_FOUND}
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <OpengroundHeader title={getMessage().OPENGROUND_RUN_DETAILS} />
+ <div className="flex w-full h-full text-error items-center justify-center">
+ {getMessage().NO_DATA_FOUND}
+ </div>
</div>
);
return (
- <div className="flex flex-col w-full h-full gap-6 overflow-auto">
- <OpengroundHeader validateResponse={false} />
-
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <OpengroundHeader title={getMessage().OPENGROUND_RUN_DETAILS} />
+ <div className="flex flex-col w-full h-full gap-6 overflow-auto p-4">
{/* Evaluation Info */}
<Card>
<CardHeader>
@@ -145,6 +154,7 @@ export default function OpengroundRequest({
</Card>
</div>
)}
+ </div>
</div>
);
}
diff --git a/src/client/src/app/(playground)/openground/models/page.tsx b/src/client/src/app/(playground)/openground/models/page.tsx
deleted file mode 100644
index d7e0757b..00000000
--- a/src/client/src/app/(playground)/openground/models/page.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-"use client";
-
-import { useEffect } from "react";
-import { usePostHog } from "posthog-js/react";
-import { CLIENT_EVENTS } from "@/constants/events";
-import { useRouter } from "next/navigation";
-
-export default function OpengroundModelsPage() {
- const posthog = usePostHog();
- const router = useRouter();
-
- useEffect(() => {
- posthog?.capture(CLIENT_EVENTS.OPENGROUND_MODELS_PAGE_VISITED);
- router.replace("/manage-models");
- }, []);
-
- return null;
-}
diff --git a/src/client/src/app/(playground)/openground/new/page.tsx b/src/client/src/app/(playground)/openground/new/page.tsx
index 2f6a30f6..aa31d5d7 100644
--- a/src/client/src/app/(playground)/openground/new/page.tsx
+++ b/src/client/src/app/(playground)/openground/new/page.tsx
@@ -8,7 +8,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { useRootStore } from "@/store";
import { PlayIcon, RotateCcwIcon, Loader2Icon } from "lucide-react";
import { toast } from "sonner";
-import OpengroundHeader from "@/components/(playground)/openground/header";
+import OpengroundHeader, { OpengroundActions } from "@/components/(playground)/openground/header";
import PromptSourceToggle from "@/components/(playground)/openground/prompt-source-toggle";
import DynamicProviderGrid from "@/components/(playground)/openground/dynamic-provider-grid";
import ProviderSettingsPanel from "@/components/(playground)/openground/provider-settings-panel";
@@ -116,11 +116,78 @@ export default function OpengroundNew() {
: null;
return (
- <div className="flex flex-col w-full h-full gap-6 overflow-auto">
- <OpengroundHeader validateResponse={false} />
+ <div className="flex flex-col w-full h-full">
+ <OpengroundHeader title={getMessage().OPENGROUND_CREATE_NEW_PLAYGROUND} extraButton={
+ <>
+ {evaluatedResponse.data && (
+ <Button
+ variant="outline"
+ size={"sm"}
+ onClick={handleReset}
+ className="h-8"
+ >
+ <RotateCcwIcon className="mr-1.5 h-4 w-4" />
+ {getMessage().RESET}
+ </Button>
+ )}
+ <Button
+ onClick={handleEvaluate}
+ disabled={!canEvaluate || evaluatedResponse.isLoading}
+ className="h-8"
+ size={"sm"}
+ >
+ {evaluatedResponse.isLoading ? (
+ <>
+ <Loader2Icon className="mr-1.5 h-4 w-4 animate-spin" />
+ {getMessage().OPENGROUND_EVALUATING}
+ </>
+ ) : (
+ <>
+ <PlayIcon className="mr-1.5 h-4 w-4" />
+ {getMessage().OPENGROUND_EVALUATE_PROVIDERS}
+ </>
+ )}
+ </Button>
+ </>
+ } />
{/* Main Content */}
- <div className="space-y-6">
+ <div className="flex flex-col w-full h-full space-y-6 p-4 overflow-auto">
+ {/* Action Buttons */}
+ <Card className="p-4 border-stone-200 dark:border-stone-800">
+ {/* Loading State */}
+ {evaluatedResponse.isLoading ? (
+ <Card className="p-12 border-stone-200 dark:border-stone-800">
+ <div className="flex flex-col items-center justify-center gap-4">
+ <Loader2Icon className="h-12 w-12 animate-spin text-blue-500" />
+ <div className="text-center">
+ <p className="text-lg font-medium text-stone-900 dark:text-stone-100">
+ {getMessage().OPENGROUND_EVALUATING_PROVIDERS}
+ </p>
+ <p className="text-sm text-stone-500 dark:text-stone-400 mt-1">
+ {getMessage().OPENGROUND_MAY_TAKE_FEW_SECONDS}
+ </p>
+ </div>
+ </div>
+ </Card>
+ ) : (
+ <div className="flex w-full items-center justify-between">
+ <div className="text-sm text-stone-600 dark:text-stone-400">
+ {selectedProvidersNew.length === 0 ? (
+ getMessage().OPENGROUND_SELECT_PROVIDERS_BEGIN
+ ) : evaluatedResponse.data ? (
+ <span className="text-green-600 dark:text-green-400 font-medium">
+ ✓ {getMessage().OPENGROUND_EVALUATION_COMPLETE}
+ </span>
+ ) : (
+ `${getMessage().OPENGROUND_READY_TO_EVALUATE} ${selectedProvidersNew.length} provider${selectedProvidersNew.length > 1 ? "s" : ""
+ }`
+ )}
+ </div>
+ </div>
+ )}
+ </Card>
+
{/* Step 1: Prompt Configuration */}
<PromptSourceToggle />
@@ -130,54 +197,6 @@ export default function OpengroundNew() {
{/* Step 3: Provider Settings */}
<ProviderSettingsPanel />
- {/* Action Buttons */}
- <Card className="p-4 border-stone-200 dark:border-stone-800">
- <div className="flex items-center justify-between">
- <div className="text-sm text-stone-600 dark:text-stone-400">
- {selectedProvidersNew.length === 0 ? (
- getMessage().OPENGROUND_SELECT_PROVIDERS_BEGIN
- ) : evaluatedResponse.data ? (
- <span className="text-green-600 dark:text-green-400 font-medium">
- ✓ {getMessage().OPENGROUND_EVALUATION_COMPLETE}
- </span>
- ) : (
- `${getMessage().OPENGROUND_READY_TO_EVALUATE} ${selectedProvidersNew.length} provider${
- selectedProvidersNew.length > 1 ? "s" : ""
- }`
- )}
- </div>
- <div className="flex gap-2">
- {evaluatedResponse.data && (
- <Button
- variant="outline"
- onClick={handleReset}
- className="gap-2"
- >
- <RotateCcwIcon className="h-4 w-4" />
- {getMessage().RESET}
- </Button>
- )}
- <Button
- onClick={handleEvaluate}
- disabled={!canEvaluate || evaluatedResponse.isLoading}
- className="gap-2"
- >
- {evaluatedResponse.isLoading ? (
- <>
- <Loader2Icon className="h-4 w-4 animate-spin" />
- {getMessage().OPENGROUND_EVALUATING}
- </>
- ) : (
- <>
- <PlayIcon className="h-4 w-4" />
- {getMessage().OPENGROUND_EVALUATE_PROVIDERS}
- </>
- )}
- </Button>
- </div>
- </div>
- </Card>
-
{/* Results Section */}
{providerResults && (
<div className="space-y-6">
@@ -203,23 +222,6 @@ export default function OpengroundNew() {
</Card>
</div>
)}
-
- {/* Loading State */}
- {evaluatedResponse.isLoading && (
- <Card className="p-12 border-stone-200 dark:border-stone-800">
- <div className="flex flex-col items-center justify-center gap-4">
- <Loader2Icon className="h-12 w-12 animate-spin text-blue-500" />
- <div className="text-center">
- <p className="text-lg font-medium text-stone-900 dark:text-stone-100">
- {getMessage().OPENGROUND_EVALUATING_PROVIDERS}
- </p>
- <p className="text-sm text-stone-500 dark:text-stone-400 mt-1">
- {getMessage().OPENGROUND_MAY_TAKE_FEW_SECONDS}
- </p>
- </div>
- </div>
- </Card>
- )}
</div>
</div>
);
diff --git a/src/client/src/app/(playground)/openground/page.tsx b/src/client/src/app/(playground)/openground/page.tsx
index 75d5c38f..ca392ef5 100644
--- a/src/client/src/app/(playground)/openground/page.tsx
+++ b/src/client/src/app/(playground)/openground/page.tsx
@@ -6,19 +6,17 @@ import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
import Link from "next/link";
import { useCallback, useEffect } from "react";
import { toast } from "sonner";
-import { Component, EyeIcon, MonitorPlay, PlayIcon } from "lucide-react";
+import { Component, EyeIcon, PlayIcon } from "lucide-react";
import OpengroundHeader from "@/components/(playground)/openground/header";
import { Columns } from "@/components/data-table/columns";
import DataTable from "@/components/data-table/table";
import OpengroundGettingStarted from "@/components/(playground)/getting-started/openground";
import { OpengroundRecord } from "@/lib/platform/openground-clickhouse";
import { format } from "date-fns";
-import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { useRootStore } from "@/store";
import { useRouter } from "next/navigation";
import getMessage from "@/constants/messages";
-import FeaturePageHeader from "@/components/(playground)/feature-page-header";
const columns: Columns<string, OpengroundRecord> = {
prompt: {
@@ -113,7 +111,10 @@ const columns: Columns<string, OpengroundRecord> = {
header: () => "Actions",
cell: ({ row, extraFunctions }) => {
return (
- <div className="flex items-center gap-2">
+ <div
+ className="flex items-center gap-2"
+ onClick={(e) => e.stopPropagation()}
+ >
<Link href={`/openground/${row.id}`}>
<Button variant="ghost" size="icon" className="h-8 w-8">
<EyeIcon className="h-4 w-4" />
@@ -181,7 +182,6 @@ export default function Openground() {
return (
<div className="flex flex-col w-full h-full gap-4 overflow-auto">
<OpengroundHeader validateResponse={false} />
- <FeaturePageHeader eyebrow="Resources" title={getMessage().FEATURE_OPENGROUND} description="Compare prompts and models side by side so teams can choose the fastest, cheapest, and highest-quality path." icon={<MonitorPlay className="h-4 w-4" />} tone="border-indigo-200 bg-indigo-50 text-indigo-700 dark:border-indigo-900/70 dark:bg-indigo-950/40 dark:text-indigo-300" />
<div className="flex flex-col items-center mx-auto">
<OpengroundGettingStarted />
</div>
@@ -190,28 +190,30 @@ export default function Openground() {
}
return (
- <div className="flex flex-col w-full h-full gap-4">
+ <div className="flex flex-col w-full h-full">
<OpengroundHeader validateResponse={false} />
- <FeaturePageHeader eyebrow="Resources" title={getMessage().FEATURE_OPENGROUND} description="Compare prompts and models side by side so teams can choose the fastest, cheapest, and highest-quality path." icon={<MonitorPlay className="h-4 w-4" />} tone="border-indigo-200 bg-indigo-50 text-indigo-700 dark:border-indigo-900/70 dark:bg-indigo-950/40 dark:text-indigo-300" />
- <DataTable
- columns={columns}
- data={data || []}
- isFetched={isFetched}
- isLoading={isLoading}
- visibilityColumns={{
- prompt: true,
- providers: true,
- bestCost: true,
- bestSpeed: true,
- bestEfficiency: true,
- createdAt: true,
- actions: true
- }}
- extraFunctions={{
- handleRerun,
- }}
- />
+ <div className="flex flex-col w-full h-full p-4">
+ <DataTable
+ columns={columns}
+ data={data || []}
+ isFetched={isFetched}
+ isLoading={isLoading}
+ visibilityColumns={{
+ prompt: true,
+ providers: true,
+ bestCost: true,
+ bestSpeed: true,
+ bestEfficiency: true,
+ createdAt: true,
+ actions: true
+ }}
+ onClick={(row: OpengroundRecord) => router.push(`/openground/${row.id}`)}
+ extraFunctions={{
+ handleRerun,
+ }}
+ />
+ </div>
</div>
);
}
diff --git a/src/client/src/app/(playground)/pricing/page.tsx b/src/client/src/app/(playground)/pricing/page.tsx
index 9757d3bc..9cd3fe19 100644
--- a/src/client/src/app/(playground)/pricing/page.tsx
+++ b/src/client/src/app/(playground)/pricing/page.tsx
@@ -85,19 +85,28 @@ export default function PricingPage() {
});
};
+ const header = (
+ <FeaturePageHeader eyebrow="Configuration" title={m.PRICING_TITLE} icon={<CircleDollarSign className="size-4" />} tone="border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-300" />
+ );
+
if (isLoadingConfig && !config) {
return (
- <div className="flex flex-1 h-full w-full p-6">
- <div className="animate-pulse grid gap-4 w-full max-w-3xl">
- <div className="h-40 bg-stone-100 dark:bg-stone-900 rounded-xl" />
+ <div className="flex flex-col h-full w-full overflow-hidden">
+ {header}
+ <div className="flex flex-1 w-full p-4">
+ <div className="animate-pulse grid gap-4 w-full max-w-3xl">
+ <div className="h-40 bg-stone-100 dark:bg-stone-900" />
+ </div>
</div>
</div>
);
}
return (
- <div className="flex flex-col flex-1 h-full w-full overflow-auto gap-4">
- <FeaturePageHeader eyebrow="Configuration" title={m.PRICING_TITLE} description="Model provider cost and token economics so usage, evaluations, and experiments reflect real operating spend." icon={<CircleDollarSign className="size-4" />} tone="border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-300" />
+ <div className="flex flex-col h-full w-full overflow-hidden">
+ {header}
+
+ <div className="flex flex-col flex-1 w-full overflow-auto gap-4 p-4">
{/* Single info bar (replaces the large left description card) */}
<Card className="border-blue-200 dark:border-blue-900/50 bg-blue-50/50 dark:bg-blue-950/20">
@@ -189,8 +198,8 @@ export default function PricingPage() {
<li>{m.PRICING_MANUAL_STEP_2}</li>
<li>{m.PRICING_MANUAL_STEP_3}</li>
</ol>
- <Link href="/requests" className="mt-3 inline-block">
- <Button variant="default">{m.PRICING_GO_TO_REQUESTS}</Button>
+ <Link href="/telemetry" className="mt-3 inline-block">
+ <Button variant="default">{m.PRICING_GO_TO_TRACES}</Button>
</Link>
</CardContent>
</Card>
@@ -219,5 +228,6 @@ export default function PricingPage() {
</CardContent>
</Card>
</div>
+ </div>
);
}
diff --git a/src/client/src/app/(playground)/prompt-hub/[id]/edit/page.tsx b/src/client/src/app/(playground)/prompt-hub/[id]/edit/page.tsx
index bbf71d71..6d0e8656 100644
--- a/src/client/src/app/(playground)/prompt-hub/[id]/edit/page.tsx
+++ b/src/client/src/app/(playground)/prompt-hub/[id]/edit/page.tsx
@@ -10,9 +10,9 @@ import PromptMarkdownViewer from "@/components/(playground)/prompt-hub/prompt-ma
import PromptOtterInlineAssistant from "@/components/(playground)/prompt-hub/prompt-otter-inline-assistant";
import { CLIENT_EVENTS } from "@/constants/events";
import getMessage from "@/constants/messages";
-import { usePageHeader } from "@/selectors/page";
import { Prompt, PromptVersion, PromptVersionStatus } from "@/types/prompt";
import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
+import { useCustomBreadcrumbs } from "@/utils/hooks/useBreadcrumbs";
import { jsonParse } from "@/utils/json";
import { objectEntries } from "@/utils/object";
import { unescapeString } from "@/utils/string";
@@ -20,8 +20,9 @@ import { ArrowLeftIcon, PlusIcon, XIcon } from "lucide-react";
import Link from "next/link";
import { useParams, useRouter } from "next/navigation";
import { usePostHog } from "posthog-js/react";
-import { KeyboardEvent, useCallback, useEffect, useState } from "react";
+import { KeyboardEvent, useCallback, useEffect, useMemo, useState } from "react";
import { toast } from "sonner";
+import PromptHubHeader from "@/components/(playground)/prompt-hub/header";
const getVersions = (startingVersion: string) => {
const v = startingVersion.split(".").map(Number);
@@ -39,8 +40,6 @@ export default function EditPromptPage() {
const router = useRouter();
const posthog = usePostHog();
const params = useParams();
- const { setHeader } = usePageHeader();
-
const { fireRequest: fetchReq, data: promptData, isLoading: isFetching } =
useFetchWrapper<Prompt>();
const { fireRequest: saveReq, isLoading: isSaving } = useFetchWrapper();
@@ -122,15 +121,16 @@ export default function EditPromptPage() {
];
setVersionOptions(opts);
setSelectedVersion(versions.draft);
-
- setHeader({
- title: d.name,
- breadcrumbs: [
- { title: m.PROMPT_HUB, href: "/prompt-hub" },
- { title: d.name, href: `/prompt-hub/${params.id}` },
- ],
- });
- }, [(promptData as any)?.promptId]);
+ }, [promptData]);
+
+ const customHeader = useMemo(
+ () => ({
+ title: (promptData as Prompt | undefined)?.name || (isFetching ? m.LOADING : ""),
+ breadcrumbs: [],
+ }),
+ [(promptData as Prompt | undefined)?.name, isFetching]
+ );
+ useCustomBreadcrumbs(customHeader, [(promptData as Prompt | undefined)?.name, isFetching]);
const addTag = useCallback(() => {
const val = tagInput.trim();
@@ -222,27 +222,26 @@ export default function EditPromptPage() {
const isDraft = versionData?.status === PromptVersionStatus.DRAFT;
return (
- <div className="flex flex-col w-full h-full gap-4 overflow-hidden">
- {/* Topbar */}
- <div className="flex items-center justify-between flex-shrink-0">
- <Link
- href={`/prompt-hub/${params.id}`}
- className="flex items-center gap-1.5 text-sm text-stone-500 dark:text-stone-400 hover:text-stone-800 dark:hover:text-stone-200 transition-colors"
- >
- <ArrowLeftIcon className="w-4 h-4" />
- {m.PROMPT_HUB_BACK_TO} {promptName}
- </Link>
- <Button
- onClick={handleSubmit}
- disabled={isSaving || isFetching}
- className={isSaving ? "animate-pulse" : ""}
- >
- {isSaving ? m.SAVING : m.SAVE}
- </Button>
- </div>
+ <div className="flex flex-col w-full h-full overflow-hidden">
+ <PromptHubHeader createNew={false} title={`Prompt : ${promptName}`} promptUsage={false} extraButtons={(
+ <>
+ <Button variant="outline" size="sm" className="h-8" onClick={() => router.push(`/prompt-hub/${params.id}`)}>
+ <ArrowLeftIcon className="mr-1.5 size-3.5" />
+ {m.PROMPT_HUB_BACK_TO} {promptName}
+ </Button>
+ <Button
+ onClick={handleSubmit}
+ disabled={isSaving || isFetching}
+ className={`${isSaving ? "animate-pulse" : ""} h-8`}
+ size={"sm"}
+ >
+ {isSaving ? m.SAVING : m.SAVE}
+ </Button>
+ </>
+ )} />
{/* Body */}
- <div className="grid grid-cols-3 gap-4 flex-1 overflow-hidden">
+ <div className="grid grid-cols-3 gap-4 flex-1 overflow-hidden p-4">
{/* Left: markdown editor */}
<Card className="col-span-2 flex flex-col overflow-hidden border border-stone-200 dark:border-stone-800">
<CardHeader className="p-4 pb-2 border-b border-stone-200 dark:border-stone-800 flex-shrink-0">
@@ -322,11 +321,10 @@ export default function EditPromptPage() {
key={opt.value}
type="button"
onClick={() => setSelectedVersion(opt.value)}
- className={`text-left p-3 rounded-md border transition-colors ${
- selectedVersion === opt.value
+ className={`text-left p-3 rounded-md border transition-colors ${selectedVersion === opt.value
? "border-primary bg-primary/5 dark:bg-primary/10"
: "border-stone-200 dark:border-stone-700 hover:border-stone-300 dark:hover:border-stone-600"
- }`}
+ }`}
>
<div className="text-sm font-medium text-stone-800 dark:text-stone-200">
{opt.title}
diff --git a/src/client/src/app/(playground)/prompt-hub/[id]/page.tsx b/src/client/src/app/(playground)/prompt-hub/[id]/page.tsx
index c07d4e4a..3046745a 100644
--- a/src/client/src/app/(playground)/prompt-hub/[id]/page.tsx
+++ b/src/client/src/app/(playground)/prompt-hub/[id]/page.tsx
@@ -1,7 +1,6 @@
"use client";
import { usePostHog } from "posthog-js/react";
import { CLIENT_EVENTS } from "@/constants/events";
-import PromptHubHeader from "@/components/(playground)/prompt-hub/header";
import RuleForm from "@/components/(playground)/rule-engine/form";
import getMessage from "@/constants/messages";
import { Badge } from "@/components/ui/badge";
@@ -28,23 +27,28 @@ import { useRootStore } from "@/store";
import { Prompt, PromptVersion, PromptVersionStatus } from "@/types/prompt";
import { Rule, RuleEntity } from "@/types/rule-engine";
import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
+import { useDynamicBreadcrumbs } from "@/utils/hooks/useBreadcrumbs";
import { jsonParse } from "@/utils/json";
import { objectEntries } from "@/utils/object";
import { unescapeString } from "@/utils/string";
import { format, formatDistance } from "date-fns";
-import { CalendarDays, CloudDownload, LinkIcon, PlusIcon, Rocket, SlidersHorizontal } from "lucide-react";
+import { ArrowLeftIcon, CalendarDays, CloudDownload, Component, LinkIcon, PlusIcon, Rocket, SlidersHorizontal } from "lucide-react";
+import FeaturePageHeader from "@/components/(playground)/feature-page-header";
import Link from "next/link";
import ReactMarkdown from "react-markdown";
import {
useParams,
+ useRouter,
useSearchParams,
} from "next/navigation";
import { useCallback, useEffect, useState } from "react";
import { toast } from "sonner";
+import PromptHubHeader from "@/components/(playground)/prompt-hub/header";
const m = getMessage();
export default function PromptHub() {
+ const router = useRouter();
const posthog = usePostHog();
const pingStatus = useRootStore(getPingStatus);
const params = useParams();
@@ -52,6 +56,11 @@ export default function PromptHub() {
const version = searchParams.get("version") || undefined;
const { data, fireRequest, isFetched, isLoading } = useFetchWrapper<Prompt>();
+ useDynamicBreadcrumbs(
+ { title: (data as Prompt | undefined)?.name || (isLoading ? m.LOADING : "") },
+ [(data as Prompt | undefined)?.name, isLoading]
+ );
+
const [selectedRuleId, setSelectedRuleId] = useState("");
const [isLinkingOpen, setIsLinkingOpen] = useState(false);
@@ -137,21 +146,29 @@ export default function PromptHub() {
(r: any) => !linkedRuleIds.has(r.id)
);
+ const promptHeaderTone = "border-pink-200 bg-pink-50 text-pink-700 dark:border-pink-900/70 dark:bg-pink-950/40 dark:text-pink-300";
+
if (!isFetched || (!(data as any)?.promptId && isLoading)) {
return (
- <div className="flex flex-col w-full h-full overflow-hidden gap-6 items-center justify-center">
- <div className="h-4 w-1/5 bg-secondary/[0.9] rounded" />
- <div className="h-4 w-3/5 bg-secondary/[0.9] rounded" />
- <div className="h-4 w-2/3 bg-secondary/[0.9] rounded" />
- <div className="h-4 w-1/3 bg-secondary/[0.9] rounded" />
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <FeaturePageHeader eyebrow="Resources" title={m.LOADING} icon={<Component className="h-4 w-4" />} tone={promptHeaderTone} />
+ <div className="flex flex-col w-full h-full overflow-hidden gap-6 items-center justify-center">
+ <div className="h-4 w-1/5 bg-secondary/[0.9] rounded" />
+ <div className="h-4 w-3/5 bg-secondary/[0.9] rounded" />
+ <div className="h-4 w-2/3 bg-secondary/[0.9] rounded" />
+ <div className="h-4 w-1/3 bg-secondary/[0.9] rounded" />
+ </div>
</div>
);
}
if (!data || !(data as any)?.promptId) {
return (
- <div className="flex w-full h-full overflow-hidden items-center justify-center text-stone-600 dark:text-stone-400">
- {m.PROMPT_HUB_NO_PROMPT_EXISTS}
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <FeaturePageHeader eyebrow="Resources" title={m.FEATURE_PROMPTS} icon={<Component className="h-4 w-4" />} tone={promptHeaderTone} />
+ <div className="flex w-full h-full overflow-hidden items-center justify-center text-stone-600 dark:text-stone-400">
+ {m.PROMPT_HUB_NO_PROMPT_EXISTS}
+ </div>
</div>
);
}
@@ -163,13 +180,16 @@ export default function PromptHub() {
!isLoading
) {
return (
- <div className="flex w-full h-full overflow-hidden items-center justify-center text-stone-600 dark:text-stone-400">
- {m.PROMPT_HUB_NO_VERSION_EXISTS}{" "}
- <span className="bg-secondary text-primary px-2 text-sm mx-3">
- {" "}
- {(data as any).name}{" "}
- </span>{" "}
- {m.PROMPT_HUB_EXISTS}
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <FeaturePageHeader eyebrow="Resources" title={m.FEATURE_PROMPTS} icon={<Component className="h-4 w-4" />} tone={promptHeaderTone} />
+ <div className="flex w-full h-full overflow-hidden items-center justify-center text-stone-600 dark:text-stone-400">
+ {m.PROMPT_HUB_NO_VERSION_EXISTS}{" "}
+ <span className="bg-secondary text-primary px-2 text-sm mx-3">
+ {" "}
+ {(data as any).name}{" "}
+ </span>{" "}
+ {m.PROMPT_HUB_EXISTS}
+ </div>
</div>
);
}
@@ -189,9 +209,16 @@ export default function PromptHub() {
const promptText = unescapeString((data as any).prompt);
return (
- <div className="flex flex-col w-full h-full gap-4">
- <PromptHubHeader />
- <div className="grid grid-cols-3 w-full h-full overflow-hidden gap-4">
+ <div className="flex flex-col w-full h-full">
+ <PromptHubHeader createNew={false} title={`Prompt : ${data.name}`} promptUsage={false} extraButtons={(
+ <>
+ <Button variant="outline" size="sm" className="h-8" onClick={() => router.push("/prompt-hub")}>
+ <ArrowLeftIcon className="mr-1.5 size-3.5" />
+ {getMessage().BACK}
+ </Button>
+ </>
+ )} />
+ <div className="grid grid-cols-3 w-full h-full overflow-hidden gap-4 p-4">
{/* Left: prompt details */}
<Card className="grow col-span-2 overflow-hidden flex flex-col border border-stone-200 dark:border-stone-800">
<CardHeader className="p-4 border-b border-stone-200 dark:border-stone-800">
diff --git a/src/client/src/app/(playground)/prompt-hub/new/page.tsx b/src/client/src/app/(playground)/prompt-hub/new/page.tsx
index fbe5448c..84dbfb6b 100644
--- a/src/client/src/app/(playground)/prompt-hub/new/page.tsx
+++ b/src/client/src/app/(playground)/prompt-hub/new/page.tsx
@@ -13,11 +13,11 @@ import getMessage from "@/constants/messages";
import { usePageHeader } from "@/selectors/page";
import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
import { ArrowLeftIcon, PlusIcon, XIcon } from "lucide-react";
-import Link from "next/link";
import { useRouter } from "next/navigation";
import { usePostHog } from "posthog-js/react";
import { KeyboardEvent, useCallback, useEffect, useState } from "react";
import { toast } from "sonner";
+import PromptHubHeader from "@/components/(playground)/prompt-hub/header";
const m = getMessage();
@@ -77,9 +77,9 @@ export default function NewPromptPage() {
useEffect(() => {
setHeader({
title: m.PROMPT_HUB_CREATE_PROMPT,
- breadcrumbs: [{ title: m.PROMPT_HUB, href: "/prompt-hub" }],
+ breadcrumbs: [],
});
- }, []);
+ }, [setHeader]);
const addTag = useCallback(() => {
const val = tagInput.trim();
@@ -146,27 +146,26 @@ export default function NewPromptPage() {
}, [name, promptText, tags, metaProps, selectedVersion]);
return (
- <div className="flex flex-col w-full h-full gap-4 overflow-hidden">
- {/* Topbar */}
- <div className="flex items-center justify-between flex-shrink-0">
- <Link
- href="/prompt-hub"
- className="flex items-center gap-1.5 text-sm text-stone-500 dark:text-stone-400 hover:text-stone-800 dark:hover:text-stone-200 transition-colors"
- >
- <ArrowLeftIcon className="w-4 h-4" />
- {m.PROMPT_HUB_BACK}
- </Link>
- <Button
- onClick={handleSubmit}
- disabled={isLoading}
- className={isLoading ? "animate-pulse" : ""}
- >
- {m.PROMPT_HUB_SAVE}
- </Button>
- </div>
+ <div className="flex flex-col w-full h-full overflow-hidden">
+ <PromptHubHeader createNew={false} promptUsage={false} extraButtons={(
+ <>
+ <Button variant="outline" size="sm" className="h-8" onClick={() => router.push("/prompt-hub")}>
+ <ArrowLeftIcon className="mr-1.5 size-3.5" />
+ {getMessage().BACK}
+ </Button>
+ <Button
+ onClick={handleSubmit}
+ disabled={isLoading}
+ size={"sm"}
+ className={`${isLoading ? "animate-pulse" : ""} h-8`}
+ >
+ {m.PROMPT_HUB_SAVE}
+ </Button>
+ </>
+ )} />
{/* Body */}
- <div className="grid grid-cols-3 gap-4 flex-1 overflow-hidden">
+ <div className="grid grid-cols-3 gap-4 flex-1 overflow-hidden p-4">
{/* Left: name + markdown editor */}
<Card className="col-span-2 flex flex-col overflow-hidden border border-stone-200 dark:border-stone-800">
<CardContent className="flex flex-col gap-4 p-4 flex-1 overflow-hidden">
diff --git a/src/client/src/app/(playground)/prompt-hub/page.tsx b/src/client/src/app/(playground)/prompt-hub/page.tsx
index c2cccb4a..a5cb8f51 100644
--- a/src/client/src/app/(playground)/prompt-hub/page.tsx
+++ b/src/client/src/app/(playground)/prompt-hub/page.tsx
@@ -140,26 +140,28 @@ export default function PromptHub() {
}
return (
- <div className="flex flex-col w-full h-full gap-4">
+ <div className="flex flex-col w-full h-full">
<PromptHubHeader createNew />
- <DataTable
- columns={columns}
- data={data || []}
- isFetched={isFetched || pingStatus === "failure"}
- isLoading={isLoading || isDeleting}
- visibilityColumns={{
- name: true,
- createdBy: true,
- latestVersion: true,
- downloads: true,
- lastReleasedOn: true,
- actions: true,
- }}
- onClick={(row: PromptList) => router.push(`/prompt-hub/${row.promptId}`)}
- extraFunctions={{
- handleDelete: deletePrompt,
- }}
- />
+ <div className="flex flex-col w-full h-full p-4">
+ <DataTable
+ columns={columns}
+ data={data || []}
+ isFetched={isFetched || pingStatus === "failure"}
+ isLoading={isLoading || isDeleting}
+ visibilityColumns={{
+ name: true,
+ createdBy: true,
+ latestVersion: true,
+ downloads: true,
+ lastReleasedOn: true,
+ actions: true,
+ }}
+ onClick={(row: PromptList) => router.push(`/prompt-hub/${row.promptId}`)}
+ extraFunctions={{
+ handleDelete: deletePrompt,
+ }}
+ />
+ </div>
</div>
);
}
diff --git a/src/client/src/app/(playground)/rule-engine/[id]/page.tsx b/src/client/src/app/(playground)/rule-engine/[id]/page.tsx
index f586feab..c05494dc 100644
--- a/src/client/src/app/(playground)/rule-engine/[id]/page.tsx
+++ b/src/client/src/app/(playground)/rule-engine/[id]/page.tsx
@@ -4,7 +4,8 @@ import { usePostHog } from "posthog-js/react";
import { CLIENT_EVENTS } from "@/constants/events";
import { useParams } from "next/navigation";
import { toast } from "sonner";
-import { CheckIcon } from "lucide-react";
+import { ArrowLeftIcon, CheckIcon, SlidersHorizontal } from "lucide-react";
+import FeaturePageHeader from "@/components/(playground)/feature-page-header";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
@@ -19,6 +20,7 @@ import RulePreviewSection from "@/components/(playground)/rule-engine/rule-previ
import RuleEntitiesCard from "@/components/(playground)/rule-engine/rule-entities-card";
import { usePageHeader } from "@/selectors/page";
import getMessage from "@/constants/messages";
+import { useRouter } from "next/navigation";
type RuleDetail = Rule & { condition_groups?: RuleConditionGroup[] };
@@ -35,6 +37,7 @@ const DEFAULT_CONDITION_GROUP: ConditionGroupState = {
};
export default function RuleDetailPage() {
+ const router = useRouter()
const posthog = usePostHog();
const params = useParams();
const ruleId = params.id as string;
@@ -71,9 +74,7 @@ export default function RuleDetailPage() {
});
setHeader({
title: data.name,
- breadcrumbs: [
- { title: messages.RULE_ENGINE_BREADCRUMB, href: "/rule-engine" },
- ],
+ breadcrumbs: [],
});
const groups: ConditionGroupState[] = (data.condition_groups || []).map(
(g: any) => ({
@@ -166,12 +167,17 @@ export default function RuleDetailPage() {
});
}, [ruleId, conditionGroups]);
+ const ruleHeaderTone = "border-purple-200 bg-purple-50 text-purple-700 dark:border-purple-900/70 dark:bg-purple-950/40 dark:text-purple-300";
+
if (isLoading && !rule) {
return (
- <div className="flex flex-col w-full h-full overflow-hidden gap-4 items-center justify-center">
- <div className="h-4 w-1/5 bg-stone-200 dark:bg-stone-700 rounded animate-pulse" />
- <div className="h-4 w-3/5 bg-stone-200 dark:bg-stone-700 rounded animate-pulse" />
- <div className="h-4 w-2/3 bg-stone-200 dark:bg-stone-700 rounded animate-pulse" />
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <FeaturePageHeader eyebrow="Resources" title={messages.LOADING} icon={<SlidersHorizontal className="h-4 w-4" />} tone={ruleHeaderTone} />
+ <div className="flex flex-col w-full h-full overflow-hidden gap-4 items-center justify-center">
+ <div className="h-4 w-1/5 bg-stone-200 dark:bg-stone-700 rounded animate-pulse" />
+ <div className="h-4 w-3/5 bg-stone-200 dark:bg-stone-700 rounded animate-pulse" />
+ <div className="h-4 w-2/3 bg-stone-200 dark:bg-stone-700 rounded animate-pulse" />
+ </div>
</div>
);
}
@@ -181,51 +187,59 @@ export default function RuleDetailPage() {
const r = rule as any;
return (
- <div className="grid grid-cols-3 w-full h-full overflow-hidden gap-4">
- {/* Left: Rule info + condition builder */}
- <Card className="col-span-2 overflow-hidden flex flex-col border border-stone-200 dark:border-stone-800">
- <CardHeader className="p-4 pb-3 border-b border-stone-100 dark:border-stone-800">
- <RuleInfoSection
- rule={r}
- isEditing={isEditingInfo}
- editValues={editValues}
- isSaving={isUpdating}
- onChange={handleInfoChange}
- onEdit={handleInfoEdit}
- onCancel={handleInfoCancel}
- onSave={handleInfoSave}
- />
- </CardHeader>
-
- <CardContent className="flex flex-col gap-5 p-4 overflow-y-auto scrollbar-hidden flex-1">
- <div className="flex flex-col gap-3">
- <div className="flex items-center justify-between">
- <CardTitle className="text-sm font-semibold text-stone-700 dark:text-stone-300">
- {messages.RULE_CONDITION_GROUPS_TITLE}
- </CardTitle>
- <Button
- size="sm"
- onClick={saveConditions}
- disabled={isSavingConditions}
- className={`h-7 text-xs ${isSavingConditions ? "animate-pulse" : ""}`}
- >
- <CheckIcon className="w-3 h-3 mr-1" />
- {messages.RULE_SAVE_CONDITIONS}
- </Button>
- </div>
- <ConditionBuilder
- groups={conditionGroups}
- onChange={setConditionGroups}
- groupOperator={editValues.groupOperator}
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <FeaturePageHeader eyebrow="Resources" title={r.name} icon={<SlidersHorizontal className="h-4 w-4" />} tone={ruleHeaderTone} actions={(
+ <Button variant="outline" size="sm" className="h-8" onClick={() => router.push("/rule-engine")}>
+ <ArrowLeftIcon className="mr-1.5 size-3.5" />
+ {getMessage().BACK}
+ </Button>
+ )} />
+ <div className="grid grid-cols-3 w-full h-full overflow-hidden gap-4 p-4">
+ {/* Left: Rule info + condition builder */}
+ <Card className="col-span-2 overflow-hidden flex flex-col border border-stone-200 dark:border-stone-800">
+ <CardHeader className="p-4 pb-3 border-b border-stone-100 dark:border-stone-800">
+ <RuleInfoSection
+ rule={r}
+ isEditing={isEditingInfo}
+ editValues={editValues}
+ isSaving={isUpdating}
+ onChange={handleInfoChange}
+ onEdit={handleInfoEdit}
+ onCancel={handleInfoCancel}
+ onSave={handleInfoSave}
/>
- </div>
- </CardContent>
- </Card>
-
- {/* Right: Preview + Entities */}
- <div className="grid grid-flow-row grid-rows-2 gap-4 overflow-hidden scrollbar-hidden">
- <RulePreviewSection ruleId={ruleId} />
- <RuleEntitiesCard ruleId={ruleId} />
+ </CardHeader>
+
+ <CardContent className="flex flex-col gap-5 p-4 overflow-y-auto scrollbar-hidden flex-1">
+ <div className="flex flex-col gap-3">
+ <div className="flex items-center justify-between">
+ <CardTitle className="text-sm font-semibold text-stone-700 dark:text-stone-300">
+ {messages.RULE_CONDITION_GROUPS_TITLE}
+ </CardTitle>
+ <Button
+ size="sm"
+ onClick={saveConditions}
+ disabled={isSavingConditions}
+ className={`h-7 text-xs ${isSavingConditions ? "animate-pulse" : ""}`}
+ >
+ <CheckIcon className="w-3 h-3 mr-1" />
+ {messages.RULE_SAVE_CONDITIONS}
+ </Button>
+ </div>
+ <ConditionBuilder
+ groups={conditionGroups}
+ onChange={setConditionGroups}
+ groupOperator={editValues.groupOperator}
+ />
+ </div>
+ </CardContent>
+ </Card>
+
+ {/* Right: Preview + Entities */}
+ <div className="grid grid-flow-row grid-rows-2 gap-4 overflow-hidden scrollbar-hidden">
+ <RulePreviewSection ruleId={ruleId} />
+ <RuleEntitiesCard ruleId={ruleId} />
+ </div>
</div>
</div>
);
diff --git a/src/client/src/app/(playground)/rule-engine/page.tsx b/src/client/src/app/(playground)/rule-engine/page.tsx
index 51beee8a..ee3f094d 100644
--- a/src/client/src/app/(playground)/rule-engine/page.tsx
+++ b/src/client/src/app/(playground)/rule-engine/page.tsx
@@ -138,28 +138,30 @@ export default function RuleEnginePage() {
}, [pingStatus]);
return (
- <div className="flex flex-col w-full h-full gap-4">
+ <div className="flex flex-col w-full h-full">
<RuleEngineHeader successCallback={fetchData} />
- <DataTable
- columns={columns}
- data={data || []}
- isFetched={isFetched || pingStatus === "failure"}
- isLoading={isLoading || isDeleting}
- visibilityColumns={{
- name: true,
- description: true,
- groupOperator: true,
- status: true,
- createdBy: true,
- createdAt: true,
- actions: true,
- }}
- onClick={(row: Rule) => router.push(`/rule-engine/${row.id}`)}
- extraFunctions={{
- handleDelete: deleteRule,
- successCallback: fetchData,
- }}
- />
+ <div className="flex flex-col w-full h-full p-4">
+ <DataTable
+ columns={columns}
+ data={data || []}
+ isFetched={isFetched || pingStatus === "failure"}
+ isLoading={isLoading || isDeleting}
+ visibilityColumns={{
+ name: true,
+ description: true,
+ groupOperator: true,
+ status: true,
+ createdBy: true,
+ createdAt: true,
+ actions: true,
+ }}
+ onClick={(row: Rule) => router.push(`/rule-engine/${row.id}`)}
+ extraFunctions={{
+ handleDelete: deleteRule,
+ successCallback: fetchData,
+ }}
+ />
+ </div>
</div>
);
}
diff --git a/src/client/src/app/(playground)/settings/api-keys/page.tsx b/src/client/src/app/(playground)/settings/api-keys/page.tsx
index 0da29720..9f568e5a 100644
--- a/src/client/src/app/(playground)/settings/api-keys/page.tsx
+++ b/src/client/src/app/(playground)/settings/api-keys/page.tsx
@@ -3,9 +3,6 @@ import { useEffect } from "react";
import { usePostHog } from "posthog-js/react";
import { CLIENT_EVENTS } from "@/constants/events";
import ManageKeys from "@/components/(playground)/api-keys/manage";
-import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
-import { Key, Shield, RotateCcw, Trash2 } from "lucide-react";
-import FeaturePageHeader from "@/components/(playground)/feature-page-header";
export default function APIKeys() {
const posthog = usePostHog();
@@ -17,35 +14,7 @@ export default function APIKeys() {
return (
<div className="flex w-full flex-1 overflow-hidden">
<div className="flex flex-col grow w-full rounded overflow-auto text-sm text-stone-900 dark:text-stone-300 gap-4">
- <FeaturePageHeader
- eyebrow="Settings"
- title="API Keys"
- description="Create scoped credentials for integrations while keeping secrets rotated, revocable, and under your control."
- icon={<Key className="h-4 w-4" />}
- tone="border-primary/20 bg-primary/10 text-primary dark:border-primary/30 dark:bg-primary/15"
- />
- <Alert className="border-amber-200 bg-amber-50/70 py-3 text-stone-700 dark:border-amber-900/60 dark:bg-amber-950/20 dark:text-stone-300">
- <Shield className="h-4 w-4 stroke-amber-700 dark:stroke-amber-300" />
- <AlertTitle className="text-sm font-semibold text-stone-900 dark:text-stone-100">
- Important notice
- </AlertTitle>
- <AlertDescription className="mt-1">
- <div className="grid gap-2 text-xs leading-relaxed text-stone-600 dark:text-stone-400 md:grid-cols-3">
- <div className="flex items-start gap-2">
- <Key className="mt-0.5 h-3.5 w-3.5 shrink-0" />
- <span>Secret keys are shown only once after generation.</span>
- </div>
- <div className="flex items-start gap-2">
- <RotateCcw className="mt-0.5 h-3.5 w-3.5 shrink-0" />
- <span>Rotate keys periodically and after team changes.</span>
- </div>
- <div className="flex items-start gap-2">
- <Trash2 className="mt-0.5 h-3.5 w-3.5 shrink-0" />
- <span>Revoke unused or exposed keys immediately.</span>
- </div>
- </div>
- </AlertDescription>
- </Alert>
+
<ManageKeys />
</div>
</div>
diff --git a/src/client/src/app/(playground)/settings/layout.tsx b/src/client/src/app/(playground)/settings/layout.tsx
index 001c5139..2cecbbe0 100644
--- a/src/client/src/app/(playground)/settings/layout.tsx
+++ b/src/client/src/app/(playground)/settings/layout.tsx
@@ -7,7 +7,7 @@ export default function SettingsLayout({
children: React.ReactNode;
}) {
return (
- <div className={`flex h-full w-full grow overflow-hidden rounded-lg `}>
+ <div className="flex h-full w-full grow overflow-hidden">
{children}
</div>
);
diff --git a/src/client/src/app/(playground)/settings/profile/page.tsx b/src/client/src/app/(playground)/settings/profile/page.tsx
index 2d84a331..8950e549 100644
--- a/src/client/src/app/(playground)/settings/profile/page.tsx
+++ b/src/client/src/app/(playground)/settings/profile/page.tsx
@@ -158,10 +158,12 @@ export default function Profile() {
};
return (
- <div className="flex flex-1 h-full w-full flex-col gap-4 overflow-auto">
- <FeaturePageHeader eyebrow="Settings" title="User Profile" description="Keep your identity, password, and workspace access details current across OpenLIT." icon={<UserIcon className="h-4 w-4" />} tone="border-primary/20 bg-primary/10 text-primary dark:border-primary/30 dark:bg-primary/15" />
- <div className={`flex w-full h-full ${PRIMARY_BACKGROUND}`}>
- <ModifyProfileDetails user={userDetails as User} fetchUser={fetchUser} />
+ <div className="flex flex-1 h-full w-full flex-col">
+ <FeaturePageHeader eyebrow="Settings" title="User Profile" icon={<UserIcon className="h-4 w-4" />} tone="border-primary/20 bg-primary/10 text-primary dark:border-primary/30 dark:bg-primary/15" />
+ <div className={`flex w-full h-full p-4`}>
+ <div className={`flex flex-col w-full h-full ${PRIMARY_BACKGROUND} rounded-md`}>
+ <ModifyProfileDetails user={userDetails as User} fetchUser={fetchUser} />
+ </div>
</div>
</div>
);
diff --git a/src/client/src/app/(playground)/telemetry/page.tsx b/src/client/src/app/(playground)/telemetry/page.tsx
index e2f53ed2..ce832b54 100644
--- a/src/client/src/app/(playground)/telemetry/page.tsx
+++ b/src/client/src/app/(playground)/telemetry/page.tsx
@@ -12,6 +12,7 @@ import { stripFilterParams } from "@/helpers/client/filter-persistence";
import { prepareObservabilitySignalChange } from "@/helpers/client/observability";
import { getUpdateConfig, getUpdateFilter } from "@/selectors/filter";
import { useRootStore } from "@/store";
+import FeaturePageHeader from "@/components/(playground)/feature-page-header";
export default function TelemetryPage() {
const searchParams = useSearchParams();
@@ -55,24 +56,13 @@ export default function TelemetryPage() {
};
return (
- <div className="flex h-full w-full flex-col gap-4 overflow-hidden">
- <section className="rounded-md border border-stone-200 bg-white px-3 py-2 dark:border-stone-800 dark:bg-stone-950">
- <div className="flex flex-col gap-2 xl:flex-row xl:items-center xl:justify-between">
- <div className="min-w-0">
- <div className="flex items-center gap-2">
- <span className={`rounded-md border p-1.5 ${activeConfig.tone}`}>
- <ActiveIcon className="h-4 w-4" />
- </span>
- <div>
- <p className="text-[11px] uppercase tracking-wide text-stone-500 dark:text-stone-400">
- Telemetry
- </p>
- <h1 className="text-base font-semibold text-stone-950 dark:text-stone-50">
- {activeConfig.label}
- </h1>
- </div>
- </div>
- </div>
+ <div className="flex h-full w-full flex-col overflow-hidden">
+ <FeaturePageHeader
+ eyebrow={"Telemetry"}
+ title={activeConfig.label}
+ icon={<ActiveIcon className="h-4 w-4" />}
+ tone={`rounded-md border p-1.5 ${activeConfig.tone}`}
+ actions={(
<div className="grid grid-cols-2 gap-2 md:flex md:flex-wrap md:justify-end">
{/* The Coding Sessions + Coding Users signal
configs stay registered (the per-vendor
@@ -94,11 +84,10 @@ export default function TelemetryPage() {
<button
key={signal.key}
onClick={() => onTabChange(signal.key)}
- className={`inline-flex items-center gap-2 rounded-md border px-2.5 py-1.5 text-xs transition ${
- isActive
+ className={`inline-flex items-center gap-2 rounded-md border px-2.5 py-1.5 text-xs transition ${isActive
? signal.tone
: "border-stone-200 bg-stone-50 text-stone-600 hover:bg-stone-100 dark:border-stone-800 dark:bg-stone-900 dark:text-stone-300 dark:hover:bg-stone-800"
- }`}
+ }`}
>
<Icon className="h-4 w-4" />
<span className="font-medium">{signal.label}</span>
@@ -106,9 +95,9 @@ export default function TelemetryPage() {
);
})}
</div>
- </div>
- </section>
- <section className="min-h-0 flex-1 overflow-auto rounded-md border border-stone-200 bg-white p-4 dark:border-stone-800 dark:bg-stone-950">
+ )}
+ />
+ <section className="min-h-0 flex-1 overflow-auto bg-white p-4 dark:bg-stone-950">
<ObservabilitySignalList key={activeConfig.key} config={activeConfig} />
</section>
</div>
diff --git a/src/client/src/app/(playground)/vault/page.tsx b/src/client/src/app/(playground)/vault/page.tsx
index e150c95e..df377683 100644
--- a/src/client/src/app/(playground)/vault/page.tsx
+++ b/src/client/src/app/(playground)/vault/page.tsx
@@ -117,24 +117,26 @@ export default function Vault() {
}
return (
- <div className="flex flex-col w-full h-full gap-4">
+ <div className="flex flex-col w-full h-full">
<VaultHeader successCallback={fetchData} />
- <DataTable
- columns={columns}
- data={data || []}
- isFetched={isFetched || pingStatus === "failure"}
- isLoading={isLoading || isDeleting}
- visibilityColumns={{
- key: true,
- createdBy: true,
- updatedAt: true,
- actions: true
- }}
- extraFunctions={{
- handleDelete: deleteSecret,
- successCallback: fetchData,
- }}
- />
+ <div className="flex flex-col w-full h-full p-4">
+ <DataTable
+ columns={columns}
+ data={data || []}
+ isFetched={isFetched || pingStatus === "failure"}
+ isLoading={isLoading || isDeleting}
+ visibilityColumns={{
+ key: true,
+ createdBy: true,
+ updatedAt: true,
+ actions: true
+ }}
+ extraFunctions={{
+ handleDelete: deleteSecret,
+ successCallback: fetchData,
+ }}
+ />
+ </div>
</div>
);
}
diff --git a/src/client/src/components/(playground)/api-keys/generate.tsx b/src/client/src/components/(playground)/api-keys/generate.tsx
index 53b84be9..1356ae8f 100644
--- a/src/client/src/components/(playground)/api-keys/generate.tsx
+++ b/src/client/src/components/(playground)/api-keys/generate.tsx
@@ -77,7 +77,7 @@ export default function Generate({ refresh }: { refresh: () => void }) {
<DialogTrigger asChild>
<Button
variant="secondary"
- className="bg-primary hover:bg-primary dark:bg-primary dark:hover:bg-primary text-stone-100 dark:text-stone-100 px-8 py-1 h-8 self-end"
+ className="bg-primary hover:bg-primary dark:bg-primary dark:hover:bg-primary text-stone-100 dark:text-stone-100 px-8 h-8 self-end"
>
Generate New API Key
</Button>
diff --git a/src/client/src/components/(playground)/api-keys/manage.tsx b/src/client/src/components/(playground)/api-keys/manage.tsx
index 51b5e6c3..2c2670db 100644
--- a/src/client/src/components/(playground)/api-keys/manage.tsx
+++ b/src/client/src/components/(playground)/api-keys/manage.tsx
@@ -14,6 +14,9 @@ import { ApiKey } from "@/types/api-key";
import { Columns } from "@/components/data-table/columns";
import DataTable from "@/components/data-table/table";
import { escapeEmailForDisplay } from "@/utils/string";
+import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
+import { Key, Shield, RotateCcw, Trash2 } from "lucide-react";
+import FeaturePageHeader from "@/components/(playground)/feature-page-header";
const columns: Columns<string, ApiKey> = {
name: {
@@ -114,24 +117,54 @@ export default function ManageKeys() {
);
return (
- <div className="flex flex-col grow w-full gap-6 overflow-hidden">
- <Generate refresh={fetchData} />
- <DataTable
- columns={columns}
- data={data || []}
- isFetched={isFetched || pingStatus !== "pending"}
- isLoading={isLoading || pingStatus === "pending"}
- visibilityColumns={{
- name: true,
- apiKey: true,
- createdBy: true,
- createdAt: true,
- actions: true,
- }}
- extraFunctions={{
- handleYes,
- }}
+ <div className="flex flex-col grow w-full overflow-hidden">
+ <FeaturePageHeader
+ eyebrow="Settings"
+ title="API Keys"
+ icon={<Key className="h-4 w-4" />}
+ tone="border-primary/20 bg-primary/10 text-primary dark:border-primary/30 dark:bg-primary/15"
+ actions={<Generate refresh={fetchData} />}
/>
+ <div className="flex flex-col w-full h-full p-4 gap-4">
+ <Alert className="border-amber-200 bg-amber-50/70 py-3 text-stone-700 dark:border-amber-900/60 dark:bg-amber-950/20 dark:text-stone-300">
+ <Shield className="h-4 w-4 stroke-amber-700 dark:stroke-amber-300" />
+ <AlertTitle className="text-sm font-semibold text-stone-900 dark:text-stone-100">
+ Important notice
+ </AlertTitle>
+ <AlertDescription className="mt-1">
+ <div className="grid gap-2 text-xs leading-relaxed text-stone-600 dark:text-stone-400 md:grid-cols-3">
+ <div className="flex items-start gap-2">
+ <Key className="mt-0.5 h-3.5 w-3.5 shrink-0" />
+ <span>Secret keys are shown only once after generation.</span>
+ </div>
+ <div className="flex items-start gap-2">
+ <RotateCcw className="mt-0.5 h-3.5 w-3.5 shrink-0" />
+ <span>Rotate keys periodically and after team changes.</span>
+ </div>
+ <div className="flex items-start gap-2">
+ <Trash2 className="mt-0.5 h-3.5 w-3.5 shrink-0" />
+ <span>Revoke unused or exposed keys immediately.</span>
+ </div>
+ </div>
+ </AlertDescription>
+ </Alert>
+ <DataTable
+ columns={columns}
+ data={data || []}
+ isFetched={isFetched || pingStatus !== "pending"}
+ isLoading={isLoading || pingStatus === "pending"}
+ visibilityColumns={{
+ name: true,
+ apiKey: true,
+ createdBy: true,
+ createdAt: true,
+ actions: true,
+ }}
+ extraFunctions={{
+ handleYes,
+ }}
+ />
+ </div>
</div>
);
}
diff --git a/src/client/src/components/(playground)/chat/chat-layout.tsx b/src/client/src/components/(playground)/chat/chat-layout.tsx
index 2f12ca86..08baabb9 100644
--- a/src/client/src/components/(playground)/chat/chat-layout.tsx
+++ b/src/client/src/components/(playground)/chat/chat-layout.tsx
@@ -135,7 +135,7 @@ export default function ChatLayout({ initialConversationId, initialView = "chat"
}, [addConversation, navigateTo, m, configInfo]);
return (
- <Card className="flex h-full w-full overflow-hidden border border-stone-200 dark:border-stone-800">
+ <div className="flex h-full w-full overflow-hidden">
<div className="flex-1 min-w-0 bg-white dark:bg-stone-950">
{initialView === "usage" ? (
<OtterUsageView />
@@ -151,6 +151,6 @@ export default function ChatLayout({ initialConversationId, initialView = "chat"
)}
</div>
<TraceDetailRequestSheet />
- </Card>
+ </div>
);
}
diff --git a/src/client/src/components/(playground)/chat/chat-settings-form.tsx b/src/client/src/components/(playground)/chat/chat-settings-form.tsx
index af51a893..44888426 100644
--- a/src/client/src/components/(playground)/chat/chat-settings-form.tsx
+++ b/src/client/src/components/(playground)/chat/chat-settings-form.tsx
@@ -18,6 +18,7 @@ import {
} from "@/components/ui/tooltip";
import getMessage from "@/constants/messages";
import SecretForm from "@/components/(playground)/vault/form";
+import FeaturePageHeader from "@/components/(playground)/feature-page-header";
interface ModelMetadata {
id: string;
@@ -125,8 +126,16 @@ export default function ChatSettingsForm() {
if (loading) {
return (
- <div className="flex items-center justify-center py-12">
- <Loader2 className="h-6 w-6 animate-spin text-stone-400" />
+ <div className="flex flex-col w-full h-full">
+ <FeaturePageHeader
+ eyebrow={m.CHAT_SETTINGS_TITLE}
+ title={m.CHAT_SETTINGS_DESCRIPTION}
+ icon={<Settings className="h-4 w-4" />}
+ tone="border-primary/20 bg-primary/10 text-primary dark:border-primary/30 dark:bg-primary/15"
+ />
+ <div className="flex flex-col w-full h-full items-center justify-center">
+ <Loader2 className="h-6 w-6 animate-spin text-stone-400" />
+ </div>
</div>
);
}
@@ -138,26 +147,21 @@ export default function ChatSettingsForm() {
return (
<div className="flex h-full flex-col bg-white dark:bg-stone-950">
- <div className="flex shrink-0 items-center justify-between gap-3 border-b border-stone-200 bg-stone-50 px-4 py-3 dark:border-stone-800 dark:bg-stone-900">
- <div className="min-w-0">
- <div className="flex items-center gap-2 text-sm font-semibold text-stone-900 dark:text-stone-100">
- <Settings className="h-4 w-4 text-primary" />
- {m.CHAT_SETTINGS_TITLE}
- </div>
- <div className="mt-0.5 text-xs text-stone-500 dark:text-stone-400">
- {m.CHAT_SETTINGS_DESCRIPTION}
- </div>
- </div>
- {hasExistingConfig && (
+ <FeaturePageHeader
+ eyebrow={m.CHAT_SETTINGS_TITLE}
+ title={m.CHAT_SETTINGS_DESCRIPTION}
+ icon={<Settings className="h-4 w-4" />}
+ tone="border-primary/20 bg-primary/10 text-primary dark:border-primary/30 dark:bg-primary/15"
+ actions={hasExistingConfig && (
<div className="flex min-w-0 shrink-0 items-center gap-1.5 rounded-md border border-stone-200 bg-white px-2 py-1 dark:border-stone-800 dark:bg-stone-950">
<CheckCircle className="h-3 w-3 shrink-0 text-green-600 dark:text-green-400" />
- <div className="min-w-0">
- <div className="text-[11px] font-medium leading-4 text-stone-900 dark:text-stone-100">
+ <div className="flex gap-4 items-center min-w-0">
+ <span className="text-[11px] font-medium leading-4 text-stone-900 dark:text-stone-100">
{m.CONFIGURED}
- </div>
- <div className="max-w-[260px] truncate text-[10px] leading-3 text-stone-500 dark:text-stone-400">
+ </span>
+ <span className="max-w-[260px] truncate text-[10px] leading-3 text-stone-500 dark:text-stone-400">
{selectedProviderName || provider} / {selectedModelName || model} / {selectedVaultName || vaultId}
- </div>
+ </span>
</div>
<Tooltip>
<TooltipTrigger asChild>
@@ -184,124 +188,123 @@ export default function ChatSettingsForm() {
</Tooltip>
</div>
)}
- </div>
-
+ />
<div className="min-h-0 flex-1 overflow-auto px-4 py-4">
<div className="max-w-lg space-y-6">
<div className="space-y-2">
- <label className="text-sm font-medium text-stone-700 dark:text-stone-300">
- {m.CHAT_SETTINGS_PROVIDER_LABEL}
- </label>
- <Select value={provider} onValueChange={handleProviderChange}>
- <SelectTrigger className="bg-white dark:bg-stone-900">
- <SelectValue placeholder={m.CHAT_SETTINGS_PROVIDER_PLACEHOLDER} />
- </SelectTrigger>
- <SelectContent>
- {providers.map((p) => (
- <SelectItem key={p.providerId} value={p.providerId}>
- {p.displayName}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </div>
-
- <div className="space-y-2">
- <label className="text-sm font-medium text-stone-700 dark:text-stone-300">
- {m.CHAT_SETTINGS_MODEL_LABEL}
- </label>
- <Select value={model} onValueChange={setModel} disabled={!provider}>
- <SelectTrigger className="bg-white dark:bg-stone-900">
- <SelectValue
- placeholder={
- provider
- ? m.CHAT_SETTINGS_MODEL_PLACEHOLDER
- : m.CHAT_SETTINGS_SELECT_PROVIDER_FIRST
- }
- />
- </SelectTrigger>
- <SelectContent>
- {availableModels.map((md) => (
- <SelectItem key={md.id} value={md.id}>
- {md.displayName}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <p className="text-xs text-stone-400 dark:text-stone-500">
- {m.CHAT_SETTINGS_MODEL_HINT}{" "}
- <a
- href="/manage-models"
- className="underline hover:text-stone-600 dark:hover:text-stone-300"
- >
- {m.CHAT_SETTINGS_MANAGE_MODELS}
- </a>
- {m.CHAT_SETTINGS_MODEL_HINT_SUFFIX}
- </p>
- </div>
+ <label className="text-sm font-medium text-stone-700 dark:text-stone-300">
+ {m.CHAT_SETTINGS_PROVIDER_LABEL}
+ </label>
+ <Select value={provider} onValueChange={handleProviderChange}>
+ <SelectTrigger className="bg-white dark:bg-stone-900">
+ <SelectValue placeholder={m.CHAT_SETTINGS_PROVIDER_PLACEHOLDER} />
+ </SelectTrigger>
+ <SelectContent>
+ {providers.map((p) => (
+ <SelectItem key={p.providerId} value={p.providerId}>
+ {p.displayName}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
- <div className="space-y-2">
- <label className="text-sm font-medium text-stone-700 dark:text-stone-300">
- {m.CHAT_SETTINGS_API_KEY_LABEL}
- </label>
- <Select value={vaultId} onValueChange={setVaultId}>
- <SelectTrigger className="bg-white dark:bg-stone-900">
- <SelectValue placeholder={m.CHAT_SETTINGS_API_KEY_PLACEHOLDER} />
- </SelectTrigger>
- <SelectContent>
- {vaultSecrets.map((secret: any) => (
- <SelectItem key={secret.id} value={secret.id}>
- {secret.key}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <div className="flex flex-wrap items-center gap-1 text-xs text-stone-400 dark:text-stone-500">
- {m.CHAT_SETTINGS_API_KEY_HINT_PREFIX}{" "}
- <a
- href="/vault"
- className="underline hover:text-stone-600 dark:hover:text-stone-300"
- >
- {m.FEATURE_VAULT}
- </a>{" "}
- {m.CHAT_SETTINGS_API_KEY_HINT_SUFFIX}
- {" "}
- {m.CHAT_SETTINGS_OR}
- {" "}
- <SecretForm
- successCallback={() => {
- // Reload vault secrets after creation
- fetch("/api/vault/get", {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({}),
- })
- .then((r) => r.json())
- .then((res) => {
- const secrets = Array.isArray(res) ? res : res?.data || [];
- setVaultSecrets(secrets);
- // Auto-select the newly created secret (last one)
- if (secrets.length > 0) {
- setVaultId(secrets[secrets.length - 1].id);
+ <div className="space-y-2">
+ <label className="text-sm font-medium text-stone-700 dark:text-stone-300">
+ {m.CHAT_SETTINGS_MODEL_LABEL}
+ </label>
+ <Select value={model} onValueChange={setModel} disabled={!provider}>
+ <SelectTrigger className="bg-white dark:bg-stone-900">
+ <SelectValue
+ placeholder={
+ provider
+ ? m.CHAT_SETTINGS_MODEL_PLACEHOLDER
+ : m.CHAT_SETTINGS_SELECT_PROVIDER_FIRST
}
- })
- .catch(() => {});
- }}
- >
- <Button
- variant="ghost"
- className="py-0 h-auto px-0 text-xs text-primary hover:bg-transparent underline"
- >
- {m.EVALUATION_CREATE_NEW}
- </Button>
- </SecretForm>
- </div>
- </div>
+ />
+ </SelectTrigger>
+ <SelectContent>
+ {availableModels.map((md) => (
+ <SelectItem key={md.id} value={md.id}>
+ {md.displayName}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <p className="text-xs text-stone-400 dark:text-stone-500">
+ {m.CHAT_SETTINGS_MODEL_HINT}{" "}
+ <a
+ href="/manage-models"
+ className="underline hover:text-stone-600 dark:hover:text-stone-300"
+ >
+ {m.CHAT_SETTINGS_MANAGE_MODELS}
+ </a>
+ {m.CHAT_SETTINGS_MODEL_HINT_SUFFIX}
+ </p>
+ </div>
+
+ <div className="space-y-2">
+ <label className="text-sm font-medium text-stone-700 dark:text-stone-300">
+ {m.CHAT_SETTINGS_API_KEY_LABEL}
+ </label>
+ <Select value={vaultId} onValueChange={setVaultId}>
+ <SelectTrigger className="bg-white dark:bg-stone-900">
+ <SelectValue placeholder={m.CHAT_SETTINGS_API_KEY_PLACEHOLDER} />
+ </SelectTrigger>
+ <SelectContent>
+ {vaultSecrets.map((secret: any) => (
+ <SelectItem key={secret.id} value={secret.id}>
+ {secret.key}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <div className="flex flex-wrap items-center gap-1 text-xs text-stone-400 dark:text-stone-500">
+ {m.CHAT_SETTINGS_API_KEY_HINT_PREFIX}{" "}
+ <a
+ href="/vault"
+ className="underline hover:text-stone-600 dark:hover:text-stone-300"
+ >
+ {m.FEATURE_VAULT}
+ </a>{" "}
+ {m.CHAT_SETTINGS_API_KEY_HINT_SUFFIX}
+ {" "}
+ {m.CHAT_SETTINGS_OR}
+ {" "}
+ <SecretForm
+ successCallback={() => {
+ // Reload vault secrets after creation
+ fetch("/api/vault/get", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({}),
+ })
+ .then((r) => r.json())
+ .then((res) => {
+ const secrets = Array.isArray(res) ? res : res?.data || [];
+ setVaultSecrets(secrets);
+ // Auto-select the newly created secret (last one)
+ if (secrets.length > 0) {
+ setVaultId(secrets[secrets.length - 1].id);
+ }
+ })
+ .catch(() => { });
+ }}
+ >
+ <Button
+ variant="ghost"
+ className="py-0 h-auto px-0 text-xs text-primary hover:bg-transparent underline"
+ >
+ {m.EVALUATION_CREATE_NEW}
+ </Button>
+ </SecretForm>
+ </div>
+ </div>
- <Button onClick={handleSave} disabled={saving}>
- {saving && <Loader2 className="h-4 w-4 mr-2 animate-spin" />}
- {hasExistingConfig ? m.OPENGROUND_UPDATE_CONFIGURATION : m.CHAT_SETTINGS_SAVE}
- </Button>
+ <Button onClick={handleSave} disabled={saving}>
+ {saving && <Loader2 className="h-4 w-4 mr-2 animate-spin" />}
+ {hasExistingConfig ? m.OPENGROUND_UPDATE_CONFIGURATION : m.CHAT_SETTINGS_SAVE}
+ </Button>
</div>
</div>
</div>
diff --git a/src/client/src/components/(playground)/chat/conversation-list.tsx b/src/client/src/components/(playground)/chat/conversation-list.tsx
index 8dfe7375..ccc31f20 100644
--- a/src/client/src/components/(playground)/chat/conversation-list.tsx
+++ b/src/client/src/components/(playground)/chat/conversation-list.tsx
@@ -88,7 +88,7 @@ export default function ConversationList({
</div>
{/* Conversation list */}
- <div className="flex-1 overflow-y-auto px-3 py-2">
+ <div className="scrollbar-hidden flex-1 overflow-y-auto px-3 py-2">
{isLoading ? (
<div className="space-y-2 px-1">
{[1, 2, 3].map((i) => (
diff --git a/src/client/src/components/(playground)/chat/otter-usage-view.tsx b/src/client/src/components/(playground)/chat/otter-usage-view.tsx
index a0313f02..55682a50 100644
--- a/src/client/src/components/(playground)/chat/otter-usage-view.tsx
+++ b/src/client/src/components/(playground)/chat/otter-usage-view.tsx
@@ -9,6 +9,7 @@ import { DatePickerWithRange } from "@/components/ui/date-range-picker";
import { getTimeLimitObject, TIME_RANGE_TYPE } from "@/store/filter";
import { TIME_RANGES } from "@/types/store/filter";
import getMessage from "@/constants/messages";
+import FeaturePageHeader from "@/components/(playground)/feature-page-header";
type UsageItem = {
id: string;
@@ -191,44 +192,41 @@ export default function OtterUsageView() {
return (
<div className="flex h-full flex-col bg-white dark:bg-stone-950">
- <div className="flex shrink-0 items-center justify-between gap-3 border-b border-stone-200 bg-stone-50 px-4 py-3 dark:border-stone-800 dark:bg-stone-900">
- <div className="min-w-0">
- <div className="flex items-center gap-2 text-sm font-semibold text-stone-900 dark:text-stone-100">
- <BarChart3 className="h-4 w-4 text-primary" />
- {m.CHAT_OTTER_USAGE}
- </div>
- <div className="mt-0.5 text-xs text-stone-500 dark:text-stone-400">
- {m.CHAT_OTTER_USAGE_DESCRIPTION}
+ <FeaturePageHeader
+ eyebrow={m.CHAT_OTTER_USAGE}
+ title={m.CHAT_OTTER_USAGE_DESCRIPTION}
+ icon={<BarChart3 className="h-4 w-4" />}
+ tone="border-primary/20 bg-primary/10 text-primary dark:border-primary/30 dark:bg-primary/15"
+ actions={(
+ <div className="flex shrink-0 flex-wrap items-center justify-end gap-2">
+ <Tabs value={timeRange} onValueChange={onTimeRangeChange}>
+ <TabsList className="h-[30px] border border-stone-200 p-0 dark:border-stone-800">
+ {TIME_RANGE_TABS.map(({ key, label }) => (
+ <TabsTrigger key={key} value={key} className="py-1.5 text-xs">
+ {label}
+ </TabsTrigger>
+ ))}
+ </TabsList>
+ </Tabs>
+ {timeRange === "CUSTOM" && (
+ <DatePickerWithRange
+ selectedDate={selectedDate}
+ onCustomDateChange={onCustomDateChange}
+ />
+ )}
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={fetchUsage}
+ disabled={isLoading}
+ className="shrink-0 gap-1.5 h-8"
+ >
+ <RefreshCw className={`h-3.5 w-3.5 ${isLoading ? "animate-spin" : ""}`} />
+ {m.CHAT_REFRESH}
+ </Button>
</div>
- </div>
- <div className="flex shrink-0 flex-wrap items-center justify-end gap-2">
- <Tabs value={timeRange} onValueChange={onTimeRangeChange}>
- <TabsList className="h-[30px] border border-stone-200 p-0 dark:border-stone-800">
- {TIME_RANGE_TABS.map(({ key, label }) => (
- <TabsTrigger key={key} value={key} className="py-1.5 text-xs">
- {label}
- </TabsTrigger>
- ))}
- </TabsList>
- </Tabs>
- {timeRange === "CUSTOM" && (
- <DatePickerWithRange
- selectedDate={selectedDate}
- onCustomDateChange={onCustomDateChange}
- />
- )}
- <Button
- size="sm"
- variant="outline"
- onClick={fetchUsage}
- disabled={isLoading}
- className="shrink-0 gap-1.5"
- >
- <RefreshCw className={`h-3.5 w-3.5 ${isLoading ? "animate-spin" : ""}`} />
- {m.CHAT_REFRESH}
- </Button>
- </div>
- </div>
+ )}
+ />
<div className="min-h-0 flex-1 overflow-auto px-4 py-4">
{isLoading ? (
diff --git a/src/client/src/components/(playground)/context/header.tsx b/src/client/src/components/(playground)/context/header.tsx
index f92b0a2e..30007292 100644
--- a/src/client/src/components/(playground)/context/header.tsx
+++ b/src/client/src/components/(playground)/context/header.tsx
@@ -9,26 +9,28 @@ import { BookOpen } from "lucide-react";
export default function ContextHeader({
className = "flex w-full items-center justify-end gap-4",
+ title,
+ extraButtons,
+ createNew = true,
}: {
className?: string;
- successCallback?: () => void;
+ title?: string;
+ extraButtons?: JSX.Element;
+ createNew?: boolean;
}) {
const pingStatus = useRootStore(getPingStatus);
const m = getMessage();
+ const pageHeaderTitle = title || m.CONTEXT_TITLE;
- const actions = (
- <div className={className}>
- {pingStatus === "success" && (
- <Button
- asChild
- variant="secondary"
- className="bg-primary hover:bg-primary dark:bg-primary dark:hover:bg-primary text-stone-100 dark:text-stone-100 px-8 h-9 py-0.5"
- >
- <Link href="/context/new">{m.CONTEXT_CREATE}</Link>
- </Button>
- )}
- </div>
- );
+ const actions = pingStatus === "success" && createNew ? (
+ <Button
+ asChild
+ variant="secondary"
+ className="bg-primary hover:bg-primary dark:bg-primary dark:hover:bg-primary text-stone-100 dark:text-stone-100 px-8 h-8"
+ >
+ <Link href="/context/new">{m.CONTEXT_CREATE}</Link>
+ </Button>
+ ) : null;
- return <FeaturePageHeader eyebrow="Resources" title={m.CONTEXT_TITLE} description="Build reusable knowledge blocks that give prompts, rules, and agents the right business context at runtime." icon={<BookOpen className="h-4 w-4" />} tone="border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/70 dark:bg-blue-950/40 dark:text-blue-300" actions={actions} />;
+ return <FeaturePageHeader eyebrow="Resources" title={pageHeaderTitle} icon={<BookOpen className="h-4 w-4" />} tone="border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/70 dark:bg-blue-950/40 dark:text-blue-300" actions={<div className={className}>{extraButtons}{actions}</div>} />;
}
diff --git a/src/client/src/components/(playground)/feature-page-header.tsx b/src/client/src/components/(playground)/feature-page-header.tsx
index 15ec6125..e43c9f25 100644
--- a/src/client/src/components/(playground)/feature-page-header.tsx
+++ b/src/client/src/components/(playground)/feature-page-header.tsx
@@ -18,7 +18,7 @@ export default function FeaturePageHeader({
actions,
}: FeaturePageHeaderProps) {
return (
- <section className="rounded-md border border-stone-200 bg-white px-3 py-2 dark:border-stone-800 dark:bg-stone-950">
+ <section className="border-b border-stone-200 px-4 py-3 dark:border-stone-800">
<div className="flex flex-col gap-2 md:flex-row md:items-center md:justify-between">
<div className="min-w-0">
<div className="flex items-center gap-2">
@@ -29,7 +29,7 @@ export default function FeaturePageHeader({
<p className="text-[11px] uppercase tracking-wide text-stone-500 dark:text-stone-400">
{eyebrow}
</p>
- <h1 className="text-base font-semibold text-stone-950 dark:text-stone-50">
+ <h1 className="text-sm font-semibold leading-tight text-stone-950 dark:text-stone-50">
{title}
</h1>
{description ? (
diff --git a/src/client/src/components/(playground)/getting-started/openground/index.tsx b/src/client/src/components/(playground)/getting-started/openground/index.tsx
index 63dbf1c3..89e9a21e 100644
--- a/src/client/src/components/(playground)/getting-started/openground/index.tsx
+++ b/src/client/src/components/(playground)/getting-started/openground/index.tsx
@@ -1,6 +1,5 @@
import React from 'react';
import { Card, CardContent, CardTitle } from '@/components/ui/card';
-import OpengroundHeader from '../../openground/header';
import getMessage from '@/constants/messages';
export default function OpengroundGettingStarted() {
@@ -14,8 +13,6 @@ export default function OpengroundGettingStarted() {
{getMessage().GET_STARTED_WITH_OPENGROUND_DESCRIPTION}
</p>
- <OpengroundHeader validateResponse={false} />
-
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
{getMessage().GET_STARTED_WITH_OPENGROUND_FEATURE_DETAILS.map((item) => (
<Card className='border' key={item.title}>
diff --git a/src/client/src/components/(playground)/header-app-trail.tsx b/src/client/src/components/(playground)/header-app-trail.tsx
new file mode 100644
index 00000000..7c5e0cba
--- /dev/null
+++ b/src/client/src/components/(playground)/header-app-trail.tsx
@@ -0,0 +1,24 @@
+"use client";
+
+import Link from "next/link";
+import { usePathname } from "next/navigation";
+import { getActiveApp } from "@/utils/active-app";
+import { headerScopeTriggerClassName, HeaderScopeSeparator } from "./header-scope-pill";
+
+export default function HeaderAppTrail() {
+ const pathname = usePathname();
+ const activeApp = getActiveApp(pathname);
+
+ if (!activeApp) {
+ return null;
+ }
+
+ return (
+ <>
+ <HeaderScopeSeparator />
+ <Link href={activeApp.href} className={headerScopeTriggerClassName}>
+ <span className="min-w-0 truncate">{activeApp.title}</span>
+ </Link>
+ </>
+ );
+}
diff --git a/src/client/src/components/(playground)/header-page-trail.tsx b/src/client/src/components/(playground)/header-page-trail.tsx
new file mode 100644
index 00000000..0af016ac
--- /dev/null
+++ b/src/client/src/components/(playground)/header-page-trail.tsx
@@ -0,0 +1,60 @@
+"use client";
+
+import Link from "next/link";
+import { usePathname } from "next/navigation";
+import { useEffect } from "react";
+import { usePageHeader } from "@/selectors/page";
+import { generatePageHeader } from "@/utils/breadcrumbs";
+import { getActiveApp } from "@/utils/active-app";
+import { HeaderScopeSeparator } from "./header-scope-pill";
+
+export default function HeaderPageTrail() {
+ const pathname = usePathname();
+ const { header, setHeader } = usePageHeader();
+ const activeApp = getActiveApp(pathname);
+
+ useEffect(() => {
+ const pageHeader = generatePageHeader(pathname);
+ setHeader(pageHeader);
+ }, [pathname, setHeader]);
+
+ const breadcrumbs = header.breadcrumbs.filter(
+ (crumb) =>
+ !(
+ activeApp &&
+ (crumb.href === activeApp.href || crumb.title === activeApp.title)
+ )
+ );
+ const showTitle =
+ Boolean(header.title?.trim()) &&
+ header.title !== activeApp?.title &&
+ !breadcrumbs.some((crumb) => crumb.title === header.title);
+
+ if (breadcrumbs.length === 0 && !showTitle) {
+ return null;
+ }
+
+ return (
+ <>
+ {breadcrumbs.map(({ title, href }) => (
+ <span key={href} className="contents">
+ <HeaderScopeSeparator />
+ <Link
+ href={href}
+ className="max-w-40 truncate text-xs font-medium text-stone-500 hover:text-stone-800 dark:text-stone-400 dark:hover:text-stone-200"
+ >
+ {title}
+ </Link>
+ </span>
+ ))}
+ {showTitle ? (
+ <>
+ <HeaderScopeSeparator />
+ <span className="max-w-56 truncate text-xs font-semibold text-stone-900 dark:text-white">
+ {header.title}
+ </span>
+ </>
+ ) : null}
+ </>
+ );
+}
diff --git a/src/client/src/components/(playground)/header-project-switch.tsx b/src/client/src/components/(playground)/header-project-switch.tsx
index 3c9420dd..1ba56ca3 100644
--- a/src/client/src/components/(playground)/header-project-switch.tsx
+++ b/src/client/src/components/(playground)/header-project-switch.tsx
@@ -2,7 +2,7 @@
import { useEffect } from "react";
import { useRouter } from "next/navigation";
-import { Loader2 } from "lucide-react";
+import { Loader2, ChevronDown } from "lucide-react";
import {
DropdownMenu,
DropdownMenuCheckboxItem,
@@ -12,7 +12,6 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { Button } from "@/components/ui/button";
import { getCurrentOrganisation } from "@/selectors/organisation";
import {
getCurrentProject,
@@ -23,6 +22,7 @@ import { useRootStore } from "@/store";
import { cn } from "@/lib/utils";
import getMessage from "@/constants/messages";
import { changeActiveProject, fetchProjectList } from "@/helpers/client/project";
+import { headerScopeTriggerClassName } from "./header-scope-pill";
export default function HeaderProjectSwitch() {
const messages = getMessage();
@@ -44,19 +44,20 @@ export default function HeaderProjectSwitch() {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <Button
- variant="outline"
- className="h-9 min-w-32 max-w-56 shrink-0 justify-start overflow-hidden border-stone-200 bg-stone-100/50 px-3 py-1.5 text-left font-normal text-stone-700 hover:bg-stone-200 hover:text-stone-950 dark:border-stone-800 dark:bg-stone-900/70 dark:text-stone-200 dark:hover:bg-stone-800 dark:hover:text-white"
+ <button
+ type="button"
+ className={headerScopeTriggerClassName}
disabled={!currentOrg?.id || isLoading || projects.length === 0}
>
{isLoading ? (
- <Loader2 className="mr-2 size-3 shrink-0 animate-spin" />
+ <Loader2 className="size-3 shrink-0 animate-spin" />
) : null}
- <span className="min-w-0 truncate text-xs font-medium">
+ <span className="min-w-0 truncate">
{selectedProject?.name ||
(isLoading ? messages.LOADING_PROJECT : messages.NO_PROJECT)}
</span>
- </Button>
+ <ChevronDown className="size-3 shrink-0 opacity-50" />
+ </button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-56" side="bottom" align="start">
<DropdownMenuLabel>{messages.PROJECTS}</DropdownMenuLabel>
diff --git a/src/client/src/components/(playground)/header-scope-pill.tsx b/src/client/src/components/(playground)/header-scope-pill.tsx
new file mode 100644
index 00000000..cfa35b16
--- /dev/null
+++ b/src/client/src/components/(playground)/header-scope-pill.tsx
@@ -0,0 +1,17 @@
+import { cn } from "@/lib/utils";
+
+export const headerScopeTriggerClassName = cn(
+ "inline-flex h-auto min-w-0 max-w-52 shrink-0 items-center gap-1 border-0 bg-transparent p-0",
+ "text-xs font-medium text-stone-700 shadow-none",
+ "hover:text-stone-950 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 focus-visible:ring-offset-1 rounded-sm",
+ "disabled:pointer-events-none disabled:opacity-50",
+ "dark:text-stone-300 dark:hover:text-stone-100"
+);
+
+export function HeaderScopeSeparator() {
+ return (
+ <span className="shrink-0 px-0.5 text-xs text-stone-400 dark:text-stone-600">
+ /
+ </span>
+ );
+}
diff --git a/src/client/src/components/(playground)/header.tsx b/src/client/src/components/(playground)/header.tsx
index d3217c46..e77f89d1 100644
--- a/src/client/src/components/(playground)/header.tsx
+++ b/src/client/src/components/(playground)/header.tsx
@@ -1,42 +1,38 @@
"use client";
import { useEffect, useRef } from "react";
-import RouteBreadcrumbs from "./route-breadcrumbs";
import { usePortal } from "./header-portal";
import OrganisationSwitch from "./sidebar/organisation-switch";
import HeaderProjectSwitch from "./header-project-switch";
import DatabaseConfigSwitch from "./sidebar/database-config-switch";
+import HeaderAppTrail from "./header-app-trail";
+import HeaderPageTrail from "./header-page-trail";
+import { HeaderScopeSeparator } from "./header-scope-pill";
+import { playgroundTopBarClassName } from "./sidebar-layout-context";
-export default function Header() {
+export function HeaderContextRow() {
const { setHeaderRef } = usePortal();
- const containerRef = useRef(null);
+ const containerRef = useRef(null);
- useEffect(() => {
- if (containerRef.current) {
- setHeaderRef(containerRef.current);
- }
- }, [setHeaderRef]);
+ useEffect(() => {
+ if (containerRef.current) {
+ setHeaderRef(containerRef.current);
+ }
+ }, [setHeaderRef]);
return (
- <header className="mb-2 flex w-full flex-col gap-1.5">
- <div className="flex min-w-0 items-center gap-2">
- <OrganisationSwitch
- contentAlign="start"
- contentSide="bottom"
- className="border-stone-200 bg-stone-100/50 text-stone-700 hover:bg-stone-200 hover:text-stone-950 dark:border-stone-800 dark:bg-stone-900/70 dark:text-stone-200 dark:hover:bg-stone-800 dark:hover:text-white"
- />
- <span className="text-sm text-stone-400 dark:text-stone-600">/</span>
- <HeaderProjectSwitch />
- <span className="text-sm text-stone-400 dark:text-stone-600">/</span>
- <DatabaseConfigSwitch
- contentAlign="start"
- contentSide="bottom"
- className="border-stone-200 bg-stone-100/50 text-stone-700 hover:bg-stone-200 hover:text-stone-950 dark:border-stone-800 dark:bg-stone-900/70 dark:text-stone-200 dark:hover:bg-stone-800 dark:hover:text-white"
- />
- <div ref={containerRef} className="ml-auto flex items-center" />
- </div>
- <div className="min-w-0">
- <RouteBreadcrumbs />
- </div>
- </header>
+ <div
+ className={playgroundTopBarClassName(
+ "min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-0.5 pl-6 pr-3"
+ )}
+ >
+ <OrganisationSwitch contentAlign="start" contentSide="bottom" />
+ <HeaderScopeSeparator />
+ <HeaderProjectSwitch />
+ <HeaderScopeSeparator />
+ <DatabaseConfigSwitch contentAlign="start" contentSide="bottom" />
+ <HeaderAppTrail />
+ <HeaderPageTrail />
+ <div ref={containerRef} className="ml-auto flex items-center" />
+ </div>
);
}
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/dashboard-view.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/dashboard-view.tsx
index f9f32aca..ede84e49 100644
--- a/src/client/src/components/(playground)/manage-dashboard/board-creator/dashboard-view.tsx
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/dashboard-view.tsx
@@ -205,7 +205,7 @@ const DashboardContent: React.FC<Omit<DashboardProps, "initialConfig">> = ({
return (
<>
{(renderTitle || !readonly || headerComponent) && (
- <div className="flex items-center w-full mb-6 gap-4">
+ <div className="flex items-center w-full gap-4 px-4 pt-3 mb-4">
{renderTitle && (
<div className="flex items-center gap-2 text-stone-900 dark:text-stone-300">
<h1 className="text-2xl font-bold">{details.title}</h1>
@@ -214,9 +214,6 @@ const DashboardContent: React.FC<Omit<DashboardProps, "initialConfig">> = ({
)}
</div>
)}
- {!renderTitle && details.description && (
- <DescriptionTooltip description={details.description} className="ml-2 h-4 w-4" icon={<BookText className="text-stone-500 cursor-pointer h-5" />} />
- )}
{headerComponent}
{isEditing && (
<ActionButtons
diff --git a/src/client/src/components/(playground)/manage-dashboard/board/index.tsx b/src/client/src/components/(playground)/manage-dashboard/board/index.tsx
index bcb2838f..1f637ae3 100644
--- a/src/client/src/components/(playground)/manage-dashboard/board/index.tsx
+++ b/src/client/src/components/(playground)/manage-dashboard/board/index.tsx
@@ -7,7 +7,6 @@ import { toast } from "sonner";
import { Board } from "@/types/manage-dashboard";
import { jsonParse } from "@/utils/json";
import { useRouter } from "next/navigation";
-import Header from "../common/header";
import { useDashboardPageSearch } from "@/selectors/dashboards";
import EmptyState from "../common/empty-state";
import getMessage from "@/constants/messages";
@@ -55,9 +54,8 @@ export default function BoardList() {
});
return (
- <div className="flex flex-col gap-3 grow overflow-y-hidden">
- <Header title="Dashboard" />
- <div className="grow rounded-sm overflow-y-auto">
+ <div className="flex grow flex-col overflow-y-hidden">
+ <div className="grow overflow-y-auto rounded-sm">
{isLoading ? (
<div className="flex justify-center items-center py-8">
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
diff --git a/src/client/src/components/(playground)/manage-dashboard/common/search.tsx b/src/client/src/components/(playground)/manage-dashboard/common/search.tsx
index 32aecf8a..0f9c50a9 100644
--- a/src/client/src/components/(playground)/manage-dashboard/common/search.tsx
+++ b/src/client/src/components/(playground)/manage-dashboard/common/search.tsx
@@ -1,16 +1,22 @@
+"use client";
+
import { Input } from "@/components/ui/input";
-import { PRIMARY_BACKGROUND } from "@/constants/common-classes";
-import { useSetDashboardPageSearch } from "@/selectors/dashboards";
-import { useDashboardPageSearch } from "@/selectors/dashboards";
+import {
+ useDashboardPageSearch,
+ useSetDashboardPageSearch,
+} from "@/selectors/dashboards";
+import { cn } from "@/lib/utils";
-export default function Search() {
+export default function Search({ className }: { className?: string }) {
const pageSearch = useDashboardPageSearch();
const setPageSearch = useSetDashboardPageSearch();
- return <Input
- placeholder="Search"
- value={pageSearch}
- onChange={(e) => setPageSearch(e.target.value)}
- className={`w-[400px] ${PRIMARY_BACKGROUND}`}
- />;
-}
\ No newline at end of file
+ return (
+ <Input
+ placeholder="Search"
+ value={pageSearch}
+ onChange={(e) => setPageSearch(e.target.value)}
+ className={cn("h-8 w-48 bg-white dark:bg-stone-950", className)}
+ />
+ );
+}
diff --git a/src/client/src/components/(playground)/manage-dashboard/dashboard-header-actions-context.tsx b/src/client/src/components/(playground)/manage-dashboard/dashboard-header-actions-context.tsx
new file mode 100644
index 00000000..75e5cd77
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/dashboard-header-actions-context.tsx
@@ -0,0 +1,63 @@
+"use client";
+
+import {
+ createContext,
+ useCallback,
+ useContext,
+ useEffect,
+ useMemo,
+ useState,
+ type ReactNode,
+} from "react";
+
+export type DashboardHeaderActions = {
+ onCreate: () => void;
+ onImport?: (data: unknown) => Promise<unknown>;
+};
+
+type DashboardHeaderActionsContextValue = {
+ actions: DashboardHeaderActions | null;
+ register: (actions: DashboardHeaderActions | null) => void;
+};
+
+const DashboardHeaderActionsContext =
+ createContext<DashboardHeaderActionsContextValue | null>(null);
+
+export function DashboardHeaderActionsProvider({
+ children,
+}: {
+ children: ReactNode;
+}) {
+ const [actions, setActions] = useState<DashboardHeaderActions | null>(null);
+ const register = useCallback((next: DashboardHeaderActions | null) => {
+ setActions(next);
+ }, []);
+ const value = useMemo(() => ({ actions, register }), [actions, register]);
+
+ return (
+ <DashboardHeaderActionsContext.Provider value={value}>
+ {children}
+ </DashboardHeaderActionsContext.Provider>
+ );
+}
+
+export function useDashboardHeaderActions() {
+ const context = useContext(DashboardHeaderActionsContext);
+ if (!context) {
+ throw new Error(
+ "useDashboardHeaderActions must be used within DashboardHeaderActionsProvider"
+ );
+ }
+ return context;
+}
+
+export function useRegisterDashboardHeaderActions(
+ actions: DashboardHeaderActions | null
+) {
+ const { register } = useDashboardHeaderActions();
+
+ useEffect(() => {
+ register(actions);
+ return () => register(null);
+ }, [actions, register]);
+}
diff --git a/src/client/src/components/(playground)/manage-dashboard/dashboard-views.ts b/src/client/src/components/(playground)/manage-dashboard/dashboard-views.ts
new file mode 100644
index 00000000..00e955a1
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/dashboard-views.ts
@@ -0,0 +1,46 @@
+import {
+ ComponentIcon,
+ FolderIcon,
+ LayoutDashboardIcon,
+ type LucideIcon,
+} from "lucide-react";
+
+export type DashboardView = {
+ key: string;
+ label: string;
+ href: string;
+ icon: LucideIcon;
+ tone: string;
+};
+
+export const DASHBOARD_VIEWS: DashboardView[] = [
+ {
+ key: "explorer",
+ label: "Explorer",
+ href: "/dashboards/explorer",
+ icon: FolderIcon,
+ tone: "border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-900/70 dark:bg-orange-950/40 dark:text-orange-300",
+ },
+ {
+ key: "dashboard",
+ label: "Dashboard",
+ href: "/dashboards/dashboard",
+ icon: LayoutDashboardIcon,
+ tone: "border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-900/70 dark:bg-sky-950/40 dark:text-sky-300",
+ },
+ {
+ key: "widget",
+ label: "Widget",
+ href: "/dashboards/widget",
+ icon: ComponentIcon,
+ tone: "border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-900/70 dark:bg-violet-950/40 dark:text-violet-300",
+ },
+];
+
+export function getActiveDashboardView(pathname: string) {
+ const segment = pathname.split("/")[2];
+ if (!segment || segment === "explorer") {
+ return DASHBOARD_VIEWS[0];
+ }
+ return DASHBOARD_VIEWS.find((view) => view.key === segment) ?? DASHBOARD_VIEWS[0];
+}
diff --git a/src/client/src/components/(playground)/manage-dashboard/explorer/index.tsx b/src/client/src/components/(playground)/manage-dashboard/explorer/index.tsx
index 7b1a631f..8f1627d2 100644
--- a/src/client/src/components/(playground)/manage-dashboard/explorer/index.tsx
+++ b/src/client/src/components/(playground)/manage-dashboard/explorer/index.tsx
@@ -1,9 +1,8 @@
import { Droppable, DroppableProps } from "react-beautiful-dnd";
-import { DashboardItemType } from "@/types/manage-dashboard";
import { DashboardHeirarchy } from "@/types/manage-dashboard";
import { DropResult } from "react-beautiful-dnd";
import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
-import { useCallback, useEffect, useState } from "react";
+import { useCallback, useEffect, useMemo, useState } from "react";
import { DragDropContext } from "react-beautiful-dnd";
import { toast } from "sonner";
import EmptyState from "../common/empty-state";
@@ -11,8 +10,7 @@ import ExplorerItemRow from "./item-row";
import UpsertResourceDialog from "../common/upsert-resource-dialog";
import { jsonParse, jsonStringify } from "@/utils/json";
import { useRouter } from "next/navigation";
-import RootActions from "./root-actions";
-import Header from "../common/header";
+import { useRegisterDashboardHeaderActions } from "../dashboard-header-actions-context";
import getMessage from "@/constants/messages";
import { Button } from "@/components/ui/button";
import { usePageHeader } from "@/selectors/page";
@@ -676,13 +674,18 @@ export default function DashboardExplorer() {
[items, updateFolderRequest, updateBoardRequest, loadHierarchy]
);
+ const headerActions = useMemo(
+ () => ({
+ onCreate: () => openAddDialog(),
+ onImport: importBoardLayout,
+ }),
+ [openAddDialog, importBoardLayout]
+ );
+ useRegisterDashboardHeaderActions(headerActions);
return (
- <div className="flex flex-col gap-2 grow overflow-y-hidden">
- <Header title="Explorer">
- <RootActions openAddDialog={openAddDialog} importBoardLayout={importBoardLayout} />
- </Header>
- <div className={`grow ${PRIMARY_BACKGROUND} border border-stone-200 dark:border-stone-800 rounded-sm p-2 overflow-y-auto`}>
+ <div className="flex grow flex-col overflow-y-hidden">
+ <div className={`grow ${PRIMARY_BACKGROUND} overflow-y-auto rounded-sm`}>
{isLoading ? (
<div className="flex justify-center items-center py-8 h-full">
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
diff --git a/src/client/src/components/(playground)/manage-dashboard/explorer/root-actions.tsx b/src/client/src/components/(playground)/manage-dashboard/explorer/root-actions.tsx
index 97786131..b902f795 100644
--- a/src/client/src/components/(playground)/manage-dashboard/explorer/root-actions.tsx
+++ b/src/client/src/components/(playground)/manage-dashboard/explorer/root-actions.tsx
@@ -1,45 +1,72 @@
import { Button } from "@/components/ui/button";
import {
- DropdownMenuTrigger,
- DropdownMenuItem,
- DropdownMenu,
- DropdownMenuContent
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import {
- MoreHorizontal, Upload
-} from "lucide-react";
+import { ChevronDown, Plus, Upload } from "lucide-react";
import { useState } from "react";
import ImportLayoutModal from "./import-layout-modal";
-export default function RootActions({ openAddDialog, importBoardLayout }: {
- openAddDialog: () => void,
- importBoardLayout: (data: any) => Promise<unknown>
+export default function RootActions({
+ openAddDialog,
+ importBoardLayout,
+}: {
+ openAddDialog: () => void;
+ importBoardLayout?: (data: unknown) => Promise<unknown>;
}) {
- const [isImportModalOpen, setIsImportModalOpen] = useState(false);
+ const [isImportModalOpen, setIsImportModalOpen] = useState(false);
+ const canImport = Boolean(importBoardLayout);
- return (
- <div className="flex gap-2">
- <Button variant="outline" className="bg-primary hover:bg-primary/90 text-white hover:text-white dark:text-white dark:hover:text-white dark:bg-primary dark:hover:bg-primary/90" onClick={() => openAddDialog()}>
- Create new dashboard
- </Button>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8 self-center">
- <MoreHorizontal className="h-4 w-4" />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem onClick={() => setIsImportModalOpen(true)}>
- <Upload className="h-4 w-4 mr-2" />
- Import Layout
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- <ImportLayoutModal
- open={isImportModalOpen}
- onClose={() => setIsImportModalOpen(false)}
- onImport={importBoardLayout as any}
- />
- </div>
- );
-}
\ No newline at end of file
+ return (
+ <>
+ <div className="inline-flex shrink-0 items-stretch">
+ <Button
+ type="button"
+ size="sm"
+ onClick={() => openAddDialog()}
+ aria-label="Create new dashboard"
+ className="h-8 rounded-r-none bg-primary px-2 text-white hover:bg-primary/90 hover:text-white dark:bg-primary dark:text-white dark:hover:bg-primary/90 dark:hover:text-white"
+ >
+ <Plus className="size-4" />
+ </Button>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ type="button"
+ size="sm"
+ aria-label="More dashboard actions"
+ className="h-8 rounded-l-none border-l border-white/20 bg-primary px-2 text-white hover:bg-primary/90 hover:text-white dark:bg-primary dark:text-white dark:hover:bg-primary/90 dark:hover:text-white"
+ >
+ <ChevronDown className="size-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem onClick={() => openAddDialog()}>
+ <Plus className="mr-2 size-4" />
+ Create new dashboard
+ </DropdownMenuItem>
+ {canImport ? (
+ <DropdownMenuItem onClick={() => setIsImportModalOpen(true)}>
+ <Upload className="mr-2 size-4" />
+ Import layout
+ </DropdownMenuItem>
+ ) : null}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ {canImport ? (
+ <ImportLayoutModal
+ open={isImportModalOpen}
+ onClose={() => setIsImportModalOpen(false)}
+ onImport={
+ importBoardLayout as unknown as (
+ data: unknown
+ ) => Promise<{ err: string; data: string }>
+ }
+ />
+ ) : null}
+ </>
+ );
+}
diff --git a/src/client/src/components/(playground)/manage-dashboard/widget/index.tsx b/src/client/src/components/(playground)/manage-dashboard/widget/index.tsx
index a8fd5ff5..14384f32 100644
--- a/src/client/src/components/(playground)/manage-dashboard/widget/index.tsx
+++ b/src/client/src/components/(playground)/manage-dashboard/widget/index.tsx
@@ -25,7 +25,6 @@ import {
import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
import { toast } from "sonner";
import { Widget } from "@/types/manage-dashboard";
-import Header from "../common/header";
import { useDashboardPageSearch } from "@/selectors/dashboards";
import EmptyState from "../common/empty-state";
import getMessage from "@/constants/messages";
@@ -90,9 +89,7 @@ const WidgetListPage = () => {
});
return (
- <div className="flex flex-col gap-3 grow overflow-y-hidden">
- <Header title="Widgets" />
-
+ <div className="flex grow flex-col overflow-y-hidden">
{isLoading ? (
<div className="flex justify-center items-center grow">
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
diff --git a/src/client/src/components/(playground)/openground/dynamic-provider-grid.tsx b/src/client/src/components/(playground)/openground/dynamic-provider-grid.tsx
index 83b0a3c8..9f250df0 100644
--- a/src/client/src/components/(playground)/openground/dynamic-provider-grid.tsx
+++ b/src/client/src/components/(playground)/openground/dynamic-provider-grid.tsx
@@ -92,7 +92,7 @@ export default function DynamicProviderGrid() {
<CardTitle className="text-lg">{getMessage().OPENGROUND_SELECT_PROVIDERS}</CardTitle>
</CardHeader>
<CardContent>
- <div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-3 overflow-auto">
+ <div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-3">
{availableProviders.map((provider) => {
const hasConfig = providerConfigs[provider.providerId];
const providerCount = getProviderCount(provider.providerId);
diff --git a/src/client/src/components/(playground)/openground/header.tsx b/src/client/src/components/(playground)/openground/header.tsx
index 1a3995d3..8d7bf39e 100644
--- a/src/client/src/components/(playground)/openground/header.tsx
+++ b/src/client/src/components/(playground)/openground/header.tsx
@@ -2,40 +2,79 @@ import { Button } from "@/components/ui/button";
import { getEvaluatedResponse, resetOpenground } from "@/selectors/openground";
import { useRootStore } from "@/store";
import Link from "next/link";
-import { HeaderPortal } from "../header-portal";
-import { SettingsIcon } from "lucide-react";
+import { ArrowLeftIcon, MonitorPlay, SettingsIcon } from "lucide-react";
import getMessage from "@/constants/messages";
+import FeaturePageHeader from "@/components/(playground)/feature-page-header";
+import { useRouter } from "next/navigation";
-export default function OpengroundHeader({
- className = "flex w-full items-center justify-end gap-2",
+export function OpengroundActions({
+ className = "flex items-center justify-end gap-2",
validateResponse = true,
+ extraButton,
}: {
className?: string;
- validateResponse: boolean;
+ validateResponse?: boolean;
+ extraButton?: JSX.Element;
}) {
const evaluatedResponse = useRootStore(getEvaluatedResponse);
const resetOpengroundData = useRootStore(resetOpenground);
-
+ const router = useRouter();
const showButton =
(validateResponse && !!evaluatedResponse.data) || !validateResponse;
+ if (!showButton) return (
+ <div className={className}>
+ <Button variant="outline" size="sm" className="h-8" onClick={() => router.back()}>
+ <ArrowLeftIcon className="mr-1.5 size-3.5" />
+ {getMessage().BACK}
+ </Button>
+ {extraButton}
+ </div>
+ );
+
+ return (
+ <div className={className}>
+ <Link href="/manage-models">
+ <Button variant="outline" size="sm" className="h-8">
+ <SettingsIcon className="mr-1.5 size-3.5" />
+ {getMessage().OPENGROUND_MANAGE_MODELS}
+ </Button>
+ </Link>
+ <Link href="/openground/new" onClick={resetOpengroundData}>
+ <Button
+ variant="secondary"
+ size="sm"
+ className="h-8 bg-primary text-white hover:bg-primary/90 dark:bg-primary dark:text-white dark:hover:bg-primary/90"
+ >
+ {getMessage().OPENGROUND_CREATE_NEW_PLAYGROUND}
+ </Button>
+ </Link>
+ {extraButton}
+ </div>
+ );
+}
+
+export default function OpengroundHeader({
+ validateResponse = true,
+ title,
+ extraButton,
+}: {
+ validateResponse?: boolean;
+ title?: string;
+ extraButton?: JSX.Element;
+}) {
+ const messages = getMessage();
+ const pageHeaderTitle = title || messages.FEATURE_OPENGROUND
+
return (
- <HeaderPortal>
- <div className={className}>
- {showButton ? (
- <>
- <Link href={"/manage-models"}>
- <Button variant="outline" className="h-auto py-1">
- <SettingsIcon className="h-4 w-4 mr-2" />
- {getMessage().OPENGROUND_MANAGE_MODELS}
- </Button>
- </Link>
- <Link href={"/openground/new"} onClick={resetOpengroundData}>
- <Button variant="secondary" className="bg-primary hover:bg-primary dark:bg-primary dark:hover:bg-primary text-stone-100 dark:text-stone-100 h-auto py-1">{getMessage().OPENGROUND_CREATE_NEW_PLAYGROUND}</Button>
- </Link>
- </>
- ) : null}
- </div>
- </HeaderPortal>
+ <FeaturePageHeader
+ eyebrow="Resources"
+ title={pageHeaderTitle}
+ icon={<MonitorPlay className="size-4" />}
+ tone="border-indigo-200 bg-indigo-50 text-indigo-700 dark:border-indigo-900/70 dark:bg-indigo-950/40 dark:text-indigo-300"
+ actions={
+ <OpengroundActions validateResponse={validateResponse} extraButton={extraButton} />
+ }
+ />
);
}
diff --git a/src/client/src/components/(playground)/openground/model-editor-panel.tsx b/src/client/src/components/(playground)/openground/model-editor-panel.tsx
index 408f5e8a..54b77a1a 100644
--- a/src/client/src/components/(playground)/openground/model-editor-panel.tsx
+++ b/src/client/src/components/(playground)/openground/model-editor-panel.tsx
@@ -158,8 +158,8 @@ export default function ModelEditorPanel({
};
return (
- <div className="p-6 max-w-3xl">
- <Card>
+ <>
+ <Card className="rounded-none">
<CardHeader>
<div className="flex items-center justify-between">
<CardTitle className="text-lg">
@@ -277,8 +277,8 @@ export default function ModelEditorPanel({
</div>
{/* Actions — all models editable now */}
- <div className="flex gap-2 pt-4">
- <Button onClick={handleSave} disabled={saving} className="flex-1">
+ <div className="flex gap-4 pt-4">
+ <Button onClick={handleSave} disabled={saving} className="w-1/3 h-9">
{saving ? getMessage().SAVING : getMessage().OPENGROUND_SAVE_MODEL}
</Button>
{!isAddingNew && (
@@ -286,12 +286,13 @@ export default function ModelEditorPanel({
variant="destructive"
onClick={() => setShowDeleteDialog(true)}
disabled={deleting}
+ className=" h-9"
>
<Trash2Icon className="h-4 w-4 mr-2" />
{getMessage().DELETE}
</Button>
)}
- <Button variant="outline" onClick={onCancel}>
+ <Button variant="outline" onClick={onCancel} className=" h-9">
{getMessage().CANCEL}
</Button>
</div>
@@ -317,6 +318,6 @@ export default function ModelEditorPanel({
</DialogFooter>
</DialogContent>
</Dialog>
- </div>
+ </>
);
}
diff --git a/src/client/src/components/(playground)/organisation/organisation-page.tsx b/src/client/src/components/(playground)/organisation/organisation-page.tsx
index 67dfbeb0..26d923f9 100644
--- a/src/client/src/components/(playground)/organisation/organisation-page.tsx
+++ b/src/client/src/components/(playground)/organisation/organisation-page.tsx
@@ -26,8 +26,6 @@ import { Badge } from "@/components/ui/badge";
import {
Tabs,
TabsContent,
- TabsList,
- TabsTrigger,
} from "@/components/ui/tabs";
import {
Select,
@@ -52,6 +50,7 @@ import {
Clock,
FolderKanban,
Database,
+ Plus,
} from "lucide-react";
import { useRootStore } from "@/store";
import {
@@ -92,7 +91,7 @@ import {
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import CreateOrganisationDialog from "@/components/(playground)/sidebar/create-organisation-dialog";
-import FeaturePageHeader from "@/components/(playground)/feature-page-header";
+import { cn } from "@/lib/utils";
import getMessage from "@/constants/messages";
import { escapeEmailForDisplay } from "@/utils/string";
import { toast } from "sonner";
@@ -150,8 +149,8 @@ export default function OrganisationSettingsPage() {
const [isCreatingProject, setIsCreatingProject] = useState(false);
const requestedTab = searchParams.get("tab") || "details";
const availableTabs = orgPendingInvites.length > 0
- ? ["details", "projects", "members", "pending", "all"]
- : ["details", "projects", "members", "all"];
+ ? ["details", "projects", "members", "pending"]
+ : ["details", "projects", "members"];
const selectedTab = availableTabs.includes(requestedTab)
? requestedTab
: "details";
@@ -342,16 +341,84 @@ export default function OrganisationSettingsPage() {
};
return (
- <div className="space-y-4 overflow-auto w-full text-stone-700 dark:text-stone-300">
- <FeaturePageHeader
- eyebrow={messages.ORGANISATION}
- title={messages.ORGANISATION_SETTINGS}
- description="Manage organisations, projects, and team access from the top-level workspace control plane."
- icon={<Building2 className="h-4 w-4" />}
- tone="border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-300"
- actions={<Button onClick={() => setCreateDialogOpen(true)} size="sm"><Building2 className="mr-1.5 h-3.5 w-3.5" />{messages.NEW_ORGANISATION}</Button>}
- />
-
+ <div className="flex h-full w-full flex-col overflow-hidden text-stone-700 dark:text-stone-300">
+ <section className="border-b border-stone-200 px-4 py-3 dark:border-stone-800">
+ <div className="flex flex-col gap-2 xl:flex-row xl:items-center xl:justify-between">
+ <div className="min-w-0 shrink-0">
+ <div className="flex items-center gap-2">
+ <span className="rounded-md border border-emerald-200 bg-emerald-50 p-1.5 text-emerald-700 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-300">
+ <Building2 className="size-4" />
+ </span>
+ <div>
+ <p className="text-[11px] uppercase tracking-wide text-stone-500 dark:text-stone-400">
+ {messages.ORGANISATION}
+ </p>
+ <h1 className="text-sm font-semibold leading-tight text-stone-950 dark:text-stone-50">
+ {messages.ORGANISATION_SETTINGS}
+ </h1>
+ </div>
+ </div>
+ </div>
+ <div className="flex min-w-0 flex-wrap items-center justify-end gap-2">
+ {currentOrg ? (
+ <div className="flex flex-wrap items-center gap-2">
+ {[
+ { key: "details", label: messages.DETAILS, icon: Settings },
+ {
+ key: "projects",
+ label: `${messages.PROJECTS} (${projects.length})`,
+ icon: FolderKanban,
+ },
+ {
+ key: "members",
+ label: `${messages.MEMBERS} (${members.length})`,
+ icon: Users,
+ },
+ ...(orgPendingInvites.length > 0
+ ? [
+ {
+ key: "pending",
+ label: `${messages.PENDING} (${orgPendingInvites.length})`,
+ icon: Clock,
+ },
+ ]
+ : []),
+ ].map((tab) => {
+ const Icon = tab.icon;
+ const isActive = selectedTab === tab.key;
+ return (
+ <button
+ key={tab.key}
+ type="button"
+ onClick={() => handleTabChange(tab.key)}
+ className={cn(
+ "inline-flex items-center gap-2 rounded-md border px-2.5 py-1.5 text-xs transition",
+ isActive
+ ? "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-300"
+ : "border-stone-200 bg-stone-50 text-stone-600 hover:bg-stone-100 dark:border-stone-800 dark:bg-stone-900 dark:text-stone-300 dark:hover:bg-stone-800"
+ )}
+ >
+ <Icon className="size-4" />
+ <span className="font-medium">{tab.label}</span>
+ </button>
+ );
+ })}
+ </div>
+ ) : null}
+ <Button
+ type="button"
+ size="sm"
+ onClick={() => setCreateDialogOpen(true)}
+ aria-label={messages.NEW_ORGANISATION}
+ className="h-8 bg-primary px-2 text-white hover:bg-primary/90 dark:bg-primary dark:text-white dark:hover:bg-primary/90"
+ >
+ <Plus className="size-4" />
+ </Button>
+ </div>
+ </div>
+ </section>
+
+ <div className="min-h-0 flex-1 space-y-4 overflow-y-auto p-4">
{pendingInvitations.length > 0 && (
<Card className="border-primary/20 bg-primary/5 dark:border-primary/30 dark:bg-primary/10">
<CardHeader className="pb-3">
@@ -392,31 +459,7 @@ export default function OrganisationSettingsPage() {
)}
{currentOrg && (
- <Tabs value={selectedTab} onValueChange={handleTabChange} className="w-auto">
- <TabsList className="w-auto justify-start p-0 h-auto">
- <TabsTrigger value="details" className="text-xs text-stone-700 dark:text-stone-300">
- <Settings className="h-3.5 w-3.5 mr-1.5" />
- {messages.DETAILS}
- </TabsTrigger>
- <TabsTrigger value="projects" className="text-xs text-stone-700 dark:text-stone-300">
- <FolderKanban className="h-3.5 w-3.5 mr-1.5" />
- {messages.PROJECTS} ({projects.length})
- </TabsTrigger>
- <TabsTrigger value="members" className="text-xs text-stone-700 dark:text-stone-300">
- <Users className="h-3.5 w-3.5 mr-1.5" />
- {messages.MEMBERS} ({members.length})
- </TabsTrigger>
- {orgPendingInvites.length > 0 && (
- <TabsTrigger value="pending" className="text-xs text-stone-700 dark:text-stone-300">
- <Clock className="h-3.5 w-3.5 mr-1.5" />
- {messages.PENDING} ({orgPendingInvites.length})
- </TabsTrigger>
- )}
- <TabsTrigger value="all" className="text-xs text-stone-700 dark:text-stone-300">
- <Building2 className="h-3.5 w-3.5 mr-1.5" />
- {messages.ORGANISATIONS}
- </TabsTrigger>
- </TabsList>
+ <Tabs value={selectedTab} onValueChange={handleTabChange} className="w-full">
<TabsContent value="details" className="space-y-4 mt-0">
{hasAdminPermissions ? (
@@ -460,6 +503,58 @@ export default function OrganisationSettingsPage() {
</div>
)}
+ <div className="border-t border-stone-200 dark:border-stone-800 pt-4 px-4 pb-4">
+ <h4 className="mb-2 text-sm font-medium text-stone-900 dark:text-stone-100">
+ {messages.ORGANISATIONS}
+ </h4>
+ <Table>
+ <TableHeader className="bg-stone-200/[0.5] text-stone-500 dark:bg-stone-800 dark:text-stone-400">
+ <TableRow className="text-xs">
+ <TableHead className="h-8 pl-2">{messages.NAME}</TableHead>
+ <TableHead className="h-8">{messages.MEMBERS}</TableHead>
+ <TableHead className="h-8">{messages.STATUS}</TableHead>
+ <TableHead className="h-8 text-right">
+ {messages.ACTIONS}
+ </TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {organisations.map((org) => (
+ <TableRow key={org.id} className="text-sm">
+ <TableCell className="py-2 font-medium pl-2">
+ {org.name}
+ </TableCell>
+ <TableCell className="py-2 text-xs text-muted-foreground">
+ {org.memberCount} {messages.MEMBER}
+ {org.memberCount !== 1 ? "s" : ""}
+ </TableCell>
+ <TableCell className="py-2">
+ {org.isCurrent ? (
+ <Badge className="text-xs h-5 px-2">
+ {messages.ACTIVE}
+ </Badge>
+ ) : (
+ <span className="text-xs text-muted-foreground">-</span>
+ )}
+ </TableCell>
+ <TableCell className="py-2 text-right">
+ {!org.isCurrent && (
+ <Button
+ variant="outline"
+ size="sm"
+ className="h-7 text-xs"
+ onClick={() => changeActiveOrganisation(org.id)}
+ >
+ {messages.SWITCH_ORGANISATION}
+ </Button>
+ )}
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ </div>
+
{isCreator && (
<div className="border-t border-stone-200 dark:border-stone-800 pt-4 px-4 pb-4">
<div className="space-y-2">
@@ -850,54 +945,6 @@ export default function OrganisationSettingsPage() {
</TabsContent>
)}
- <TabsContent value="all" className="mt-0 p-0 pt-2">
- <Table>
- <TableHeader className="bg-stone-200/[0.5] text-stone-500 dark:bg-stone-800 dark:text-stone-400">
- <TableRow className="text-xs">
- <TableHead className="h-8 pl-2">{messages.NAME}</TableHead>
- <TableHead className="h-8">{messages.MEMBERS}</TableHead>
- <TableHead className="h-8">{messages.STATUS}</TableHead>
- <TableHead className="h-8 text-right">
- {messages.ACTIONS}
- </TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {organisations.map((org) => (
- <TableRow key={org.id} className="text-sm">
- <TableCell className="py-2 font-medium pl-2">
- {org.name}
- </TableCell>
- <TableCell className="py-2 text-xs text-muted-foreground">
- {org.memberCount} {messages.MEMBER}
- {org.memberCount !== 1 ? "s" : ""}
- </TableCell>
- <TableCell className="py-2">
- {org.isCurrent ? (
- <Badge className="text-xs h-5 px-2">
- {messages.ACTIVE}
- </Badge>
- ) : (
- <span className="text-xs text-muted-foreground">-</span>
- )}
- </TableCell>
- <TableCell className="py-2 text-right">
- {!org.isCurrent && (
- <Button
- variant="outline"
- size="sm"
- className="h-7 text-xs"
- onClick={() => changeActiveOrganisation(org.id)}
- >
- {messages.SWITCH_ORGANISATION}
- </Button>
- )}
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- </TabsContent>
</Tabs>
)}
@@ -905,6 +952,7 @@ export default function OrganisationSettingsPage() {
open={createDialogOpen}
onOpenChange={setCreateDialogOpen}
/>
+ </div>
</div>
);
}
diff --git a/src/client/src/components/(playground)/organisation/project-page-header.tsx b/src/client/src/components/(playground)/organisation/project-page-header.tsx
index 751df607..abcfa2a8 100644
--- a/src/client/src/components/(playground)/organisation/project-page-header.tsx
+++ b/src/client/src/components/(playground)/organisation/project-page-header.tsx
@@ -9,5 +9,5 @@ import getMessage from "@/constants/messages";
export default function ProjectPageHeader({ project }: { project?: { name?: string; isCurrent?: boolean; isDefault?: boolean } }) {
const messages = getMessage();
- return <FeaturePageHeader eyebrow={messages.ORGANISATION} title={project?.name || messages.LOADING_PROJECT} description="Configure project identity and defaults so database connections and telemetry stay scoped correctly." icon={<FolderKanban className="h-4 w-4" />} tone="border-primary/20 bg-primary/10 text-primary dark:border-primary/30" actions={<div className="flex flex-wrap items-center gap-2"><Button asChild variant="outline" size="sm" className="h-8"><Link href="/organisation"><ArrowLeft className="mr-1.5 h-3.5 w-3.5" />{messages.BACK_TO_ORGANISATION}</Link></Button>{project?.isCurrent ? <Badge className="h-6">{messages.CURRENT}</Badge> : null}{project?.isDefault ? <Badge variant="outline" className="h-6">{messages.DEFAULT_PROJECT}</Badge> : null}</div>} />;
+ return <FeaturePageHeader eyebrow={messages.ORGANISATION} title={project?.name || messages.LOADING_PROJECT} icon={<FolderKanban className="h-4 w-4" />} tone="border-primary/20 bg-primary/10 text-primary dark:border-primary/30" actions={<div className="flex flex-wrap items-center gap-2"><Button asChild variant="outline" size="sm" className="h-8"><Link href="/organisation"><ArrowLeft className="mr-1.5 h-3.5 w-3.5" />{messages.BACK_TO_ORGANISATION}</Link></Button>{project?.isCurrent ? <Badge className="h-6">{messages.CURRENT}</Badge> : null}{project?.isDefault ? <Badge variant="outline" className="h-6">{messages.DEFAULT_PROJECT}</Badge> : null}</div>} />;
}
diff --git a/src/client/src/components/(playground)/organisation/project-page.tsx b/src/client/src/components/(playground)/organisation/project-page.tsx
index 7932d783..33980c2b 100644
--- a/src/client/src/components/(playground)/organisation/project-page.tsx
+++ b/src/client/src/components/(playground)/organisation/project-page.tsx
@@ -56,7 +56,7 @@ export default function OrganisationProjectPage({
<TabsTrigger value="database" className="gap-1.5 text-xs"><Database className="h-3.5 w-3.5" />{messages.PROJECT_DATABASE_CONFIGS}</TabsTrigger>
</TabsList>
<TabsContent value="overview" className="mt-0 data-[state=active]:mt-3">
- <section className="rounded-md border border-stone-200 bg-white p-4 dark:border-stone-800 dark:bg-stone-950">
+ <section className="border border-stone-200 bg-white p-4 dark:border-stone-800 dark:bg-stone-950">
<div className="mb-4 flex items-center gap-2">
<FolderKanban className="h-4 w-4 text-primary" />
<h2 className="text-sm font-semibold text-stone-950 dark:text-stone-50">
@@ -85,7 +85,7 @@ export default function OrganisationProjectPage({
</TabsContent>
<TabsContent value="database" className="mt-0 data-[state=active]:mt-3">
- <section className="min-h-[520px] overflow-hidden rounded-md border border-stone-200 bg-white dark:border-stone-800 dark:bg-stone-950">
+ <section className="min-h-[520px] overflow-hidden border border-stone-200 bg-white dark:border-stone-800 dark:bg-stone-950">
<div className="border-b border-stone-200 p-4 dark:border-stone-800">
<div className="flex items-center gap-2">
<Database className="h-4 w-4 text-primary" />
diff --git a/src/client/src/components/(playground)/playground-shell.tsx b/src/client/src/components/(playground)/playground-shell.tsx
new file mode 100644
index 00000000..7f932a0e
--- /dev/null
+++ b/src/client/src/components/(playground)/playground-shell.tsx
@@ -0,0 +1,54 @@
+"use client";
+
+import type { ReactNode } from "react";
+import Sidebar from "@/components/(playground)/sidebar";
+import SidebarBrand from "@/components/(playground)/sidebar-brand";
+import { HeaderContextRow } from "@/components/(playground)/header";
+import {
+ SidebarLayoutProvider,
+ useSidebarLayout,
+} from "@/components/(playground)/sidebar-layout-context";
+import { cn } from "@/lib/utils";
+
+function PlaygroundShellFrame({ children }: { children: ReactNode }) {
+ const { sidebarWidthClass } = useSidebarLayout();
+
+ return (
+ <div className="flex h-screen w-full flex-col overflow-hidden border border-stone-200 bg-stone-50 dark:border-stone-800 dark:bg-stone-950">
+ <div className="flex shrink-0 border-b border-stone-200 dark:border-stone-800">
+ <div
+ className={cn(
+ "relative shrink-0 border-r border-stone-200 dark:border-stone-800",
+ sidebarWidthClass
+ )}
+ >
+ <SidebarBrand />
+ </div>
+ <HeaderContextRow />
+ </div>
+ <div className="flex min-h-0 flex-1">
+ <div
+ className={cn(
+ "relative z-30 flex shrink-0 flex-col border-r border-stone-200 dark:border-stone-800",
+ sidebarWidthClass
+ )}
+ >
+ <Sidebar />
+ </div>
+ <div className="flex min-w-0 flex-1 flex-col">
+ <main className="flex min-h-0 flex-1 flex-col overflow-hidden">
+ {children}
+ </main>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+export default function PlaygroundShell({ children }: { children: ReactNode }) {
+ return (
+ <SidebarLayoutProvider>
+ <PlaygroundShellFrame>{children}</PlaygroundShellFrame>
+ </SidebarLayoutProvider>
+ );
+}
diff --git a/src/client/src/components/(playground)/prompt-hub/header.tsx b/src/client/src/components/(playground)/prompt-hub/header.tsx
index 982c2c3d..1d01f4b1 100644
--- a/src/client/src/components/(playground)/prompt-hub/header.tsx
+++ b/src/client/src/components/(playground)/prompt-hub/header.tsx
@@ -9,29 +9,36 @@ import FeaturePageHeader from "@/components/(playground)/feature-page-header";
import { Component } from "lucide-react";
export default function PromptHubHeader({
+ title,
createNew,
className = "flex w-full items-center justify-end gap-3",
+ extraButtons,
+ promptUsage = true,
}: {
+ title?: string;
createNew?: boolean;
className?: string;
+ extraButtons?: JSX.Element;
+ promptUsage?: boolean;
}) {
const m = getMessage();
const pingStatus = useRootStore(getPingStatus);
-
+ const pageHeaderTitle = title || m.FEATURE_PROMPTS;
const actions = (
<div className={className}>
- {pingStatus === "success" && <PromptUsage />}
+ {pingStatus === "success" && promptUsage && <PromptUsage />}
{createNew && pingStatus === "success" && (
<Button
asChild
variant="secondary"
- className="bg-primary hover:bg-primary dark:bg-primary dark:hover:bg-primary text-stone-100 dark:text-stone-100 px-8 h-9 py-1"
+ className="bg-primary hover:bg-primary dark:bg-primary dark:hover:bg-primary text-stone-100 dark:text-stone-100 px-8 h-8"
>
<Link href="/prompt-hub/new">{m.PROMPT_HUB_CREATE}</Link>
</Button>
)}
+ {extraButtons}
</div>
);
- return <FeaturePageHeader eyebrow="Resources" title={m.FEATURE_PROMPTS} description="Design, version, and reuse prompts so teams can ship consistent AI behavior across products." icon={<Component className="h-4 w-4" />} tone="border-pink-200 bg-pink-50 text-pink-700 dark:border-pink-900/70 dark:bg-pink-950/40 dark:text-pink-300" actions={actions} />;
+ return <FeaturePageHeader eyebrow="Resources" title={pageHeaderTitle} icon={<Component className="h-4 w-4" />} tone="border-pink-200 bg-pink-50 text-pink-700 dark:border-pink-900/70 dark:bg-pink-950/40 dark:text-pink-300" actions={actions} />;
}
diff --git a/src/client/src/components/(playground)/prompt-hub/usage.tsx b/src/client/src/components/(playground)/prompt-hub/usage.tsx
index b06ae326..21ad31b6 100644
--- a/src/client/src/components/(playground)/prompt-hub/usage.tsx
+++ b/src/client/src/components/(playground)/prompt-hub/usage.tsx
@@ -9,7 +9,7 @@ export default function PromptUsage() {
return (
<div className="flex">
<Link href={documentationLinks.promptHub} target="_blank" rel="noopener noreferrer">
- <Button variant="outline" className="flex gap-2 px-8 h-9 py-1 rounded-md font-normal text-stone-600">
+ <Button variant="outline" className="flex gap-2 px-8 h-8 rounded-md font-normal text-stone-600">
<BookText className="w-4 h-4" />
{m.PROMPT_HUB_LEARN_MORE}
</Button>
diff --git a/src/client/src/components/(playground)/route-breadcrumbs.tsx b/src/client/src/components/(playground)/route-breadcrumbs.tsx
deleted file mode 100644
index f38324bf..00000000
--- a/src/client/src/components/(playground)/route-breadcrumbs.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-import {
- Breadcrumb,
- BreadcrumbList,
- BreadcrumbItem,
- BreadcrumbLink,
- BreadcrumbSeparator,
- BreadcrumbPage,
-} from "@/components/ui/breadcrumb";
-import { usePageHeader } from "@/selectors/page";
-import { usePathname } from "next/navigation";
-import Link from "next/link";
-import React, { useEffect } from "react";
-import { generatePageHeader } from "@/utils/breadcrumbs";
-
-export default function RouteBreadcrumbs() {
- const pathname = usePathname();
- const { header, setHeader } = usePageHeader();
-
- useEffect(() => {
- const pageHeader = generatePageHeader(pathname);
- setHeader(pageHeader);
- }, [pathname, setHeader]);
-
- const isHomePage = pathname === "/home";
- const showHomeBreadcrumb = !isHomePage;
- const hasIntermediateBreadcrumbs = header.breadcrumbs.length > 0;
-
- return (
- <Breadcrumb className="grow px-2 py-2 rounded-none">
- <BreadcrumbList className="text-xs">
- {showHomeBreadcrumb && (
- <BreadcrumbItem>
- <BreadcrumbLink asChild>
- <Link href="/home">Home</Link>
- </BreadcrumbLink>
- </BreadcrumbItem>
- )}
-
- {showHomeBreadcrumb && hasIntermediateBreadcrumbs && <BreadcrumbSeparator />}
-
- {header.breadcrumbs.map(({ title, href }, index) => (
- <React.Fragment key={href}>
- <BreadcrumbItem>
- <BreadcrumbLink asChild>
- <Link href={href}>{title}</Link>
- </BreadcrumbLink>
- </BreadcrumbItem>
- {index < header.breadcrumbs.length - 1 && <BreadcrumbSeparator />}
- </React.Fragment>
- ))}
-
- {(showHomeBreadcrumb || hasIntermediateBreadcrumbs) && <BreadcrumbSeparator />}
-
- <BreadcrumbItem>
- <BreadcrumbPage className="capitalize">
- {header.title}
- </BreadcrumbPage>
- </BreadcrumbItem>
- </BreadcrumbList>
- </Breadcrumb>
- );
-}
diff --git a/src/client/src/components/(playground)/rule-engine/header.tsx b/src/client/src/components/(playground)/rule-engine/header.tsx
index e2df9136..19139f37 100644
--- a/src/client/src/components/(playground)/rule-engine/header.tsx
+++ b/src/client/src/components/(playground)/rule-engine/header.tsx
@@ -23,7 +23,8 @@ export default function RuleEngineHeader({
<RuleForm successCallback={successCallback}>
<Button
variant="secondary"
- className="bg-primary hover:bg-primary dark:bg-primary dark:hover:bg-primary text-stone-100 dark:text-stone-100 px-8 h-9 py-0.5"
+ size={"sm"}
+ className="bg-primary hover:bg-primary dark:bg-primary dark:hover:bg-primary text-stone-100 dark:text-stone-100 px-8 h-8"
>
{messages.RULE_CREATE_BUTTON}
</Button>
@@ -32,5 +33,5 @@ export default function RuleEngineHeader({
</div>
);
- return <FeaturePageHeader eyebrow="Resources" title={messages.RULE_ENGINE_BREADCRUMB} description="Define policy-driven logic that turns context and telemetry into repeatable AI workflow decisions." icon={<SlidersHorizontal className="h-4 w-4" />} tone="border-purple-200 bg-purple-50 text-purple-700 dark:border-purple-900/70 dark:bg-purple-950/40 dark:text-purple-300" actions={actions} />;
+ return <FeaturePageHeader eyebrow="Resources" title={messages.RULE_ENGINE_BREADCRUMB} icon={<SlidersHorizontal className="h-4 w-4" />} tone="border-purple-200 bg-purple-50 text-purple-700 dark:border-purple-900/70 dark:bg-purple-950/40 dark:text-purple-300" actions={actions} />;
}
diff --git a/src/client/src/components/(playground)/sidebar-brand.tsx b/src/client/src/components/(playground)/sidebar-brand.tsx
new file mode 100644
index 00000000..c6085529
--- /dev/null
+++ b/src/client/src/components/(playground)/sidebar-brand.tsx
@@ -0,0 +1,64 @@
+"use client";
+
+import Image from "next/image";
+import { ChevronsLeft, ChevronsRight } from "lucide-react";
+import { Button } from "@/components/ui/button";
+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
+import { cn } from "@/lib/utils";
+import version from "../../../package.json";
+import logoImage from "../../../public/images/logo.png";
+import {
+ playgroundTopBarClassName,
+ useSidebarLayout,
+} from "./sidebar-layout-context";
+
+export default function SidebarBrand() {
+ const { isExpanded, toggleSidebar } = useSidebarLayout();
+
+ return (
+ <div
+ className={playgroundTopBarClassName("relative gap-2 px-3")}
+ >
+ <Tooltip delayDuration={100}>
+ <TooltipTrigger asChild>
+ <Button
+ variant="outline"
+ size="icon"
+ onClick={toggleSidebar}
+ aria-label={isExpanded ? "Collapse sidebar" : "Expand sidebar"}
+ aria-expanded={isExpanded}
+ className="absolute -right-3 top-1/2 z-50 size-6 -translate-y-1/2 rounded-full border-stone-300 bg-white p-0 text-stone-600 shadow-sm hover:bg-stone-100 hover:text-stone-950 focus-visible:ring-2 focus-visible:ring-primary dark:border-stone-700 dark:bg-stone-900 dark:text-stone-300 dark:hover:bg-stone-800 dark:hover:text-white"
+ >
+ {isExpanded ? (
+ <ChevronsLeft className="size-3.5" />
+ ) : (
+ <ChevronsRight className="size-3.5" />
+ )}
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent side="right" sideOffset={10}>
+ {isExpanded ? "Collapse sidebar" : "Expand sidebar"}
+ </TooltipContent>
+ </Tooltip>
+ <Image
+ className="size-9 shrink-0 object-contain"
+ src={logoImage}
+ alt="OpenLIT logo"
+ priority
+ width={36}
+ height={36}
+ />
+ <div
+ className={cn(
+ "flex min-w-0 flex-1 items-center gap-1.5 transition-opacity",
+ !isExpanded && "pointer-events-none invisible opacity-0"
+ )}
+ >
+ <p className="truncate text-lg font-semibold text-stone-900 dark:text-white">
+ OpenLIT
+ </p>
+ <p className="shrink-0 text-[10px] text-stone-500">v{version.version}</p>
+ </div>
+ </div>
+ );
+}
diff --git a/src/client/src/components/(playground)/sidebar-layout-context.tsx b/src/client/src/components/(playground)/sidebar-layout-context.tsx
new file mode 100644
index 00000000..13154af1
--- /dev/null
+++ b/src/client/src/components/(playground)/sidebar-layout-context.tsx
@@ -0,0 +1,64 @@
+"use client";
+
+import {
+ createContext,
+ useCallback,
+ useContext,
+ useMemo,
+ useState,
+ type ReactNode,
+} from "react";
+import { cn } from "@/lib/utils";
+
+type SidebarLayoutContextValue = {
+ isExpanded: boolean;
+ toggleSidebar: () => void;
+ expandSidebar: () => void;
+ sidebarWidthClass: string;
+};
+
+const SidebarLayoutContext = createContext<SidebarLayoutContextValue | null>(
+ null
+);
+
+export function SidebarLayoutProvider({ children }: { children: ReactNode }) {
+ const [isExpanded, setIsExpanded] = useState(true);
+
+ const toggleSidebar = useCallback(() => {
+ setIsExpanded((value) => !value);
+ }, []);
+
+ const expandSidebar = useCallback(() => {
+ setIsExpanded(true);
+ }, []);
+
+ const value = useMemo(
+ () => ({
+ isExpanded,
+ toggleSidebar,
+ expandSidebar,
+ sidebarWidthClass: isExpanded ? "w-64" : "w-16",
+ }),
+ [isExpanded, toggleSidebar, expandSidebar]
+ );
+
+ return (
+ <SidebarLayoutContext.Provider value={value}>
+ {children}
+ </SidebarLayoutContext.Provider>
+ );
+}
+
+export function useSidebarLayout() {
+ const context = useContext(SidebarLayoutContext);
+ if (!context) {
+ throw new Error("useSidebarLayout must be used within SidebarLayoutProvider");
+ }
+ return context;
+}
+
+export const PLAYGROUND_TOP_BAR_CLASS = "flex h-11 shrink-0 items-center";
+
+export function playgroundTopBarClassName(className?: string) {
+ return cn(PLAYGROUND_TOP_BAR_CLASS, className);
+}
diff --git a/src/client/src/components/(playground)/sidebar/database-config-switch.tsx b/src/client/src/components/(playground)/sidebar/database-config-switch.tsx
index e2372226..3b70b754 100644
--- a/src/client/src/components/(playground)/sidebar/database-config-switch.tsx
+++ b/src/client/src/components/(playground)/sidebar/database-config-switch.tsx
@@ -9,11 +9,12 @@ import {
import { usePostHog } from "posthog-js/react";
import { CLIENT_EVENTS } from "@/constants/events";
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
-import { Button } from "@/components/ui/button";
import Link from "next/link";
import { useRouter } from "next/navigation";
+import { ChevronDown } from "lucide-react";
import getMessage from "@/constants/messages";
import { cn } from "@/lib/utils";
+import { headerScopeTriggerClassName } from "../header-scope-pill";
type DatabaseConfigSwitchProps = {
className?: string;
@@ -21,7 +22,7 @@ type DatabaseConfigSwitchProps = {
contentSide?: "bottom" | "left" | "right" | "top";
};
-const triggerClasses = "flex h-9 min-w-32 max-w-56 shrink-0 items-center justify-start overflow-hidden px-3 py-1.5 text-left font-normal";
+const triggerClasses = headerScopeTriggerClassName;
export default function DatabaseConfigSwitch({
className,
@@ -54,15 +55,14 @@ export default function DatabaseConfigSwitch({
// Show manage button when no database configs exist
if (list.length === 0) {
return (
- <Button
- variant="outline"
+ <button
+ type="button"
className={cn(triggerClasses, className)}
onClick={() => router.push(manageDbConfigHref)}
>
- <span className="min-w-0 truncate text-xs font-medium">
- {messages.MANAGE_DB_CONFIG}
- </span>
- </Button>
+ <span className="min-w-0 truncate">{messages.MANAGE_DB_CONFIG}</span>
+ <ChevronDown className="size-3 shrink-0 opacity-50" />
+ </button>
);
}
@@ -72,9 +72,10 @@ export default function DatabaseConfigSwitch({
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <Button variant="outline" className={cn(triggerClasses, className)}>
- <span className="min-w-0 truncate text-xs font-medium">{displayDatabaseName}</span>
- </Button>
+ <button type="button" className={cn(triggerClasses, className)}>
+ <span className="min-w-0 truncate">{displayDatabaseName}</span>
+ <ChevronDown className="size-3 shrink-0 opacity-50" />
+ </button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-56" side={contentSide} align={contentAlign}>
<DropdownMenuLabel>{messages.DATABASES}</DropdownMenuLabel>
diff --git a/src/client/src/components/(playground)/sidebar/index.tsx b/src/client/src/components/(playground)/sidebar/index.tsx
index cf56583d..e55bac0c 100644
--- a/src/client/src/components/(playground)/sidebar/index.tsx
+++ b/src/client/src/components/(playground)/sidebar/index.tsx
@@ -1,18 +1,14 @@
"use client";
-import Image from "next/image";
import Link from "next/link";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { useEffect, useMemo, useState } from "react";
import {
ChevronRight,
- ChevronsLeft,
- ChevronsRight,
- LayoutGrid,
- MessageSquareText,
Search,
X,
} from "lucide-react";
+import Otter from "@/components/svg/otter";
import { Button } from "@/components/ui/button";
import {
Command,
@@ -26,12 +22,19 @@ import {
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { SIDEBAR_ITEMS } from "@/constants/sidebar";
import { cn } from "@/lib/utils";
-import { SidebarActionItem, SidebarItemProps, SidebarSection } from "@/types/sidebar";
+import { getCurrentUserId } from "@/selectors/user";
+import { useRootStore } from "@/store";
+import {
+ SidebarActionItem,
+ SidebarItemProps,
+ SidebarSection,
+} from "@/types/sidebar";
+import { useSidebarPreferences } from "@/utils/hooks/useSidebarPreferences";
import UserActions from "./user-actions";
import OtterSidebar from "./otter-sidebar";
import ThemeToggleSwitch from "./theme-switch";
-import version from "../../../../package.json";
-import logoImage from "../../../../public/images/logo.png";
+import MyApps from "./my-apps";
+import { useSidebarLayout } from "../sidebar-layout-context";
const isActive = (pathname: string, item: SidebarActionItem, currentUrl: string) => {
if (!item.link) return false;
@@ -42,10 +45,13 @@ const isActive = (pathname: string, item: SidebarActionItem, currentUrl: string)
};
const flatItems = (items: SidebarItemProps[]) =>
- items.flatMap((item) => item.type === "section" ? item.children || [] : [item]);
+ items.flatMap((item) => {
+ if (item.type !== "section") return [item];
+ const direct = item.children || [];
+ const grouped = (item.groups || []).flatMap((group) => group.children);
+ return [...direct, ...grouped];
+ });
-const RECENT_PAGES_STORAGE_KEY = "openlit:recent-pages";
-const MAX_RECENT_PAGES = 5;
const SECONDARY_PANEL_WIDTH = "min(20rem, calc(100vw - 4rem))";
function NavigationLink({
@@ -64,7 +70,7 @@ function NavigationLink({
<span className={cn("min-w-0 truncate", compact && "sr-only")}>{item.text}</span>
</>;
const className = cn(
- "flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-sm font-medium transition-colors",
+ "flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-[13px] font-medium transition-colors",
compact && "justify-center px-2",
active
? "bg-stone-200 text-stone-950 dark:bg-stone-800 dark:text-white"
@@ -73,10 +79,10 @@ function NavigationLink({
if (item.component) return item.component;
if (item.link && !item.target) {
- return <Link href={item.link} onClick={onNavigate} className={className}>{content}</Link>;
+ return <Link href={item.link} onClick={onNavigate} aria-current={active ? "page" : undefined} className={className}>{content}</Link>;
}
return (
- <a href={item.link} target={item.target} onClick={() => { item.onClick?.(); onNavigate?.(); }} className={className}>
+ <a href={item.link} target={item.target} onClick={() => { item.onClick?.(); onNavigate?.(); }} aria-current={active ? "page" : undefined} className={className}>
{content}
</a>
);
@@ -89,7 +95,6 @@ function PrimaryItem({
compact,
openSection,
setOpenSection,
- onExpand,
}: {
item: SidebarItemProps;
pathname: string;
@@ -97,30 +102,30 @@ function PrimaryItem({
compact: boolean;
openSection: string | null;
setOpenSection: (section: SidebarSection | null) => void;
- onExpand: () => void;
}) {
if (item.type === "action") {
- const link = <NavigationLink item={item} active={isActive(pathname, item, currentUrl)} compact={compact} onNavigate={() => { if (compact) onExpand(); setOpenSection(null); }} />;
+ const active = openSection ? false : isActive(pathname, item, currentUrl);
+ const link = <NavigationLink item={item} active={active} compact={compact} onNavigate={() => setOpenSection(null)} />;
return compact ? <Tooltip delayDuration={100}><TooltipTrigger asChild>{link}</TooltipTrigger><TooltipContent side="right" sideOffset={8}>{item.text}</TooltipContent></Tooltip> : link;
}
- const selected = openSection === item.title || item.children?.some((child) => isActive(pathname, child, currentUrl));
+ const selected = openSection === item.title;
return (
<Tooltip delayDuration={100}>
<TooltipTrigger asChild>
<Button
variant="ghost"
aria-expanded={openSection === item.title}
- onClick={() => { if (compact) onExpand(); setOpenSection(openSection === item.title ? null : item); }}
+ onClick={() => setOpenSection(openSection === item.title ? null : item)}
className={cn(
- "h-9 w-full justify-start gap-2.5 rounded-lg px-2.5 text-sm font-medium",
+ "h-9 w-full justify-start gap-2 rounded-lg px-2.5 text-[13px] font-medium",
compact && "justify-center px-2",
selected
? "bg-stone-200 text-stone-950 hover:bg-stone-200 dark:bg-stone-800 dark:text-white dark:hover:bg-stone-800"
: "text-stone-600 hover:bg-stone-200/70 hover:text-stone-950 dark:text-stone-300 dark:hover:bg-stone-800 dark:hover:text-white",
)}
>
- {compact ? <span className="text-xs font-bold">{item.title.slice(0, 1)}</span> : <><span>{item.title}</span><ChevronRight className="ml-auto size-4" /></>}
+ {compact ? (item.icon ?? <span className="text-[13px] font-bold">{item.title.slice(0, 1)}</span>) : <>{item.icon}<span>{item.title}</span><ChevronRight className="ml-auto size-4" /></>}
</Button>
</TooltipTrigger>
{compact && <TooltipContent side="right" sideOffset={8}>{item.title}</TooltipContent>}
@@ -130,6 +135,7 @@ function PrimaryItem({
function SectionPanel({ section, pathname, currentUrl, onClose }: { section: SidebarSection; pathname: string; currentUrl: string; onClose: () => void }) {
const children = section.children || [];
+ const groups = section.groups;
return (
<div
@@ -137,15 +143,29 @@ function SectionPanel({ section, pathname, currentUrl, onClose }: { section: Sid
style={{ width: SECONDARY_PANEL_WIDTH }}
>
<div className="flex items-center justify-between border-b border-stone-200 px-3 py-2.5 dark:border-stone-800">
- <p className="text-sm font-semibold text-stone-900 dark:text-white">{section.title}</p>
+ <div className="flex items-center gap-2 text-stone-900 dark:text-white">
+ {section.icon}
+ <p className="text-[15px] font-semibold">{section.title}</p>
+ </div>
<Button variant="ghost" size="icon" onClick={onClose} aria-label="Close navigation panel" className="size-8 text-stone-700 hover:bg-stone-200 dark:text-stone-200 dark:hover:bg-stone-800"><X className="size-4" /></Button>
</div>
- <div className="overflow-y-auto p-2">
- <div className="space-y-1">
- {children.map((item) => <NavigationLink key={item.text} item={item} active={isActive(pathname, item, currentUrl)} onNavigate={onClose} />)}
- </div>
+ <div className="scrollbar-hidden overflow-y-auto p-2">
+ {groups ? (
+ <div className="space-y-3">
+ {groups.map((group) => (
+ <div key={group.title} className="space-y-0.5">
+ <p className="px-2.5 pb-0.5 pt-1 text-xs font-semibold uppercase tracking-wide text-stone-400 dark:text-stone-500">{group.title}</p>
+ {group.children.map((item) => <NavigationLink key={item.text} item={item} active={isActive(pathname, item, currentUrl)} onNavigate={onClose} />)}
+ </div>
+ ))}
+ </div>
+ ) : (
+ <div className="space-y-1">
+ {children.map((item) => <NavigationLink key={item.text} item={item} active={isActive(pathname, item, currentUrl)} onNavigate={onClose} />)}
+ </div>
+ )}
</div>
- {section.title === "Settings" ? <div className="flex items-center justify-between border-t border-stone-200 px-3 py-2.5 dark:border-stone-800"><span className="text-xs font-medium text-stone-600 dark:text-stone-300">Appearance</span><ThemeToggleSwitch /></div> : null}
+ {section.title === "Settings" ? <div className="flex items-center justify-between border-t border-stone-200 px-3 py-2.5 dark:border-stone-800"><span className="text-[13px] font-medium text-stone-600 dark:text-stone-300">Appearance</span><ThemeToggleSwitch /></div> : null}
</div>
);
}
@@ -154,20 +174,31 @@ export default function Sidebar() {
const pathname = usePathname();
const router = useRouter();
const searchParams = useSearchParams();
- const [isExpanded, setIsExpanded] = useState(true);
+ const { isExpanded } = useSidebarLayout();
const [openSection, setOpenSection] = useState<SidebarSection | null>(null);
const [commandOpen, setCommandOpen] = useState(false);
- const [recentLinks, setRecentLinks] = useState<string[]>([]);
+ const userId = useRootStore(getCurrentUserId);
const currentUrl = searchParams.toString() ? `${pathname}?${searchParams.toString()}` : pathname;
const allItems = useMemo(() => flatItems(SIDEBAR_ITEMS), []);
+ const appGroups = useMemo(() => {
+ const section = SIDEBAR_ITEMS.find(
+ (item): item is SidebarSection => item.type === "section" && Boolean(item.groups)
+ );
+ return section?.groups ?? [];
+ }, []);
+ const appsSectionIcon = useMemo(() => {
+ const section = SIDEBAR_ITEMS.find(
+ (item): item is SidebarSection => item.type === "section" && item.title === "Apps"
+ );
+ return section?.icon;
+ }, []);
+ const appItems = useMemo(
+ () => appGroups.flatMap((group) => group.children).filter((item) => item.link && !item.target),
+ [appGroups]
+ );
+ const myApps = useSidebarPreferences(userId);
+ const { loaded: myAppsLoaded, show: showMyApp } = myApps;
const isOtterActive = pathname.startsWith("/chat");
- const toggleSidebar = () => {
- setIsExpanded((value) => !value);
- setOpenSection(null);
- };
- const expandSidebar = () => {
- setIsExpanded(true);
- };
useEffect(() => {
const onKeyDown = (event: KeyboardEvent) => {
@@ -182,85 +213,55 @@ export default function Sidebar() {
}, []);
useEffect(() => {
- try {
- const storedLinks = JSON.parse(window.localStorage.getItem(RECENT_PAGES_STORAGE_KEY) || "[]");
- if (Array.isArray(storedLinks)) setRecentLinks(storedLinks.filter((link): link is string => typeof link === "string"));
- } catch {
- window.localStorage.removeItem(RECENT_PAGES_STORAGE_KEY);
- }
- }, []);
-
- useEffect(() => {
- const visitedItem = [...allItems]
- .filter((item) => item.link && !item.target)
+ if (!myAppsLoaded) return;
+ const visitedApp = [...appItems]
.sort((a, b) => (b.link?.length || 0) - (a.link?.length || 0))
.find((item) => isActive(pathname, item, currentUrl));
- if (!visitedItem?.link) return;
- setRecentLinks((previous) => {
- const next = [visitedItem.link!, ...previous.filter((link) => link !== visitedItem.link)].slice(0, MAX_RECENT_PAGES);
- window.localStorage.setItem(RECENT_PAGES_STORAGE_KEY, JSON.stringify(next));
- return next;
- });
- }, [allItems, currentUrl, pathname]);
-
- const recentItems = recentLinks.map((link) => allItems.find((item) => item.link === link)).filter((item): item is SidebarActionItem => Boolean(item));
+ if (visitedApp?.link) showMyApp(visitedApp.link);
+ }, [appItems, pathname, currentUrl, myAppsLoaded, showMyApp]);
return (
- <aside aria-label="Main navigation" className="relative z-30 flex h-full shrink-0">
+ <aside aria-label="Main navigation" className="relative flex h-full min-h-0 w-full flex-col bg-stone-50 dark:bg-stone-950">
{openSection && (
<button
aria-label="Close navigation panel"
- className="fixed inset-y-0 right-0 z-30 cursor-default bg-black/20 dark:bg-stone-900/40 left-0"
+ className={cn(
+ "fixed inset-y-0 right-0 z-30 cursor-default bg-black/20 dark:bg-stone-900/40",
+ isExpanded ? "left-64" : "left-16"
+ )}
onClick={() => setOpenSection(null)}
/>
)}
- <div data-state={isExpanded ? "open" : "closed"} className={cn("relative z-40 flex h-full flex-col border border-stone-200 bg-stone-50 dark:border-stone-800 dark:bg-stone-950", isExpanded ? "w-64" : "w-16")}>
- <Tooltip delayDuration={100}>
- <TooltipTrigger asChild>
- <Button
- variant="outline"
- size="icon"
- onClick={toggleSidebar}
- aria-label={isExpanded ? "Collapse sidebar" : "Expand sidebar"}
- aria-expanded={isExpanded}
- className={cn(
- "absolute top-5 z-50 size-6 rounded-full border-stone-300 bg-white p-0 text-stone-600 shadow-sm hover:bg-stone-100 hover:text-stone-950 focus-visible:ring-2 focus-visible:ring-primary dark:border-stone-700 dark:bg-stone-900 dark:text-stone-300 dark:hover:bg-stone-800 dark:hover:text-white",
- openSection ? "right-2" : "-right-3"
- )}
- >
- {isExpanded ? <ChevronsLeft className="size-3.5" /> : <ChevronsRight className="size-3.5" />}
- </Button>
- </TooltipTrigger>
- <TooltipContent side="right" sideOffset={10}>
- {isExpanded ? "Collapse sidebar" : "Expand sidebar"}
- </TooltipContent>
- </Tooltip>
- <div className="flex items-center gap-2 px-3 pb-3 pt-4">
- <Image className="size-9 shrink-0 object-contain" src={logoImage} alt="OpenLIT logo" priority width={36} height={36} />
- <div className={cn("min-w-0 flex-1 transition-opacity", !isExpanded && "pointer-events-none invisible opacity-0")}>
- <p className="truncate text-lg font-semibold text-stone-900 dark:text-white">OpenLIT</p>
- <p className="text-[10px] text-stone-500">v{version.version}</p>
- </div>
- </div>
-
- <div className="px-2 pb-3">
- <Button variant="outline" onClick={() => { if (!isExpanded) expandSidebar(); setCommandOpen(true); }} className={cn("h-10 w-full justify-start gap-2 border-stone-300 bg-white px-3 text-stone-500 shadow-sm dark:border-stone-700 dark:bg-stone-900", !isExpanded && "justify-center px-2")} aria-label="Search navigation">
- <Search className="size-5 shrink-0" />
+ <div data-state={isExpanded ? "open" : "closed"} className="relative z-40 flex h-full min-h-0 flex-col">
+ <div className="px-2 pb-3 pt-3">
+ <Button variant="outline" onClick={() => setCommandOpen(true)} className={cn("h-9 w-full justify-start gap-2 border-stone-200 bg-transparent px-2.5 text-[13px] text-stone-500 shadow-none hover:bg-stone-200/60 dark:border-stone-800 dark:hover:bg-stone-800/60", !isExpanded && "justify-center px-2")} aria-label="Search navigation">
+ <Search className="size-4 shrink-0" />
<span className={cn("flex-1 text-left", !isExpanded && "hidden")}>Search data</span>
- <kbd className={cn("rounded border border-stone-200 px-1.5 py-0.5 text-[10px] dark:border-stone-700", !isExpanded && "hidden")}>⌘K</kbd>
+ <kbd className={cn("rounded border border-stone-200 px-1 py-0.5 text-[10px] dark:border-stone-700", !isExpanded && "hidden")}>⌘K</kbd>
</Button>
</div>
- <div className={cn("mx-2 grid rounded-xl bg-stone-100 p-1 dark:bg-stone-900", isExpanded ? "grid-cols-2" : "grid-cols-1")}>
- <Button variant="ghost" className={cn("h-9 rounded-lg text-sm", pathname.startsWith("/chat") ? "text-stone-500" : "bg-white text-stone-950 shadow-sm dark:bg-stone-800 dark:text-white")} onClick={() => { if (!isExpanded) expandSidebar(); setOpenSection(null); router.push("/home"); }} aria-label="Browse">
- {isExpanded ? <span>Browse</span> : <LayoutGrid className="size-4" />}
- </Button>
- {isExpanded && <Link href="/chat" className={cn("flex items-center justify-center gap-2 rounded-lg text-sm font-medium text-stone-600 hover:text-stone-950 dark:text-stone-300 dark:hover:text-white", isOtterActive && "bg-white text-stone-950 shadow-sm dark:bg-stone-800 dark:text-white")}><MessageSquareText className="size-4 text-primary" />Otter</Link>}
- </div>
+ {isExpanded && (
+ <div className="mx-2 grid grid-cols-2 gap-1 rounded-lg border border-stone-200 bg-stone-100 p-1 dark:border-stone-800 dark:bg-stone-900">
+ <Button variant="ghost" className={cn("h-8 rounded-md px-2 text-[13px] text-stone-600 hover:bg-white/70 hover:text-stone-950 dark:text-stone-300 dark:hover:bg-stone-800/70 dark:hover:text-white", !openSection && !pathname.startsWith("/chat") && "bg-white text-stone-950 shadow-sm dark:bg-stone-800 dark:text-white")} onClick={() => { setOpenSection(null); router.push("/home"); }} aria-label="Browse">
+ <span>Browse</span>
+ </Button>
+ <Link href="/chat" className={cn("flex h-8 items-center justify-center gap-1.5 rounded-md px-2 text-[13px] font-medium text-stone-600 hover:bg-white/70 hover:text-stone-950 dark:text-stone-300 dark:hover:bg-stone-800/70 dark:hover:text-white", !openSection && isOtterActive && "bg-white text-stone-950 shadow-sm dark:bg-stone-800 dark:text-white")}><Otter className="size-4 shrink-0" />Otter</Link>
+ </div>
+ )}
- {isOtterActive && isExpanded ? <div className="min-h-0 grow"><OtterSidebar /></div> : <nav className="flex grow flex-col gap-1 overflow-y-auto px-2 py-4" aria-label="Product navigation">
- {SIDEBAR_ITEMS.map((item) => <PrimaryItem key={item.type === "section" ? item.title : item.text} item={item} pathname={pathname} currentUrl={currentUrl} compact={!isExpanded} openSection={openSection?.title || null} setOpenSection={setOpenSection} onExpand={expandSidebar} />)}
- {isExpanded && recentItems.length > 0 && <div className="mt-3 border-t border-stone-200 pt-3 dark:border-stone-800"><p className="px-2.5 pb-1 text-[11px] font-semibold uppercase tracking-wide text-stone-500">Recent</p>{recentItems.map((item) => <NavigationLink key={`recent-${item.link}`} item={item} active={isActive(pathname, item, currentUrl)} onNavigate={() => setOpenSection(null)} />)}</div>}
+ {isOtterActive && isExpanded ? <div className="min-h-0 grow"><OtterSidebar /></div> : <nav className="scrollbar-hidden flex grow flex-col gap-1 overflow-y-auto px-2 py-2" aria-label="Product navigation">
+ <div className="flex flex-col w-full shrink-0">
+ {SIDEBAR_ITEMS.map((item) => <PrimaryItem key={item.type === "section" ? item.title : item.text} item={item} pathname={pathname} currentUrl={currentUrl} compact={!isExpanded} openSection={openSection?.title || null} setOpenSection={setOpenSection} />)}
+ </div>
+ <MyApps
+ groups={appGroups}
+ icon={appsSectionIcon}
+ preferences={myApps}
+ compact={!isExpanded}
+ isActive={(item) => !openSection && isActive(pathname, item, currentUrl)}
+ onNavigate={() => setOpenSection(null)}
+ />
</nav>}
<div className="border-t border-stone-200 p-2 dark:border-stone-800"><UserActions /></div>
</div>
diff --git a/src/client/src/components/(playground)/sidebar/my-apps.tsx b/src/client/src/components/(playground)/sidebar/my-apps.tsx
new file mode 100644
index 00000000..7c10383e
--- /dev/null
+++ b/src/client/src/components/(playground)/sidebar/my-apps.tsx
@@ -0,0 +1,269 @@
+"use client";
+
+import Link from "next/link";
+import { type ReactElement, useState } from "react";
+import {
+ Check,
+ Copy,
+ ExternalLink,
+ MoreHorizontal,
+ Pencil,
+ Trash2,
+} from "lucide-react";
+import { toast } from "sonner";
+import { Button } from "@/components/ui/button";
+import { Checkbox } from "@/components/ui/checkbox";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import { cn } from "@/lib/utils";
+import { SidebarActionItem, SidebarGroup } from "@/types/sidebar";
+
+type MyAppsPreferences = {
+ loaded: boolean;
+ isHidden: (link: string) => boolean;
+ hide: (link: string) => void;
+ toggle: (link: string) => void;
+};
+
+const rowClassName = (active: boolean) =>
+ cn(
+ "flex min-w-0 flex-1 items-center gap-2 rounded-lg px-2.5 py-2 text-left text-[13px] font-medium transition-colors",
+ active
+ ? "bg-stone-200 text-stone-950 dark:bg-stone-800 dark:text-white"
+ : "text-stone-600 hover:bg-stone-200/70 hover:text-stone-950 dark:text-stone-300 dark:hover:bg-stone-800 dark:hover:text-white"
+ );
+
+function copyLink(link: string) {
+ try {
+ const absolute = new URL(link, window.location.origin).toString();
+ navigator.clipboard.writeText(absolute);
+ toast.success("Link copied to clipboard");
+ } catch {
+ toast.error("Could not copy link");
+ }
+}
+
+function AppRow({
+ item,
+ active,
+ onNavigate,
+ onRemove,
+}: {
+ item: SidebarActionItem;
+ active: boolean;
+ onNavigate: () => void;
+ onRemove: (link: string) => void;
+}) {
+ const link = item.link ?? "#";
+
+ return (
+ <div className="group/app relative flex items-center">
+ <Link href={link} onClick={onNavigate} aria-current={active ? "page" : undefined} className={rowClassName(active)}>
+ {item.icon}
+ <span className="min-w-0 truncate">{item.text}</span>
+ </Link>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ variant="ghost"
+ size="icon"
+ aria-label={`Options for ${item.text}`}
+ className="absolute right-1 size-7 text-stone-400 opacity-0 transition-opacity hover:bg-stone-200 hover:text-stone-700 focus-visible:opacity-100 group-hover/app:opacity-100 data-[state=open]:opacity-100 dark:hover:bg-stone-800 dark:hover:text-stone-200"
+ onClick={(event) => event.stopPropagation()}
+ >
+ <MoreHorizontal className="size-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent side="right" align="start" className="w-56">
+ <DropdownMenuItem
+ className="gap-2 text-xs"
+ onClick={() =>
+ window.open(link, "_blank", "noopener,noreferrer")
+ }
+ >
+ <ExternalLink className="size-4" />
+ Open link in new browser tab
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ className="gap-2 text-xs"
+ onClick={() => copyLink(link)}
+ >
+ <Copy className="size-4" />
+ Copy link address
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ className="gap-2 text-xs text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400"
+ onClick={() => onRemove(link)}
+ >
+ <Trash2 className="size-4" />
+ Remove from sidebar
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ );
+}
+
+function EditRow({
+ item,
+ checked,
+ onToggle,
+}: {
+ item: SidebarActionItem;
+ checked: boolean;
+ onToggle: (link: string) => void;
+}) {
+ const link = item.link ?? "#";
+
+ return (
+ <label className="flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-2 text-[13px] font-medium text-stone-600 hover:bg-stone-200/70 dark:text-stone-300 dark:hover:bg-stone-800">
+ <Checkbox
+ checked={checked}
+ onCheckedChange={() => onToggle(link)}
+ aria-label={`${checked ? "Remove" : "Add"} ${item.text}`}
+ />
+ {item.icon}
+ <span className="min-w-0 truncate">{item.text}</span>
+ </label>
+ );
+}
+
+export default function MyApps({
+ groups,
+ icon,
+ preferences,
+ compact,
+ isActive,
+ onNavigate,
+}: {
+ groups: SidebarGroup[];
+ icon?: ReactElement;
+ preferences: MyAppsPreferences;
+ compact: boolean;
+ isActive: (item: SidebarActionItem) => boolean;
+ onNavigate: () => void;
+}) {
+ const { loaded, isHidden, hide, toggle } = preferences;
+ const [editing, setEditing] = useState(false);
+
+ const linkedGroups = groups
+ .map((group) => ({
+ title: group.title,
+ children: group.children.filter((item) => item.link && !item.target),
+ }))
+ .filter((group) => group.children.length > 0);
+
+ const hasAnyVisible = linkedGroups.some((group) =>
+ group.children.some((item) => !isHidden(item.link!))
+ );
+
+ if (!loaded) {
+ return null;
+ }
+
+ if (compact) {
+ if (!hasAnyVisible) {
+ return null;
+ }
+ return (
+ <div className="mt-2 flex flex-col gap-1 border-t border-stone-200 pt-2 dark:border-stone-800">
+ {linkedGroups
+ .flatMap((group) => group.children)
+ .filter((item) => !isHidden(item.link!))
+ .map((item) => (
+ <Tooltip key={item.link} delayDuration={100}>
+ <TooltipTrigger asChild>
+ <Link
+ href={item.link!}
+ onClick={onNavigate}
+ aria-current={isActive(item) ? "page" : undefined}
+ className={cn(
+ "flex w-full items-center justify-center rounded-lg px-2.5 py-2 transition-colors",
+ isActive(item)
+ ? "bg-stone-200 text-stone-950 dark:bg-stone-800 dark:text-white"
+ : "text-stone-600 hover:bg-stone-200/70 hover:text-stone-950 dark:text-stone-300 dark:hover:bg-stone-800 dark:hover:text-white"
+ )}
+ >
+ {item.icon}
+ </Link>
+ </TooltipTrigger>
+ <TooltipContent side="right" sideOffset={8}>
+ {item.text}
+ </TooltipContent>
+ </Tooltip>
+ ))}
+ </div>
+ );
+ }
+
+ return (
+ <div className="mt-2 border-t border-stone-200 pt-2 dark:border-stone-800">
+ <div className="flex items-center justify-between px-2 pb-1">
+ <div className="flex min-w-0 items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-stone-500">
+ {icon}
+ <span>My apps</span>
+ </div>
+ <Button
+ variant="ghost"
+ size="icon"
+ onClick={() => setEditing((value) => !value)}
+ aria-label={editing ? "Done editing my apps" : "Edit my apps"}
+ aria-pressed={editing}
+ className="size-7 text-stone-400 hover:bg-stone-200 hover:text-stone-700 dark:hover:bg-stone-800 dark:hover:text-stone-200"
+ >
+ {editing ? <Check className="size-4" /> : <Pencil className="size-4" />}
+ </Button>
+ </div>
+
+ {!editing && !hasAnyVisible ? (
+ <p className="px-2.5 py-1 text-xs text-stone-400 dark:text-stone-500">
+ Open an app to add it back here.
+ </p>
+ ) : null}
+
+ {linkedGroups.map((group) => {
+ const visible = editing
+ ? group.children
+ : group.children.filter((item) => !isHidden(item.link!));
+ if (visible.length === 0) return null;
+
+ return (
+ <div key={group.title} className="mb-1.5">
+ <p className="px-2.5 pb-0.5 pt-1 text-xs font-medium uppercase tracking-wide text-stone-400 dark:text-stone-500">
+ {group.title}
+ </p>
+ {visible.map((item) =>
+ editing ? (
+ <EditRow
+ key={item.link}
+ item={item}
+ checked={!isHidden(item.link!)}
+ onToggle={toggle}
+ />
+ ) : (
+ <AppRow
+ key={item.link}
+ item={item}
+ active={isActive(item)}
+ onNavigate={onNavigate}
+ onRemove={hide}
+ />
+ )
+ )}
+ </div>
+ );
+ })}
+ </div>
+ );
+}
diff --git a/src/client/src/components/(playground)/sidebar/organisation-switch.tsx b/src/client/src/components/(playground)/sidebar/organisation-switch.tsx
index 23a6a216..b0ae04ee 100644
--- a/src/client/src/components/(playground)/sidebar/organisation-switch.tsx
+++ b/src/client/src/components/(playground)/sidebar/organisation-switch.tsx
@@ -1,5 +1,5 @@
"use client";
-import { Plus, Mail } from "lucide-react";
+import { Plus, Mail, ChevronDown } from "lucide-react";
import {
getCurrentOrganisation,
getOrganisationList,
@@ -18,13 +18,13 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { Button } from "@/components/ui/button";
import Link from "next/link";
import { Badge } from "@/components/ui/badge";
import CreateOrganisationDialog from "./create-organisation-dialog";
import getMessage from "@/constants/messages";
import { CLIENT_EVENTS } from "@/constants/events";
import { cn } from "@/lib/utils";
+import { headerScopeTriggerClassName } from "../header-scope-pill";
type OrganisationSwitchProps = {
className?: string;
@@ -32,7 +32,7 @@ type OrganisationSwitchProps = {
contentSide?: "bottom" | "left" | "right" | "top";
};
-const triggerClasses = "flex h-9 min-w-36 max-w-64 shrink-0 items-center justify-start overflow-hidden px-3 py-1.5 text-left font-normal relative";
+const triggerClasses = headerScopeTriggerClassName;
export default function OrganisationSwitch({
className,
@@ -59,13 +59,8 @@ export default function OrganisationSwitch({
<>
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <Button
- variant="outline"
- className={cn(triggerClasses, className)}
- >
- <span className="min-w-0 grow truncate text-xs font-medium">
- {currentOrg?.name}
- </span>
+ <button type="button" className={cn(triggerClasses, className)}>
+ <span className="min-w-0 truncate">{currentOrg?.name}</span>
{pendingInvitationsCount > 0 && (
<Badge
variant="destructive"
@@ -74,7 +69,8 @@ export default function OrganisationSwitch({
{pendingInvitationsCount}
</Badge>
)}
- </Button>
+ <ChevronDown className="size-3 shrink-0 opacity-50" />
+ </button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-56" side={contentSide} align={contentAlign}>
<DropdownMenuLabel>{messages.ORGANISATIONS}</DropdownMenuLabel>
diff --git a/src/client/src/components/(playground)/sidebar/otter-sidebar.tsx b/src/client/src/components/(playground)/sidebar/otter-sidebar.tsx
index 15b9324f..004c5ef9 100644
--- a/src/client/src/components/(playground)/sidebar/otter-sidebar.tsx
+++ b/src/client/src/components/(playground)/sidebar/otter-sidebar.tsx
@@ -58,8 +58,8 @@ export default function OtterSidebar() {
<ConversationList conversations={conversations} activeId={activeId} onSelect={(id) => router.push(`/chat?id=${id}`)} onDelete={deleteConversation} onNew={() => router.push("/chat")} isLoading={isLoading} />
</div>
<div className="flex gap-1 border-t border-stone-200 p-2 dark:border-stone-800">
- <Button asChild variant="ghost" size="sm" className="h-8 flex-1 justify-start gap-2 text-xs text-stone-600 dark:text-stone-300"><Link href="/chat/usage"><BarChart3 className="size-3.5" />{messages.CHAT_OTTER_USAGE}</Link></Button>
- <Button asChild variant="ghost" size="icon" className="size-8 text-stone-600 dark:text-stone-300"><Link href="/chat/settings" aria-label="Otter settings"><Settings className="size-3.5" /></Link></Button>
+ <Button asChild variant="ghost" size="sm" className="h-8 flex-1 justify-start gap-2 text-[13px] text-stone-600 dark:text-stone-300"><Link href="/chat/usage"><BarChart3 className="size-4" />{messages.CHAT_OTTER_USAGE}</Link></Button>
+ <Button asChild variant="ghost" size="icon" className="size-8 text-stone-600 dark:text-stone-300"><Link href="/chat/settings" aria-label="Otter settings"><Settings className="size-4" /></Link></Button>
</div>
</div>
);
diff --git a/src/client/src/components/(playground)/sidebar/user-actions.tsx b/src/client/src/components/(playground)/sidebar/user-actions.tsx
index 9460723e..d88b98bd 100644
--- a/src/client/src/components/(playground)/sidebar/user-actions.tsx
+++ b/src/client/src/components/(playground)/sidebar/user-actions.tsx
@@ -11,7 +11,7 @@ import { useEffect } from "react";
import getMessage from "@/constants/messages";
import { escapeEmailForDisplay } from "@/utils/string";
-const DROPDOWN_MENU_ITEM_CLASS = "flex w-full text-xs gap-2 hover:bg-primary/10 dark:hover:bg-primary/10 px-2 py-1.5";
+const DROPDOWN_MENU_ITEM_CLASS = "flex w-full text-[13px] gap-2 hover:bg-primary/10 dark:hover:bg-primary/10 px-2 py-1.5";
const DROPDOWN_MENU_ICON_CLASS = "w-4 h-4";
export default function UserActions() {
@@ -37,12 +37,12 @@ export default function UserActions() {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <Button variant="outline" className="flex gap-2 justify-start group-data-[state=close]:justify-center p-[calc(0.625rem-1px)] overflow-hidden text-stone-500 dark:text-stone-300 hover:bg-stone-700 dark:hover:bg-stone-600 hover:text-white font-normal w-full">
+ <Button variant="ghost" className="flex gap-2 justify-start group-data-[state=close]:justify-center p-[calc(0.625rem-1px)] overflow-hidden border border-transparent bg-transparent shadow-none text-stone-500 dark:text-stone-300 hover:bg-stone-200/70 hover:text-stone-950 dark:hover:bg-stone-800 dark:hover:text-white font-normal w-full">
<Avatar className={"h-5 w-5 rounded-lg"}>
<AvatarImage className="rounded-full" src={user!.image || ""} alt={user!.name || ""} />
<AvatarFallback className="rounded-lg bg-transparent dark:bg-transparent">{user!.name?.substring(0, 2) || displayEmail.substring(0, 2)}</AvatarFallback>
</Avatar>
- <div className="grid flex-1 text-left text-xs leading-tight group-data-[state=close]:hidden text-ellipsis overflow-hidden whitespace-nowrap">
+ <div className="grid flex-1 text-left text-[13px] leading-tight group-data-[state=close]:hidden text-ellipsis overflow-hidden whitespace-nowrap">
<span className="truncate font-medium">{user!.name}</span>
<span className="truncate text-xs">{displayEmail}</span>
</div>
@@ -63,7 +63,7 @@ export default function UserActions() {
</Avatar>
<div className="grid flex-1 text-left text-xs leading-tight text-ellipsis overflow-hidden whitespace-nowrap">
<span className="truncate font-medium">{user!.name}</span>
- <span className="truncate text-xs">{displayEmail}</span>
+ <span className="truncate text-[13px]">{displayEmail}</span>
</div>
</div>
</DropdownMenuLabel>
diff --git a/src/client/src/components/(playground)/vault/header.tsx b/src/client/src/components/(playground)/vault/header.tsx
index 999f92a9..4a98b2e7 100644
--- a/src/client/src/components/(playground)/vault/header.tsx
+++ b/src/client/src/components/(playground)/vault/header.tsx
@@ -24,7 +24,7 @@ export default function VaultHeader({
<SecretForm successCallback={successCallback}>
<Button
variant="secondary"
- className="bg-primary hover:bg-primary dark:bg-primary dark:hover:bg-primary text-stone-100 dark:text-stone-100 px-8 h-9 py-0.5"
+ className="bg-primary hover:bg-primary dark:bg-primary dark:hover:bg-primary text-stone-100 dark:text-stone-100 px-8 h-8"
>
Create new
</Button>
@@ -33,5 +33,5 @@ export default function VaultHeader({
</div>
);
- return <FeaturePageHeader eyebrow="Resources" title={messages.FEATURE_VAULT} description="Centralize sensitive values and runtime secrets so AI workflows stay portable without exposing credentials." icon={<BookKey className="h-4 w-4" />} tone="border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/70 dark:bg-amber-950/40 dark:text-amber-300" actions={actions} />;
+ return <FeaturePageHeader eyebrow="Resources" title={messages.FEATURE_VAULT} icon={<BookKey className="h-4 w-4" />} tone="border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/70 dark:bg-amber-950/40 dark:text-amber-300" actions={actions} />;
}
diff --git a/src/client/src/components/(playground)/vault/usage.tsx b/src/client/src/components/(playground)/vault/usage.tsx
index cc46ae8a..a72660fe 100644
--- a/src/client/src/components/(playground)/vault/usage.tsx
+++ b/src/client/src/components/(playground)/vault/usage.tsx
@@ -7,7 +7,7 @@ export default function VaultUsage() {
return (
<div className="flex">
<Link href={documentationLinks.vault} target="_blank" rel="noopener noreferrer">
- <Button variant="outline" className="flex gap-2 px-8 h-9 py-1 rounded-md font-normal text-stone-600">
+ <Button variant="outline" className="flex gap-2 px-8 h-8 rounded-md font-normal text-stone-600">
<BookText className="w-4 h-4" />
Learn more
</Button>
diff --git a/src/client/src/components/ui/tabs.tsx b/src/client/src/components/ui/tabs.tsx
index 716db580..bae329dc 100644
--- a/src/client/src/components/ui/tabs.tsx
+++ b/src/client/src/components/ui/tabs.tsx
@@ -14,7 +14,7 @@ const TabsList = React.forwardRef<
<TabsPrimitive.List
ref={ref}
className={cn(
- "inline-flex h-10 items-center justify-center rounded-md bg-stone-200/[0.5] p-1 text-stone-500 dark:bg-stone-800 dark:text-stone-400",
+ "inline-flex h-10 items-center justify-center rounded-md bg-stone-200/[0.5] p-1 text-stone-600 dark:bg-stone-800 dark:text-stone-400",
className
)}
{...props}
diff --git a/src/client/src/constants/messages/en.ts b/src/client/src/constants/messages/en.ts
index d835eead..bbe4b219 100644
--- a/src/client/src/constants/messages/en.ts
+++ b/src/client/src/constants/messages/en.ts
@@ -107,7 +107,7 @@ export const EVALUATION_MANUAL_STEP_2 =
"Click the Evaluation tab in the trace details";
export const EVALUATION_MANUAL_STEP_3 =
'Click "Run Evaluation" to evaluate the trace';
-export const EVALUATION_GO_TO_REQUESTS = "Go to Requests";
+export const EVALUATION_GO_TO_TRACES = "Go to Traces";
export const EVALUATION_MANUAL_AND_AUTO = "Manual & Auto";
export const EVALUATION_MANUAL_AND_AUTO_DESCRIPTION =
"Manual and Auto evaluations use the Rule Engine context applied in evaluation types when rules match the trace. Manual runs are stored with source=manual; Auto runs are stored with source=auto.";
@@ -448,7 +448,7 @@ export const PRICING_MANUAL_STEP_2 =
'Click "Recalculate Cost" in the trace detail panel.';
export const PRICING_MANUAL_STEP_3 =
"The gen_ai.usage.cost attribute is updated using the latest model pricing.";
-export const PRICING_GO_TO_REQUESTS = "Go to Requests";
+export const PRICING_GO_TO_TRACES = "Go to Traces";
export const PRICING_SAVE = "Save";
export const PRICING_UPDATE = "Update";
export const PRICING_CONFIG_SAVED = "Pricing config saved";
@@ -483,6 +483,7 @@ export const FEATURE_OPENGROUND = "Openground";
export const FEATURE_PROMPTS = "Prompt Hub";
export const FEATURE_VAULT = "Vault";
export const FEATURE_FLEET_HUB = "Fleet Hub";
+export const FEATURE_AGENTS = "Agents";
// Agents
export const AGENTS_FILTER_SYSTEM = "System";
@@ -960,6 +961,7 @@ export const VARIABLES = "Variables";
export const PROMPT = "Prompt";
export const PROMPT_PREVIEW = "Prompt Preview";
export const PROMPT_HUB = "Prompt Hub";
+export const NAV_APP_PROMPTS = "Prompts";
export const PROVIDERS = "Providers";
export const NO_DATA_FOUND = "No data found!";
export const CANNOT_CONNECT_TO_SERVER = "Cannot connect to server!";
diff --git a/src/client/src/constants/messages/hi.ts b/src/client/src/constants/messages/hi.ts
index 6cdf8d0c..e509dd6d 100644
--- a/src/client/src/constants/messages/hi.ts
+++ b/src/client/src/constants/messages/hi.ts
@@ -88,7 +88,7 @@ export const EVALUATION_MANUAL_STEP_2 =
"ट्रेस विवरण में इवैल्यूएशन टैब पर क्लिक करें";
export const EVALUATION_MANUAL_STEP_3 =
'इवैल्यूएशन चलाने के लिए "Run Evaluation" पर क्लिक करें';
-export const EVALUATION_GO_TO_REQUESTS = "रिक्वेस्ट पर जाएं";
+export const EVALUATION_GO_TO_TRACES = "ट्रेस पर जाएं";
export const EVALUATION_MANUAL_AND_AUTO = "मैनुअल & ऑटो";
export const EVALUATION_MANUAL_AND_AUTO_DESCRIPTION =
"मैनुअल और ऑटो इवैल्यूएशन रूल इंजन कॉन्टेक्स्ट का उपयोग करते हैं जब नियम ट्रेस से मेल खाते हैं। मैनुअल रन source=manual के साथ संग्रहीत होते हैं; ऑटो रन source=auto का उपयोग करते हैं।";
diff --git a/src/client/src/constants/sidebar.tsx b/src/client/src/constants/sidebar.tsx
index 597c54f0..fdc9c1dc 100644
--- a/src/client/src/constants/sidebar.tsx
+++ b/src/client/src/constants/sidebar.tsx
@@ -7,9 +7,11 @@ import {
BookOpen,
BookText,
Bot,
+ Boxes,
Building2,
CircleDollarSign,
Component,
+ Cpu,
Home,
Key,
LayoutDashboard,
@@ -20,7 +22,7 @@ import {
User,
} from "lucide-react";
-export const ICON_CLASSES = "flex-shrink-0 size-5";
+export const ICON_CLASSES = "flex-shrink-0 size-4";
export const SIDEBAR_ITEMS: SidebarItemProps[] = [
{
@@ -36,101 +38,106 @@ export const SIDEBAR_ITEMS: SidebarItemProps[] = [
type: "action",
},
{
- title: "Monitoring",
+ title: "Apps",
type: "section",
- children: [
- {
- icon: <Activity className={ICON_CLASSES} />,
- text: "Telemetry",
- link: "/telemetry",
- type: "action",
- },
- ...getEnterpriseSidebarItems("monitoring", ICON_CLASSES),
- {
- icon: <Bot className={ICON_CLASSES} />,
- text: "Agents",
- link: "/agents",
- type: "action",
- },
- {
- icon: <OpenTelemetrySvg className={ICON_CLASSES} />,
- text: "Fleet Hub",
- link: "/fleet-hub",
- type: "action",
- },
- ],
- },
- {
- title: "Resources",
- type: "section",
- children: [
- {
- icon: <Component className={ICON_CLASSES} />,
- text: "Prompt Hub",
- link: "/prompt-hub",
- type: "action",
- },
- {
- icon: <BookKey className={ICON_CLASSES} />,
- text: "Vault",
- link: "/vault",
- type: "action",
- },
+ icon: <Boxes className={ICON_CLASSES} />,
+ groups: [
{
- icon: <BookOpen className={ICON_CLASSES} />,
- text: "Contexts",
- link: "/context",
- type: "action",
+ title: "Monitoring",
+ children: [
+ {
+ icon: <Activity className={ICON_CLASSES} />,
+ text: "Telemetry",
+ link: "/telemetry",
+ type: "action",
+ },
+ ...getEnterpriseSidebarItems("monitoring", ICON_CLASSES),
+ {
+ icon: <Bot className={ICON_CLASSES} />,
+ text: "Agents",
+ link: "/agents",
+ type: "action",
+ },
+ {
+ icon: <OpenTelemetrySvg className={ICON_CLASSES} />,
+ text: "Fleet Hub",
+ link: "/fleet-hub",
+ type: "action",
+ },
+ ],
},
{
- icon: <SlidersHorizontal className={ICON_CLASSES} />,
- text: "Rule Engine",
- link: "/rule-engine",
- type: "action",
+ title: "Resources",
+ children: [
+ {
+ icon: <Component className={ICON_CLASSES} />,
+ text: "Prompt Hub",
+ link: "/prompt-hub",
+ type: "action",
+ },
+ {
+ icon: <BookKey className={ICON_CLASSES} />,
+ text: "Vault",
+ link: "/vault",
+ type: "action",
+ },
+ {
+ icon: <BookOpen className={ICON_CLASSES} />,
+ text: "Contexts",
+ link: "/context",
+ type: "action",
+ },
+ {
+ icon: <SlidersHorizontal className={ICON_CLASSES} />,
+ text: "Rule Engine",
+ link: "/rule-engine",
+ type: "action",
+ },
+ {
+ icon: <MonitorPlay className={ICON_CLASSES} />,
+ text: "Openground",
+ link: "/openground",
+ type: "action",
+ },
+ ],
},
{
- icon: <MonitorPlay className={ICON_CLASSES} />,
- text: "Openground",
- link: "/openground",
- type: "action",
- },
- ],
- },
- {
- title: "Configuration",
- type: "section",
- children: [
+ title: "Configuration",
+ children: [
+ {
+ icon: <MonitorCog className={ICON_CLASSES} />,
+ text: "Evaluations",
+ link: "/evaluations",
+ type: "action",
+ },
{
- icon: <MonitorCog className={ICON_CLASSES} />,
- text: "Evaluations",
- link: "/evaluations",
- type: "action",
- },
- {
- icon: <SettingsIcon className={ICON_CLASSES} />,
+ icon: <Cpu className={ICON_CLASSES} />,
text: "Manage Models",
link: "/manage-models",
type: "action",
},
- {
- icon: <CircleDollarSign className={ICON_CLASSES} />,
- text: "Pricing",
- link: "/pricing",
- type: "action",
- },
- {
- icon: <Building2 className={ICON_CLASSES} />,
- text: "Organisation",
- link: "/organisation",
- type: "action",
+ {
+ icon: <CircleDollarSign className={ICON_CLASSES} />,
+ text: "Pricing",
+ link: "/pricing",
+ type: "action",
+ },
+ {
+ icon: <Building2 className={ICON_CLASSES} />,
+ text: "Organisation",
+ link: "/organisation",
+ type: "action",
+ },
+ ...getEnterpriseSidebarItems("configuration", ICON_CLASSES),
+ ],
},
- ...getEnterpriseSidebarItems("configuration", ICON_CLASSES),
],
},
{
title: "Settings",
type: "section",
collapsible: true,
+ icon: <SettingsIcon className={ICON_CLASSES} />,
children: [
{
icon: <User className={ICON_CLASSES} />,
diff --git a/src/client/src/selectors/dashboards.ts b/src/client/src/selectors/dashboards.ts
index c30c8aba..82b1ac99 100644
--- a/src/client/src/selectors/dashboards.ts
+++ b/src/client/src/selectors/dashboards.ts
@@ -1,10 +1,7 @@
import { useRootStore } from "@/store";
-export const useDashboardPageSearch = () => {
- const store = useRootStore();
- return store.dashboards.page.search;
-}
-export const useSetDashboardPageSearch = () => {
- const store = useRootStore();
- return store.dashboards.setPageSearch;
-}
\ No newline at end of file
+export const useDashboardPageSearch = () =>
+ useRootStore((state) => state.dashboards.page.search);
+
+export const useSetDashboardPageSearch = () =>
+ useRootStore((state) => state.dashboards.setPageSearch);
diff --git a/src/client/src/types/sidebar.ts b/src/client/src/types/sidebar.ts
index c24e39e9..550672f3 100644
--- a/src/client/src/types/sidebar.ts
+++ b/src/client/src/types/sidebar.ts
@@ -1,11 +1,22 @@
import { ReactElement } from "react";
+export type SidebarGroup = {
+ title: string;
+ children: SidebarActionItem[];
+}
+
export type SidebarSection = {
title: string;
type: "section";
collapsible?: boolean;
className?: string;
+ icon?: ReactElement;
children?: SidebarActionItem[];
+ /**
+ * When set, the section renders inline with grouped sub-headers
+ * (e.g. the "Apps" section) instead of as a flyout panel.
+ */
+ groups?: SidebarGroup[];
}
export type SidebarActionItem = {
diff --git a/src/client/src/utils/active-app.ts b/src/client/src/utils/active-app.ts
new file mode 100644
index 00000000..6f2874a3
--- /dev/null
+++ b/src/client/src/utils/active-app.ts
@@ -0,0 +1,79 @@
+import getMessage from "@/constants/messages";
+import { SIDEBAR_ITEMS } from "@/constants/sidebar";
+import { SidebarActionItem, SidebarItemProps } from "@/types/sidebar";
+
+export type ActiveApp = {
+ title: string;
+ href: string;
+};
+
+const HEADER_APP_LABEL_OVERRIDES: Record<string, keyof ReturnType<typeof getMessage>> =
+ {
+ "/prompt-hub": "NAV_APP_PROMPTS",
+ };
+
+function flattenSidebarActions(items: SidebarItemProps[]): SidebarActionItem[] {
+ return items.flatMap((item) => {
+ if (item.type !== "section") return [item];
+ const direct = item.children ?? [];
+ const grouped = (item.groups ?? []).flatMap((group) => group.children);
+ return [...direct, ...grouped];
+ });
+}
+
+function matchesAppPath(pathname: string, link: string): boolean {
+ if (link === "/dashboards") {
+ return pathname.startsWith("/dashboards") || pathname.startsWith("/d/");
+ }
+
+ return pathname === link || pathname.startsWith(`${link}/`);
+}
+
+function getHeaderAppLabel(link: string, sidebarText: string): string {
+ const messageKey = HEADER_APP_LABEL_OVERRIDES[link];
+ if (messageKey) {
+ return getMessage()[messageKey] as string;
+ }
+
+ return sidebarText;
+}
+
+function resolveApp(link: string, sidebarText: string): ActiveApp {
+ return {
+ title: getHeaderAppLabel(link, sidebarText),
+ href: link,
+ };
+}
+
+export function getActiveApp(pathname: string): ActiveApp | null {
+ if (pathname.startsWith("/onboarding")) {
+ return null;
+ }
+
+ if (pathname.startsWith("/coding-agents")) {
+ const agents = flattenSidebarActions(SIDEBAR_ITEMS).find(
+ (item) => item.link === "/agents"
+ );
+ return agents?.link
+ ? resolveApp(agents.link, agents.text)
+ : { title: "Agents", href: "/agents" };
+ }
+
+ if (pathname.startsWith("/chat")) {
+ return { title: getMessage().CHAT_TITLE, href: "/chat" };
+ }
+
+ const actions = flattenSidebarActions(SIDEBAR_ITEMS)
+ .filter((item) => item.link && !item.target)
+ .sort((a, b) => (b.link?.length || 0) - (a.link?.length || 0));
+
+ const match = actions.find(
+ (item) => item.link && matchesAppPath(pathname, item.link)
+ );
+
+ if (!match?.link) {
+ return null;
+ }
+
+ return resolveApp(match.link, match.text);
+}
diff --git a/src/client/src/utils/breadcrumbs.ts b/src/client/src/utils/breadcrumbs.ts
index 8250bc83..af20bbba 100644
--- a/src/client/src/utils/breadcrumbs.ts
+++ b/src/client/src/utils/breadcrumbs.ts
@@ -87,10 +87,8 @@ export const ROUTE_CONFIGS: RouteConfig[] = [
// Individual dashboard view
{
regex: /^\/d\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,
- getTitle: () => "Dashboard",
- getBreadcrumbs: () => [
- { title: "Dashboards", href: "/dashboards" }
- ],
+ getTitle: () => "",
+ getBreadcrumbs: () => [],
},
// Dashboard management
@@ -139,23 +137,23 @@ export const ROUTE_CONFIGS: RouteConfig[] = [
},
{
regex: /^\/telemetry\/traces\/[^/]+$/,
- getTitle: () => "Trace Details",
- getBreadcrumbs: () => [{ title: "Telemetry", href: "/telemetry?tab=traces" }],
+ getTitle: () => "",
+ getBreadcrumbs: () => [],
},
{
regex: /^\/telemetry\/exceptions\/[^/]+$/,
- getTitle: () => "Exception Details",
- getBreadcrumbs: () => [{ title: "Telemetry", href: "/telemetry?tab=exceptions" }],
+ getTitle: () => "",
+ getBreadcrumbs: () => [],
},
{
regex: /^\/telemetry\/logs\/[^/]+$/,
- getTitle: () => "Log Details",
- getBreadcrumbs: () => [{ title: "Telemetry", href: "/telemetry?tab=logs" }],
+ getTitle: () => "",
+ getBreadcrumbs: () => [],
},
{
regex: /^\/telemetry\/metrics\/[^/]+$/,
- getTitle: () => "Metric Details",
- getBreadcrumbs: () => [{ title: "Telemetry", href: "/telemetry?tab=metrics" }],
+ getTitle: () => "",
+ getBreadcrumbs: () => [],
},
// Exceptions
@@ -168,19 +166,23 @@ export const ROUTE_CONFIGS: RouteConfig[] = [
// Prompt Hub
{
regex: /^\/prompt-hub$/,
- getTitle: () => "Prompt Hub",
+ getTitle: () => getMessage().NAV_APP_PROMPTS,
+ getBreadcrumbs: () => [],
+ },
+ {
+ regex: /^\/prompt-hub\/new$/,
+ getTitle: () => getMessage().PROMPT_HUB_CREATE_PROMPT,
+ getBreadcrumbs: () => [],
+ },
+ {
+ regex: /^\/prompt-hub\/[^/]+\/edit$/,
+ getTitle: () => "",
getBreadcrumbs: () => [],
},
-
{
regex: /^\/prompt-hub\/[^/]+$/,
- getTitle: (pathname, params) => {
- // In a real app, you might want to fetch the prompt name
- return params?.id ? "Prompt Details" : "Prompt";
- },
- getBreadcrumbs: () => [
- { title: "Prompt Hub", href: "/prompt-hub" }
- ],
+ getTitle: () => "",
+ getBreadcrumbs: () => [],
},
// Vault
@@ -192,10 +194,20 @@ export const ROUTE_CONFIGS: RouteConfig[] = [
{
regex: /^\/vault\/[^/]+$/,
- getTitle: () => "Vault Item",
- getBreadcrumbs: () => [
- { title: "Vault", href: "/vault" }
- ],
+ getTitle: () => "",
+ getBreadcrumbs: () => [],
+ },
+
+ // Rule Engine
+ {
+ regex: /^\/rule-engine$/,
+ getTitle: () => getMessage().RULE_ENGINE_BREADCRUMB,
+ getBreadcrumbs: () => [],
+ },
+ {
+ regex: /^\/rule-engine\/[^/]+$/,
+ getTitle: () => "",
+ getBreadcrumbs: () => [],
},
// Openground
@@ -217,6 +229,23 @@ export const ROUTE_CONFIGS: RouteConfig[] = [
],
},
+ // Context
+ {
+ regex: /^\/context$/,
+ getTitle: () => getMessage().CONTEXT_TITLE,
+ getBreadcrumbs: () => [],
+ },
+ {
+ regex: /^\/context\/new$/,
+ getTitle: () => getMessage().CONTEXT_CREATE_NEW,
+ getBreadcrumbs: () => [],
+ },
+ {
+ regex: /^\/context\/[^/]+$/,
+ getTitle: () => "",
+ getBreadcrumbs: () => [],
+ },
+
// Settings
{
regex: /^\/settings$/,
@@ -227,9 +256,7 @@ export const ROUTE_CONFIGS: RouteConfig[] = [
{
regex: /^\/settings\/profile$/,
getTitle: () => "User Profile",
- getBreadcrumbs: () => [
- { title: "Settings", href: "/settings" }
- ],
+ getBreadcrumbs: () => [],
},
{
@@ -274,10 +301,8 @@ export const ROUTE_CONFIGS: RouteConfig[] = [
{
regex: /^\/settings\/api-keys$/,
- getTitle: () => "API Keys",
- getBreadcrumbs: () => [
- { title: "Settings", href: "/settings" }
- ],
+ getTitle: () => "Api Keys",
+ getBreadcrumbs: () => [],
},
// Agents
@@ -289,27 +314,26 @@ export const ROUTE_CONFIGS: RouteConfig[] = [
{
regex: /^\/agents\/controller\/[^/]+$/,
- getTitle: () => "Controller",
- getBreadcrumbs: () => [
- { title: "Agents", href: "/agents" }
- ],
+ getTitle: () => "",
+ getBreadcrumbs: () => [],
},
{
regex: /^\/agents\/[^/]+$/,
- getTitle: () => "Service Detail",
- getBreadcrumbs: () => [
- { title: "Agents", href: "/agents" }
- ],
+ getTitle: () => "",
+ getBreadcrumbs: () => [],
},
// Fleet Hub
+ {
+ regex: /^\/fleet-hub$/,
+ getTitle: () => getMessage().FEATURE_FLEET_HUB,
+ getBreadcrumbs: () => [],
+ },
{
regex: /^\/fleet-hub\/[^/]+$/,
- getTitle: () => "Fleet Hub",
- getBreadcrumbs: () => [
- { title: "Fleet Hub", href: "/fleet-hub" }
- ],
+ getTitle: () => "",
+ getBreadcrumbs: () => [],
},
// Coding Agents — per-user drilldown.
diff --git a/src/client/src/utils/date.ts b/src/client/src/utils/date.ts
index 797df432..c0a84d05 100644
--- a/src/client/src/utils/date.ts
+++ b/src/client/src/utils/date.ts
@@ -1,12 +1,20 @@
export function parseDateString(dateString: string) {
if (!dateString) return null;
+ const hasTimeComponent =
+ dateString.includes("T") || dateString.includes(" ");
const normalizedDate = dateString.includes("T")
? dateString
: dateString.replace(" ", "T");
- const timestamp = /(?:Z|[+-]\d{2}:\d{2})$/.test(normalizedDate)
- ? normalizedDate
- : `${normalizedDate}Z`;
+
+ // A bare calendar date (e.g. "2020-01-01") carries no timezone, so parse it
+ // at local midnight to preserve the calendar day. Full timestamps are treated
+ // as UTC unless they already carry an explicit offset.
+ const timestamp = !hasTimeComponent
+ ? `${normalizedDate}T00:00:00`
+ : /(?:Z|[+-]\d{2}:\d{2})$/.test(normalizedDate)
+ ? normalizedDate
+ : `${normalizedDate}Z`;
const date = new Date(timestamp);
return Number.isNaN(date.getTime()) ? null : date;
diff --git a/src/client/src/utils/hooks/useSidebarPreferences.ts b/src/client/src/utils/hooks/useSidebarPreferences.ts
new file mode 100644
index 00000000..5382dc83
--- /dev/null
+++ b/src/client/src/utils/hooks/useSidebarPreferences.ts
@@ -0,0 +1,90 @@
+"use client";
+
+import { useCallback, useEffect, useState } from "react";
+
+/**
+ * Per-user "My apps" customization.
+ *
+ * By default every app from the Apps panel is shown in the inline
+ * "My apps" section. We only persist the *delta* — the set of app links
+ * the user has removed — so a typical user stores a handful of short
+ * strings (tens of bytes). Opening a removed app un-hides it again.
+ *
+ * Storage is localStorage namespaced by user id, matching how OpenLIT
+ * already persists column-visibility and filter preferences.
+ */
+
+const STORAGE_PREFIX = "openlit:my-apps-hidden:";
+
+type SidebarPreferences = {
+ hidden: string[];
+};
+
+function storageKeyFor(userId?: string) {
+ return userId ? `${STORAGE_PREFIX}${userId}` : null;
+}
+
+function readPreferences(key: string | null): SidebarPreferences {
+ if (!key || typeof window === "undefined") return { hidden: [] };
+ try {
+ const raw = window.localStorage.getItem(key);
+ if (!raw) return { hidden: [] };
+ const parsed = JSON.parse(raw);
+ const hidden = Array.isArray(parsed?.hidden)
+ ? parsed.hidden.filter((link: unknown): link is string => typeof link === "string")
+ : [];
+ return { hidden };
+ } catch {
+ return { hidden: [] };
+ }
+}
+
+export function useSidebarPreferences(userId?: string) {
+ const key = storageKeyFor(userId);
+ const [hidden, setHidden] = useState<string[]>([]);
+ const [loaded, setLoaded] = useState(false);
+
+ useEffect(() => {
+ setHidden(readPreferences(key).hidden);
+ setLoaded(Boolean(key));
+ }, [key]);
+
+ const update = useCallback(
+ (updater: (previous: string[]) => string[]) => {
+ setHidden((previous) => {
+ const next = updater(previous);
+ if (next === previous) return previous;
+ if (key) {
+ window.localStorage.setItem(key, JSON.stringify({ hidden: next }));
+ }
+ return next;
+ });
+ },
+ [key]
+ );
+
+ const hide = useCallback(
+ (link: string) =>
+ update((previous) => (previous.includes(link) ? previous : [...previous, link])),
+ [update]
+ );
+
+ const show = useCallback(
+ (link: string) => update((previous) => previous.filter((item) => item !== link)),
+ [update]
+ );
+
+ const toggle = useCallback(
+ (link: string) =>
+ update((previous) =>
+ previous.includes(link)
+ ? previous.filter((item) => item !== link)
+ : [...previous, link]
+ ),
+ [update]
+ );
+
+ const isHidden = useCallback((link: string) => hidden.includes(link), [hidden]);
+
+ return { hidden, loaded, isHidden, hide, show, toggle };
+}