diff --git a/apps/web/src/components/layout/AppHeader.tsx b/apps/web/src/components/layout/AppHeader.tsx index 0c6f28b..a2d9e14 100644 --- a/apps/web/src/components/layout/AppHeader.tsx +++ b/apps/web/src/components/layout/AppHeader.tsx @@ -5,6 +5,7 @@ import Link from "next/link"; import { usePathname } from "next/navigation"; import { useAuth } from "@/lib/auth/auth-context"; import { ThemeToggle } from "./ThemeToggle"; +import { UsageWidget } from "@/components/ui/UsageWidget"; import { useSidebar } from "./SidebarContext"; /** @@ -350,6 +351,9 @@ export function AppHeader(): React.JSX.Element { {/* Theme Toggle */} + {/* Usage Widget */} + + {/* User Avatar + Dropdown */}
+ + {popoverOpen && ( +
+
+ Token Usage +
+ + {isLoading ? ( +
+ Loading usage data… +
+ ) : summary ? ( + <> +
+
+ Total Tokens + + {formatTokens(summary.totalTokens)} + +
+
+ Estimated Cost + + ${summary.totalCost.toFixed(2)} + +
+
+ Tasks + + {summary.taskCount} + +
+
+ +
+ {tiers.map((tier) => { + const tierPct = Math.min(tier.percentage, 100); + return ( +
+
+ {tier.name} + + {formatTokens(tier.tokens)} / {formatTokens(tier.limit)} + +
+
+
+
+
+ ); + })} +
+ + { + setPopoverOpen(false); + }} + style={{ + display: "block", + marginTop: 12, + paddingTop: 8, + borderTop: "1px solid var(--border)", + fontSize: "0.75rem", + color: "var(--primary)", + textDecoration: "none", + textAlign: "center", + }} + onMouseEnter={(e): void => { + (e.currentTarget as HTMLAnchorElement).style.textDecoration = "underline"; + }} + onMouseLeave={(e): void => { + (e.currentTarget as HTMLAnchorElement).style.textDecoration = "none"; + }} + > + View detailed usage → + + + ) : ( +
+ No usage data available +
+ )} +
+ )} +
+ ); +}