Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

UN-3392 [FIX] Use ToolNavBar for dashboard header to match other pages (#1911)

Athulde7d557d9990
diff --git a/frontend/src/components/metrics-dashboard/MetricsDashboard.css b/frontend/src/components/metrics-dashboard/MetricsDashboard.css
index 12f9d1557..d3d38fe16 100644
--- a/frontend/src/components/metrics-dashboard/MetricsDashboard.css
+++ b/frontend/src/components/metrics-dashboard/MetricsDashboard.css
@@ -2,47 +2,20 @@
.metrics-dashboard {
padding: 12px;
- background: #f5f5f5;
- height: calc(100vh - 64px);
+ background-color: var(--page-bg-2);
+ flex: 1;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
}
.metrics-dashboard-container {
- background: #ffffff;
- height: 100%;
+ background-color: var(--page-bg-1);
+ flex: 1;
+ min-height: 0;
overflow-y: auto;
}
-/* Topbar */
-.metrics-topbar {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 12px 14px;
- border-bottom: 1px solid #f0f0f0;
-}
-
-.metrics-topbar-left {
- display: flex;
- align-items: center;
- gap: 10px;
-}
-
-.metrics-topbar-icon {
- font-size: 20px;
- color: #1890ff;
-}
-
-.metrics-topbar-left h4 {
- font-weight: 600;
- color: #262626;
-}
-
-.metrics-topbar-right {
- display: flex;
- align-items: center;
- gap: 8px;
-}
-
.metrics-header-button {
padding: 0px 4px;
}
@@ -239,22 +212,6 @@
/* Responsive Adjustments */
@media (max-width: 768px) {
- .metrics-topbar {
- flex-direction: column;
- align-items: stretch;
- gap: 12px;
- padding: 12px 14px;
- }
-
- .metrics-topbar-left {
- justify-content: center;
- }
-
- .metrics-topbar-right {
- flex-direction: row;
- justify-content: center;
- }
-
.metrics-dashboard {
padding: 12px;
}
diff --git a/frontend/src/components/metrics-dashboard/MetricsDashboard.jsx b/frontend/src/components/metrics-dashboard/MetricsDashboard.jsx
index d9ad91cf6..3a5354a43 100644
--- a/frontend/src/components/metrics-dashboard/MetricsDashboard.jsx
+++ b/frontend/src/components/metrics-dashboard/MetricsDashboard.jsx
@@ -29,6 +29,7 @@ import {
useSubscriptionUsage,
} from "../../hooks/useMetricsData";
import { useSessionStore } from "../../store/session-store";
+import { ToolNavBar } from "../navigations/tool-nav-bar/ToolNavBar";
import { DeploymentUsageTable } from "./LLMUsageTable";
import { HITLChart, PagesChart, TrendAnalysisChart } from "./MetricsChart";
import { MetricsSummary } from "./MetricsSummary";
@@ -60,6 +61,41 @@ try {
const { RangePicker } = DatePicker;
+function DashboardButtons() {
+ return (
+ <Space>
+ <Button
+ icon={<FileSearchOutlined />}
+ type="link"
+ onClick={() =>
+ window.open(
+ "https://docs.unstract.com/unstract/index.html",
+ "_blank",
+ "noopener,noreferrer",
+ )
+ }
+ className="metrics-header-button"
+ >
+ Documentation
+ </Button>
+ <Button
+ icon={<SlackOutlined />}
+ type="link"
+ onClick={() =>
+ window.open(
+ "https://join-slack.unstract.com/",
+ "_blank",
+ "noopener,noreferrer",
+ )
+ }
+ className="metrics-header-button"
+ >
+ Slack Community
+ </Button>
+ </Space>
+ );
+}
+
function MetricsDashboard() {
const navigate = useNavigate();
const { sessionDetails } = useSessionStore();
@@ -251,107 +287,64 @@ function MetricsDashboard() {
}
return (
- <div className="metrics-dashboard">
- <div className="metrics-dashboard-container">
- <div className="metrics-topbar">
- <div className="metrics-topbar-left">
- <Typography
- style={{
- fontWeight: 600,
- fontSize: "16px",
- display: "inline",
- lineHeight: "24px",
- }}
- >
- Dashboard
- </Typography>
- </div>
-
- <Space className="metrics-topbar-right">
- <Button
- icon={<FileSearchOutlined />}
- type="link"
- onClick={() =>
- window.open(
- "https://docs.unstract.com/unstract/index.html",
- "_blank",
- "noopener,noreferrer",
- )
- }
- className="metrics-header-button"
- >
- Documentation
- </Button>
- <Button
- icon={<SlackOutlined />}
- type="link"
- onClick={() =>
- window.open(
- "https://join-slack.unstract.com/",
- "_blank",
- "noopener,noreferrer",
- )
- }
- className="metrics-header-button"
- >
- Slack Community
- </Button>
- </Space>
- </div>
+ <>
+ <ToolNavBar title="Dashboard" CustomButtons={DashboardButtons} />
+ <div className="metrics-dashboard">
+ <div className="metrics-dashboard-container">
+ {PlanBanner && subscriptionData && <PlanBanner />}
- {PlanBanner && subscriptionData && <PlanBanner />}
+ {overviewError && (
+ <Alert
+ message="Error loading metrics"
+ description={overviewError}
+ type="error"
+ showIcon
+ closable
+ className="metrics-error"
+ />
+ )}
- {overviewError && (
- <Alert
- message="Error loading metrics"
- description={overviewError}
- type="error"
- showIcon
- closable
- className="metrics-error"
+ <Tabs
+ items={tabItems}
+ activeKey={activeTab}
+ onChange={setActiveTab}
+ tabBarExtraContent={
+ <Space>
+ {activeTab !== "subscription" && (
+ <RangePicker
+ value={dateRange}
+ onChange={handleDateChange}
+ disabledDate={(current) => current && current > dayjs()}
+ allowClear={false}
+ size="middle"
+ presets={[
+ {
+ label: "Last 7 Days",
+ value: [dayjs().subtract(7, "day"), dayjs()],
+ },
+ {
+ label: "Last 30 Days",
+ value: [dayjs().subtract(30, "day"), dayjs()],
+ },
+ // 90-day preset only for overview (deployment usage capped at 30 days)
+ ...(activeTab === "llm-usage"
+ ? []
+ : [
+ {
+ label: "Last 90 Days",
+ value: [dayjs().subtract(90, "day"), dayjs()],
+ },
+ ]),
+ ]}
+ />
+ )}
+ <Button icon={<ReloadOutlined />} onClick={handleRefresh} />
+ </Space>
+ }
/>
- )}
-
- <Tabs
- items={tabItems}
- activeKey={activeTab}
- onChange={setActiveTab}
- tabBarExtraContent={
- <Space>
- {activeTab !== "subscription" && (
- <RangePicker
- value={dateRange}
- onChange={handleDateChange}
- disabledDate={(current) => current && current > dayjs()}
- allowClear={false}
- size="middle"
- presets={[
- {
- label: "Last 7 Days",
- value: [dayjs().subtract(7, "day"), dayjs()],
- },
- {
- label: "Last 30 Days",
- value: [dayjs().subtract(30, "day"), dayjs()],
- },
- // 90-day preset only for overview (deployment usage capped at 30 days)
- ...(activeTab === "llm-usage"
- ? []
- : [
- {
- label: "Last 90 Days",
- value: [dayjs().subtract(90, "day"), dayjs()],
- },
- ]),
- ]}
- />
- )}
- <Button icon={<ReloadOutlined />} onClick={handleRefresh} />
- </Space>
- }
- />
+ </div>
</div>
- </div>
+ </>
);
}