diff --git a/frontend-web/src/pages/AdminUserLeaderboardPage.tsx b/frontend-web/src/pages/AdminUserLeaderboardPage.tsx index 08d47aa9..144f3f4c 100644 --- a/frontend-web/src/pages/AdminUserLeaderboardPage.tsx +++ b/frontend-web/src/pages/AdminUserLeaderboardPage.tsx @@ -25,7 +25,7 @@ import { Users, type LucideIcon, } from "lucide-react"; -import { useEffect, useId, useMemo, useRef, useState } from "react"; +import { useEffect, useId, useMemo, useRef, useState, type ReactNode } from "react"; import { useNavigate } from "react-router-dom"; import { Badge } from "@/components/ui/badge"; @@ -521,9 +521,87 @@ function TrendBars({ points, compact = false }: { points: AdminLeaderboardTrendP const displayedSeries = metric === "all" ? series : [activeSeries]; const totalFor = (key: TrendMetric) => visible.reduce((sum, point) => sum + Number(point[key] ?? 0), 0); const activeDays = visible.filter((point) => point.runs > 0 || point.questions > 0 || point.tokens > 0).length; + const metricCards = ({ includeAll = true, large = false }: { includeAll?: boolean; large?: boolean } = {}) => ( +
+ {includeAll && ( + + )} + {series.map((item) => ( + + ))} +
+ ); + + const analysisDialog = (title: string, description: ReactNode) => ( + + + + + + + {title} + {description} + +
{metricCards({ includeAll: true, large: true })}
+
+
+
当前查看
+
{metric === "all" ? "全部指标" : activeSeries.label}
+
最新 {metric === "all" ? "运行" : activeSeries.label}
+
{fmtNumber(latestValue)}
+
= 0 ? "text-[#C1121F]" : "text-[#7F1D1D] dark:text-[#FCA5A5]")}> + 较上一日 {delta >= 0 ? "+" : ""}{fmtNumber(delta)} +
+
+ 峰值 {peak.date} / {fmtNumber(Number(peak[activeMetric] ?? 0))} +
+
+ {chart(true)} +
+
+
+ ); + const chart = (large = false) => ( -
- +
+ @@ -598,47 +676,13 @@ function TrendBars({ points, compact = false }: { points: AdminLeaderboardTrendP if (compact) { return (
-
- {series.map((item) => ( - - ))} -
+ {metricCards({ includeAll: false })}
每个点代表 1 天;当前显示 {metric === "all" ? "全部指标" : activeSeries.label},覆盖 {activeDays} 个活跃日。 - - - - - - - 个人使用趋势 - - 每个折线点代表一天。运行=发起次数,问答=有效提问,活跃=有行为的用户数,Token=模型输入输出消耗。 - - - {chart(true)} - - + {analysisDialog( + "个人使用趋势", + "每个折线点代表一天。运行=发起次数,问答=有效提问,活跃=有行为的用户数,Token=模型输入输出消耗。", + )}
{chart(false)}
@@ -651,58 +695,11 @@ function TrendBars({ points, compact = false }: { points: AdminLeaderboardTrendP 每个折线点代表一天;点击指标卡可单独查看运行、问答、活跃或 Token,全部趋势会同时展示四条多色折线。

-
- - {series.map((item) => ( - - ))} -
- - - - - - - 时间趋势分析 - - 当前查看 {metric === "all" ? "全部指标" : activeSeries.label},峰值 {peak.date} / {fmtNumber(Number(peak[activeMetric] ?? 0))}。 - - - {chart(true)} - - +
{metricCards()}
+ {analysisDialog( + "时间趋势分析", + <>当前查看 {metric === "all" ? "全部指标" : activeSeries.label},峰值 {peak.date} / {fmtNumber(Number(peak[activeMetric] ?? 0))}。, + )}
@@ -1260,14 +1257,14 @@ export default function AdminUserLeaderboardPage() { AI 报告 - - + + AI 榜单分析报告 基于当前时间段的问答、用户、技能、模型和趋势统计生成运营分析。 -
+