From 5ac58919e59a0542316967a9eb236124f0ea989f Mon Sep 17 00:00:00 2001 From: ciregenz Date: Fri, 4 Sep 2026 14:36:32 -0700 Subject: [PATCH] [eric] usage: the lane labels live in their own module; the previous commit's test imported the React component and was red when pushed Co-Authored-By: Claude Fable 5.1 --- .../Settings/sections/usage/UsageStats.tsx | 19 +------------------ .../Settings/sections/usage/usageCopy.test.ts | 2 +- .../Settings/sections/usage/usageLanes.ts | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 frontend/src/app/pages/Settings/sections/usage/usageLanes.ts diff --git a/frontend/src/app/pages/Settings/sections/usage/UsageStats.tsx b/frontend/src/app/pages/Settings/sections/usage/UsageStats.tsx index 84ef4892..67a6f94c 100644 --- a/frontend/src/app/pages/Settings/sections/usage/UsageStats.tsx +++ b/frontend/src/app/pages/Settings/sections/usage/UsageStats.tsx @@ -1,3 +1,4 @@ +import { laneLabel } from './usageLanes'; import React, { useState, useEffect } from 'react'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; @@ -32,24 +33,6 @@ interface UsageSummary { hourly_activity: number[]; } -// The router's provider ids, in the words a user would recognise. `claude` is the Claude Pro/Max -// OAuth lane; `anthropic` is a pay-per-use key OR the OpenSwarm-managed node, which the router does -// not tell apart at this level, so the label says both. -export const LANE_LABELS: Record = { - claude: 'Claude subscription (Pro/Max)', - anthropic: 'Anthropic API key or OpenSwarm Pro', - codex: 'ChatGPT subscription', - openai: 'OpenAI API key', - 'gemini-cli': 'Gemini subscription', - antigravity: 'Gemini subscription (Antigravity)', - gemini: 'Google API key', - openrouter: 'OpenRouter key', -}; - -export function laneLabel(provider: string): string { - return LANE_LABELS[provider] ?? provider; -} - function fmtCount(n: number): string { return n >= 10000 ? `${(n / 1000).toFixed(1)}k` : Math.round(n).toLocaleString(); } diff --git a/frontend/src/app/pages/Settings/sections/usage/usageCopy.test.ts b/frontend/src/app/pages/Settings/sections/usage/usageCopy.test.ts index 5e0ff35e..bebe3ba7 100644 --- a/frontend/src/app/pages/Settings/sections/usage/usageCopy.test.ts +++ b/frontend/src/app/pages/Settings/sections/usage/usageCopy.test.ts @@ -2,7 +2,7 @@ import { test } from 'node:test'; import assert from 'node:assert/strict'; import fs from 'node:fs'; import path from 'node:path'; -import { laneLabel } from './UsageStats'; +import { laneLabel } from './usageLanes'; // Chuya (1.7.9, 2026-09-04) read "$0.40 API value covered" as money she was being charged and filmed it // going to $0.41 as proof the app was billing her instead of using her subscription. The figure is an diff --git a/frontend/src/app/pages/Settings/sections/usage/usageLanes.ts b/frontend/src/app/pages/Settings/sections/usage/usageLanes.ts new file mode 100644 index 00000000..9a16f91d --- /dev/null +++ b/frontend/src/app/pages/Settings/sections/usage/usageLanes.ts @@ -0,0 +1,17 @@ +// The router's provider ids, in the words a user would recognise. `claude` is the Claude Pro/Max +// OAuth lane; `anthropic` is a pay-per-use key OR the OpenSwarm-managed node, which the router does +// not tell apart at this level, so the label says both. +export const LANE_LABELS: Record = { + claude: 'Claude subscription (Pro/Max)', + anthropic: 'Anthropic API key or OpenSwarm Pro', + codex: 'ChatGPT subscription', + openai: 'OpenAI API key', + 'gemini-cli': 'Gemini subscription', + antigravity: 'Gemini subscription (Antigravity)', + gemini: 'Google API key', + openrouter: 'OpenRouter key', +}; + +export function laneLabel(provider: string): string { + return LANE_LABELS[provider] ?? provider; +}