From c701068f0c7b2842d5b62a81d615f4fc598384cb Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 11 Jun 2026 12:20:34 +0800 Subject: [PATCH] feat(usage): replace app filter text labels with app icons The text tabs (All / Claude Code / Codex / Gemini / OpenCode) wrapped awkwardly in narrow windows. Render app icons via ProviderIcon instead, mirroring AppSwitcher's icon mapping (codex reuses the openai icon), with a LayoutGrid icon for "all". Localized labels are kept as title/aria-label on each button. --- src/components/usage/UsageDashboard.tsx | 54 ++++++++++++++++++------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/src/components/usage/UsageDashboard.tsx b/src/components/usage/UsageDashboard.tsx index b28d605df..57d7d6b58 100644 --- a/src/components/usage/UsageDashboard.tsx +++ b/src/components/usage/UsageDashboard.tsx @@ -7,6 +7,7 @@ import { ProviderStatsTable } from "./ProviderStatsTable"; import { ModelStatsTable } from "./ModelStatsTable"; import { KNOWN_APP_TYPES, + type AppType, type AppTypeFilter, type UsageRangeSelection, } from "@/types/usage"; @@ -17,7 +18,9 @@ import { Activity, RefreshCw, Coins, + LayoutGrid, } from "lucide-react"; +import { ProviderIcon } from "@/components/ProviderIcon"; import { Button } from "@/components/ui/button"; import { useQueryClient } from "@tanstack/react-query"; import { usageKeys } from "@/lib/query/usage"; @@ -37,6 +40,14 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; const APP_FILTER_OPTIONS: AppTypeFilter[] = ["all", ...KNOWN_APP_TYPES]; +// 与 AppSwitcher 的 appIconName 保持一致(codex 复用 openai 图标) +const APP_FILTER_ICON: Record = { + claude: "claude", + codex: "openai", + gemini: "gemini", + opencode: "opencode", +}; + export function UsageDashboard() { const { t, i18n } = useTranslation(); const queryClient = useQueryClient(); @@ -90,21 +101,34 @@ export function UsageDashboard() {
- {APP_FILTER_OPTIONS.map((type) => ( - - ))} + {APP_FILTER_OPTIONS.map((type) => { + const label = t(`usage.appFilter.${type}`); + return ( + + ); + })}