feat: simplify dashboard usage stats
This commit is contained in:
@@ -15,7 +15,6 @@ import {
|
||||
ChevronDown,
|
||||
Clock,
|
||||
Coins,
|
||||
Flame,
|
||||
Github,
|
||||
Gauge,
|
||||
LogIn,
|
||||
@@ -27,7 +26,6 @@ import {
|
||||
Sun,
|
||||
Trash2,
|
||||
TrendingUp,
|
||||
Timer,
|
||||
Zap,
|
||||
Wifi,
|
||||
WifiOff,
|
||||
@@ -753,20 +751,6 @@ function AccountDashboardDetails({
|
||||
label="本周期单日峰值"
|
||||
v={num(dashboard.summary.peakDailyTokens)}
|
||||
/>
|
||||
<Stat
|
||||
icon={<Flame />}
|
||||
label="连续使用"
|
||||
v={
|
||||
dashboard.summary.currentStreakDays == null
|
||||
? "暂无"
|
||||
: dashboard.summary.currentStreakDays + " 天"
|
||||
}
|
||||
/>
|
||||
<Stat
|
||||
icon={<Timer />}
|
||||
label="最长任务时长"
|
||||
v={duration(dashboard.summary.longestRunningTurnSec)}
|
||||
/>
|
||||
</div>
|
||||
<Suspense fallback={<SettingsLoading />}>
|
||||
<UsageChart data={dashboard.usage} accountId={dashboard.accountId} />
|
||||
@@ -1660,14 +1644,6 @@ const num = (v?: number | null) =>
|
||||
notation: "compact",
|
||||
maximumFractionDigits: 1,
|
||||
}).format(v);
|
||||
const duration = (v?: number | null) =>
|
||||
v == null
|
||||
? "暂无"
|
||||
: v < 60
|
||||
? `${v} 秒`
|
||||
: v < 3600
|
||||
? `${Math.floor(v / 60)} 分 ${v % 60} 秒`
|
||||
: `${(v / 3600).toFixed(1)} 小时`;
|
||||
const cycleTimestamp = (value: number) =>
|
||||
new Date(value * 1000).toLocaleString();
|
||||
const cycleDuration = (minutes: number) =>
|
||||
|
||||
@@ -175,6 +175,8 @@ test("shows every account as a collapsible summary on the overview", async ({
|
||||
).toBeVisible();
|
||||
await expect(first.getByText("本周期 Tokens")).toBeVisible();
|
||||
await expect(first.getByText("本周期单日峰值")).toBeVisible();
|
||||
await expect(first.getByText("连续使用", { exact: true })).toHaveCount(0);
|
||||
await expect(first.getByText("最长任务时长", { exact: true })).toHaveCount(0);
|
||||
await expect(first.getByText("123.5K", { exact: true })).toBeVisible();
|
||||
await expect(first.getByText("按每日数据汇总")).toBeVisible();
|
||||
await expect(page.locator(".account-detail")).toHaveCount(1);
|
||||
|
||||
Reference in New Issue
Block a user