|
@@ -1,46 +1,80 @@
|
|
|
"use client";
|
|
"use client";
|
|
|
|
|
|
|
|
-import { useState, useMemo } from "react";
|
|
|
|
|
|
|
+import { useMemo, useState } from "react";
|
|
|
import { Download, ChevronDown, CheckCircle2 } from "lucide-react";
|
|
import { Download, ChevronDown, CheckCircle2 } from "lucide-react";
|
|
|
-import Link from "next/link";
|
|
|
|
|
-import { metricsData, MetricCategoryData } from "./metricsData";
|
|
|
|
|
import { useAuth } from "@/components/AuthProvider";
|
|
import { useAuth } from "@/components/AuthProvider";
|
|
|
-import { getMockStudentById, getMockClassAverageMetrics } from "@/lib/mockApi";
|
|
|
|
|
|
|
+import { useD4Metrics } from "@/hooks/useD4Metrics";
|
|
|
|
|
+import { toD4UserId } from "@/lib/d4Metrics";
|
|
|
|
|
+import { buildRuntimeMetrics, type RuntimeMetric, type RuntimeMetricValue } from "@/lib/metricRuntime";
|
|
|
|
|
|
|
|
export default function DashboardContent() {
|
|
export default function DashboardContent() {
|
|
|
const { user } = useAuth();
|
|
const { user } = useAuth();
|
|
|
const [expandedCard, setExpandedCard] = useState<string | null>(null);
|
|
const [expandedCard, setExpandedCard] = useState<string | null>(null);
|
|
|
- const [activeTab, setActiveTab] = useState<"K" | "A" | "S" | "D">("K");
|
|
|
|
|
|
|
+ const [activeTab, setActiveTab] = useState<"K" | "A" | "S" | "D">("D");
|
|
|
|
|
|
|
|
- const student = user?.role === 'stu' ? getMockStudentById(user.id) : null;
|
|
|
|
|
- const classAverages = useMemo(() => getMockClassAverageMetrics(), []);
|
|
|
|
|
|
|
+ const d4Query = useMemo(() => {
|
|
|
|
|
+ const userId = user?.role === "stu" ? toD4UserId(user.id) : undefined;
|
|
|
|
|
+ return userId ? { userId } : {};
|
|
|
|
|
+ }, [user]);
|
|
|
|
|
|
|
|
- const displayData = useMemo(() => {
|
|
|
|
|
- const personalizedData = JSON.parse(JSON.stringify(metricsData)) as Record<string, any[]>;
|
|
|
|
|
-
|
|
|
|
|
- Object.keys(personalizedData).forEach((catKey) => {
|
|
|
|
|
- personalizedData[catKey].forEach(item => {
|
|
|
|
|
- const score = student ? student.metricScores?.[item.id] : classAverages[item.id];
|
|
|
|
|
- item.avgScore = score !== undefined ? score.toString() : "0";
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ const d4Metrics = useD4Metrics(d4Query);
|
|
|
|
|
|
|
|
- return personalizedData as Record<string, (MetricCategoryData & { avgScore: string })[]>;
|
|
|
|
|
- }, [student, classAverages]);
|
|
|
|
|
|
|
+ const displayData = useMemo(
|
|
|
|
|
+ () => buildRuntimeMetrics({ data: d4Metrics.data, error: d4Metrics.error, isLoading: d4Metrics.isLoading }),
|
|
|
|
|
+ [d4Metrics.data, d4Metrics.error, d4Metrics.isLoading],
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
const toggleCard = (id: string) => {
|
|
const toggleCard = (id: string) => {
|
|
|
setExpandedCard(expandedCard === id ? null : id);
|
|
setExpandedCard(expandedCard === id ? null : id);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const getMetricStatus = (score: string) => {
|
|
|
|
|
- const num = parseInt(score);
|
|
|
|
|
- if (isNaN(num)) return { label: "未知", class: "bg-surface-variant text-on-surface-variant" };
|
|
|
|
|
- if (num >= 90) return { label: "优秀", class: "bg-metric-high/10 text-metric-high border-metric-high/30" };
|
|
|
|
|
- if (num >= 80) return { label: "良好", class: "bg-metric-mid/10 text-metric-mid border-metric-mid/30" };
|
|
|
|
|
- if (num >= 70) return { label: "一般", class: "bg-metric-warn/10 text-metric-warn border-metric-warn/30" };
|
|
|
|
|
|
|
+ const getScoreStatus = (score: number | null) => {
|
|
|
|
|
+ if (score == null) {
|
|
|
|
|
+ return { label: "暂无", class: "bg-surface-variant text-on-surface-variant border-outline-variant" };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (score >= 90) return { label: "优秀", class: "bg-metric-high/10 text-metric-high border-metric-high/30" };
|
|
|
|
|
+ if (score >= 80) return { label: "良好", class: "bg-metric-mid/10 text-metric-mid border-metric-mid/30" };
|
|
|
|
|
+ if (score >= 70) return { label: "一般", class: "bg-metric-warn/10 text-metric-warn border-metric-warn/30" };
|
|
|
return { label: "需改进", class: "bg-metric-low/10 text-metric-low border-metric-low/30" };
|
|
return { label: "需改进", class: "bg-metric-low/10 text-metric-low border-metric-low/30" };
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ const getMetricStatus = (metric: RuntimeMetric) => {
|
|
|
|
|
+ if (metric.state === "loading") {
|
|
|
|
|
+ return { label: "加载中", class: "bg-primary/10 text-primary border-primary/30" };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (metric.state === "error") {
|
|
|
|
|
+ return { label: "接口异常", class: "bg-metric-low/10 text-metric-low border-metric-low/30" };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (metric.state === "unavailable") {
|
|
|
|
|
+ return { label: "未接入", class: "bg-surface-variant text-on-surface-variant border-outline-variant" };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return getScoreStatus(metric.score);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const getValueStatus = (value: RuntimeMetricValue) => {
|
|
|
|
|
+ if (value.state === "ready" && value.score == null) {
|
|
|
|
|
+ return { label: "已同步", class: "bg-primary/10 text-primary border-primary/30" };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (value.state === "loading") {
|
|
|
|
|
+ return { label: "加载中", class: "bg-primary/10 text-primary border-primary/30" };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (value.state === "error") {
|
|
|
|
|
+ return { label: "异常", class: "bg-metric-low/10 text-metric-low border-metric-low/30" };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (value.state === "unavailable") {
|
|
|
|
|
+ return { label: "未接入", class: "bg-surface-variant text-on-surface-variant border-outline-variant" };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return getScoreStatus(value.score);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div className="flex-1 overflow-y-auto p-4 lg:p-8 space-y-6">
|
|
<div className="flex-1 overflow-y-auto p-4 lg:p-8 space-y-6">
|
|
|
<div className="flex flex-col md:flex-row justify-between items-start md:items-end mb-2">
|
|
<div className="flex flex-col md:flex-row justify-between items-start md:items-end mb-2">
|
|
@@ -49,7 +83,7 @@ export default function DashboardContent() {
|
|
|
综合能力总览
|
|
综合能力总览
|
|
|
</h1>
|
|
</h1>
|
|
|
<p className="text-secondary text-sm lg:text-base">
|
|
<p className="text-secondary text-sm lg:text-base">
|
|
|
- 基于核心能力指标的数据分析与追踪
|
|
|
|
|
|
|
+ 基于后端指标接口的数据分析与追踪
|
|
|
</p>
|
|
</p>
|
|
|
</div>
|
|
</div>
|
|
|
<div className="mt-4 md:mt-0 flex gap-3">
|
|
<div className="mt-4 md:mt-0 flex gap-3">
|
|
@@ -65,27 +99,27 @@ export default function DashboardContent() {
|
|
|
aria-label="Tabs"
|
|
aria-label="Tabs"
|
|
|
className="flex space-x-6 overflow-x-auto pb-1 no-scrollbar"
|
|
className="flex space-x-6 overflow-x-auto pb-1 no-scrollbar"
|
|
|
>
|
|
>
|
|
|
- <button
|
|
|
|
|
|
|
+ <button
|
|
|
onClick={() => setActiveTab("K")}
|
|
onClick={() => setActiveTab("K")}
|
|
|
- className={`whitespace-nowrap py-3 px-2 border-b-2 font-medium text-sm transition-colors cursor-pointer ${activeTab === 'K' ? 'border-primary text-primary' : 'border-transparent text-secondary hover:text-on-surface hover:border-outline'}`}
|
|
|
|
|
|
|
+ className={`whitespace-nowrap py-3 px-2 border-b-2 font-medium text-sm transition-colors cursor-pointer ${activeTab === "K" ? "border-primary text-primary" : "border-transparent text-secondary hover:text-on-surface hover:border-outline"}`}
|
|
|
>
|
|
>
|
|
|
知识掌握情况 (K)
|
|
知识掌握情况 (K)
|
|
|
</button>
|
|
</button>
|
|
|
- <button
|
|
|
|
|
|
|
+ <button
|
|
|
onClick={() => setActiveTab("A")}
|
|
onClick={() => setActiveTab("A")}
|
|
|
- className={`whitespace-nowrap py-3 px-2 border-b-2 font-medium text-sm transition-colors cursor-pointer ${activeTab === 'A' ? 'border-primary text-primary' : 'border-transparent text-secondary hover:text-on-surface hover:border-outline'}`}
|
|
|
|
|
|
|
+ className={`whitespace-nowrap py-3 px-2 border-b-2 font-medium text-sm transition-colors cursor-pointer ${activeTab === "A" ? "border-primary text-primary" : "border-transparent text-secondary hover:text-on-surface hover:border-outline"}`}
|
|
|
>
|
|
>
|
|
|
AI 辅助能力 (A)
|
|
AI 辅助能力 (A)
|
|
|
</button>
|
|
</button>
|
|
|
- <button
|
|
|
|
|
|
|
+ <button
|
|
|
onClick={() => setActiveTab("S")}
|
|
onClick={() => setActiveTab("S")}
|
|
|
- className={`whitespace-nowrap py-3 px-2 border-b-2 font-medium text-sm transition-colors cursor-pointer ${activeTab === 'S' ? 'border-primary text-primary' : 'border-transparent text-secondary hover:text-on-surface hover:border-outline'}`}
|
|
|
|
|
|
|
+ className={`whitespace-nowrap py-3 px-2 border-b-2 font-medium text-sm transition-colors cursor-pointer ${activeTab === "S" ? "border-primary text-primary" : "border-transparent text-secondary hover:text-on-surface hover:border-outline"}`}
|
|
|
>
|
|
>
|
|
|
软件工程能力 (S)
|
|
软件工程能力 (S)
|
|
|
</button>
|
|
</button>
|
|
|
- <button
|
|
|
|
|
|
|
+ <button
|
|
|
onClick={() => setActiveTab("D")}
|
|
onClick={() => setActiveTab("D")}
|
|
|
- className={`whitespace-nowrap py-3 px-2 border-b-2 font-medium text-sm transition-colors cursor-pointer ${activeTab === 'D' ? 'border-primary text-primary' : 'border-transparent text-secondary hover:text-on-surface hover:border-outline'}`}
|
|
|
|
|
|
|
+ className={`whitespace-nowrap py-3 px-2 border-b-2 font-medium text-sm transition-colors cursor-pointer ${activeTab === "D" ? "border-primary text-primary" : "border-transparent text-secondary hover:text-on-surface hover:border-outline"}`}
|
|
|
>
|
|
>
|
|
|
态度与团队协作 (D)
|
|
态度与团队协作 (D)
|
|
|
</button>
|
|
</button>
|
|
@@ -93,83 +127,119 @@ export default function DashboardContent() {
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div className="grid grid-cols-1 xl:grid-cols-2 gap-6">
|
|
<div className="grid grid-cols-1 xl:grid-cols-2 gap-6">
|
|
|
- {displayData[activeTab].map((metric) => (
|
|
|
|
|
- <div
|
|
|
|
|
- key={metric.id}
|
|
|
|
|
- className={`bg-surface-container rounded-3xl p-6 shadow-elevation-1 hover:shadow-elevation-2 transition-all border border-outline-variant/50 group cursor-pointer ${expandedCard === metric.id ? "expanded" : ""}`}
|
|
|
|
|
- onClick={() => toggleCard(metric.id)}
|
|
|
|
|
- >
|
|
|
|
|
- <div className="flex justify-between items-start">
|
|
|
|
|
- <div className="flex items-center gap-4">
|
|
|
|
|
- <div className={`h-14 w-14 rounded-2xl flex items-center justify-center ${metric.bgClass}`}>
|
|
|
|
|
- <span className="font-bold text-xl">
|
|
|
|
|
- {metric.id}
|
|
|
|
|
- </span>
|
|
|
|
|
|
|
+ {displayData[activeTab].map((metric) => {
|
|
|
|
|
+ const status = getMetricStatus(metric);
|
|
|
|
|
+ const progress = metric.score ?? 0;
|
|
|
|
|
+
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div
|
|
|
|
|
+ key={metric.id}
|
|
|
|
|
+ className={`bg-surface-container rounded-3xl p-6 shadow-elevation-1 hover:shadow-elevation-2 transition-all border border-outline-variant/50 group cursor-pointer ${expandedCard === metric.id ? "expanded" : ""}`}
|
|
|
|
|
+ onClick={() => toggleCard(metric.id)}
|
|
|
|
|
+ >
|
|
|
|
|
+ <div className="flex justify-between items-start gap-4">
|
|
|
|
|
+ <div className="flex items-center gap-4 min-w-0">
|
|
|
|
|
+ <div className={`h-14 w-14 rounded-2xl flex items-center justify-center shrink-0 ${metric.bgClass}`}>
|
|
|
|
|
+ <span className="font-bold text-xl">
|
|
|
|
|
+ {metric.id}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className="min-w-0">
|
|
|
|
|
+ <h3 className={`text-lg font-medium text-on-surface transition-colors group-hover:${metric.textClass}`}>
|
|
|
|
|
+ {metric.name}
|
|
|
|
|
+ </h3>
|
|
|
|
|
+ <p className="text-sm text-secondary">
|
|
|
|
|
+ {metric.summary}
|
|
|
|
|
+ </p>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div>
|
|
|
|
|
- <h3 className={`text-lg font-medium text-on-surface transition-colors group-hover:${metric.textClass}`}>
|
|
|
|
|
- {metric.name}
|
|
|
|
|
- </h3>
|
|
|
|
|
- <p className="text-sm text-secondary">
|
|
|
|
|
- {metric.description}
|
|
|
|
|
- </p>
|
|
|
|
|
|
|
+ <div className="flex items-center gap-4 shrink-0">
|
|
|
|
|
+ <div className="text-right hidden sm:block">
|
|
|
|
|
+ <div className={`text-2xl font-bold ${metric.score == null ? "text-outline" : `text-${metric.colorClass}`}`}>
|
|
|
|
|
+ {metric.avgScore}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className="text-xs text-secondary">指标值</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <ChevronDown
|
|
|
|
|
+ className={`w-6 h-6 text-secondary transition-transform duration-300 ${expandedCard === metric.id ? "rotate-180" : ""}`}
|
|
|
|
|
+ />
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div className="flex items-center gap-4">
|
|
|
|
|
- <div className="text-right hidden sm:block">
|
|
|
|
|
- <div className={`text-2xl font-bold text-${metric.colorClass}`}>{metric.avgScore}</div>
|
|
|
|
|
- <div className="text-xs text-secondary">平均分</div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <ChevronDown
|
|
|
|
|
- className={`w-6 h-6 text-secondary transition-transform duration-300 ${expandedCard === metric.id ? "rotate-180" : ""}`}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <div className="mt-5 w-full bg-surface-container-high rounded-full h-2 overflow-hidden">
|
|
|
|
|
+ <div
|
|
|
|
|
+ className="h-2 rounded-full transition-all duration-500"
|
|
|
|
|
+ style={{
|
|
|
|
|
+ width: `${progress}%`,
|
|
|
|
|
+ backgroundColor: metric.score == null ? "var(--color-outline-variant)" : `var(--color-${metric.colorClass})`,
|
|
|
|
|
+ }}
|
|
|
|
|
+ ></div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
- <div className="mt-5 w-full bg-surface-container-high rounded-full h-2 overflow-hidden">
|
|
|
|
|
- <div
|
|
|
|
|
- className={`h-2 rounded-full`}
|
|
|
|
|
- style={{ width: metric.avgScore, backgroundColor: `var(--color-${metric.colorClass})` }}
|
|
|
|
|
- ></div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div className={`mt-0 border-t border-outline-variant/30 pt-0 ${expandedCard === metric.id ? "animate-in slide-in-from-top-2 block" : "hidden"}`}>
|
|
|
|
|
- <div className="pt-6 space-y-6">
|
|
|
|
|
- {metric.subMetrics.map((subMetric) => {
|
|
|
|
|
- // Make a fake consistent status based on submetric ID string length and char codes for visual diversity, in a real app this is data driven
|
|
|
|
|
- const fakeScoreVal = 70 + (subMetric.id.charCodeAt(subMetric.id.length - 1) * 3) % 25;
|
|
|
|
|
- const status = getMetricStatus(fakeScoreVal.toString());
|
|
|
|
|
-
|
|
|
|
|
- return (
|
|
|
|
|
- <div key={subMetric.id}>
|
|
|
|
|
- <div className="flex justify-between items-center mb-3">
|
|
|
|
|
- <h4 className="font-medium text-sm text-on-surface">
|
|
|
|
|
- {subMetric.id} {subMetric.name}
|
|
|
|
|
- </h4>
|
|
|
|
|
- <span className={`text-xs font-bold border px-2 py-0.5 rounded-full ${status.class}`}>
|
|
|
|
|
- {status.label}
|
|
|
|
|
- </span>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div className="grid gap-2">
|
|
|
|
|
- {subMetric.values.map((val, idx) => (
|
|
|
|
|
- <div key={idx} className="flex items-center justify-between text-sm p-3 rounded-lg bg-surface-container-high border border-outline-variant/20 transition-colors">
|
|
|
|
|
- <div className="flex items-center text-secondary">
|
|
|
|
|
- <CheckCircle2 className={`w-4 h-4 mr-3 text-${metric.colorClass}`} />
|
|
|
|
|
- {val.name}
|
|
|
|
|
|
|
+ <div className={`mt-0 border-t border-outline-variant/30 pt-0 ${expandedCard === metric.id ? "animate-in slide-in-from-top-2 block" : "hidden"}`}>
|
|
|
|
|
+ <div className="pt-6 space-y-6">
|
|
|
|
|
+ {metric.subMetrics.map((subMetric) => {
|
|
|
|
|
+ const subStatus = subMetric.state === "ready" ? getScoreStatus(subMetric.score) : status;
|
|
|
|
|
+
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div key={subMetric.id}>
|
|
|
|
|
+ <div className="flex justify-between items-center mb-3 gap-3">
|
|
|
|
|
+ <h4 className="font-medium text-sm text-on-surface">
|
|
|
|
|
+ {subMetric.id} {subMetric.name}
|
|
|
|
|
+ </h4>
|
|
|
|
|
+ <span className={`text-xs font-bold border px-2 py-0.5 rounded-full whitespace-nowrap ${subStatus.class}`}>
|
|
|
|
|
+ {subStatus.label}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className="grid gap-2">
|
|
|
|
|
+ {subMetric.values.map((val, idx) => {
|
|
|
|
|
+ const valueStatus = getValueStatus(val);
|
|
|
|
|
+
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div key={idx} className="text-sm p-3 rounded-lg bg-surface-container-high border border-outline-variant/20 transition-colors">
|
|
|
|
|
+ <div className="flex items-center justify-between gap-3">
|
|
|
|
|
+ <div className="flex items-center text-secondary min-w-0">
|
|
|
|
|
+ <CheckCircle2 className={`w-4 h-4 mr-3 shrink-0 ${val.state === "ready" ? `text-${metric.colorClass}` : "text-outline"}`} />
|
|
|
|
|
+ <span className="truncate">{val.name}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className="flex items-center gap-3 shrink-0">
|
|
|
|
|
+ <span className="font-mono text-on-surface">{val.displayValue}</span>
|
|
|
|
|
+ <span className={`text-[10px] font-bold border px-2 py-0.5 rounded-full ${valueStatus.class}`}>
|
|
|
|
|
+ {valueStatus.label}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ {val.helperText && (
|
|
|
|
|
+ <p className="text-xs text-outline mt-2 pl-7">
|
|
|
|
|
+ {val.helperText}
|
|
|
|
|
+ </p>
|
|
|
|
|
+ )}
|
|
|
|
|
+ {val.progress != null && (
|
|
|
|
|
+ <div className="mt-3 ml-7 h-1.5 rounded-full bg-surface-variant overflow-hidden">
|
|
|
|
|
+ <div
|
|
|
|
|
+ className="h-full rounded-full"
|
|
|
|
|
+ style={{
|
|
|
|
|
+ width: `${val.progress}%`,
|
|
|
|
|
+ backgroundColor: `var(--color-${metric.colorClass})`,
|
|
|
|
|
+ }}
|
|
|
|
|
+ ></div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
- ))}
|
|
|
|
|
|
|
+ );
|
|
|
|
|
+ })}
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
- );
|
|
|
|
|
- })}
|
|
|
|
|
|
|
+ );
|
|
|
|
|
+ })}
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
- ))}
|
|
|
|
|
|
|
+ );
|
|
|
|
|
+ })}
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div className="mt-8 mb-4">
|
|
<div className="mt-8 mb-4">
|
|
|
<h2 className="text-xl font-display font-medium text-on-secondary-container">
|
|
<h2 className="text-xl font-display font-medium text-on-secondary-container">
|
|
|
- 近期活动追踪
|
|
|
|
|
|
|
+ 指标数据同步
|
|
|
</h2>
|
|
</h2>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -182,10 +252,10 @@ export default function DashboardContent() {
|
|
|
能力指标
|
|
能力指标
|
|
|
</th>
|
|
</th>
|
|
|
<th className="p-4 font-medium text-sm text-secondary uppercase tracking-wider">
|
|
<th className="p-4 font-medium text-sm text-secondary uppercase tracking-wider">
|
|
|
- 测验/活动
|
|
|
|
|
|
|
+ 数据来源
|
|
|
</th>
|
|
</th>
|
|
|
<th className="p-4 font-medium text-sm text-secondary uppercase tracking-wider">
|
|
<th className="p-4 font-medium text-sm text-secondary uppercase tracking-wider">
|
|
|
- 得分
|
|
|
|
|
|
|
+ 指标值
|
|
|
</th>
|
|
</th>
|
|
|
<th className="p-4 font-medium text-sm text-secondary uppercase tracking-wider">
|
|
<th className="p-4 font-medium text-sm text-secondary uppercase tracking-wider">
|
|
|
状态
|
|
状态
|
|
@@ -193,11 +263,12 @@ export default function DashboardContent() {
|
|
|
</tr>
|
|
</tr>
|
|
|
</thead>
|
|
</thead>
|
|
|
<tbody className="divide-y divide-outline-variant/20">
|
|
<tbody className="divide-y divide-outline-variant/20">
|
|
|
- {displayData[activeTab].slice(0, 4).map((metric, i) => {
|
|
|
|
|
- const status = getMetricStatus(metric.avgScore);
|
|
|
|
|
- return (
|
|
|
|
|
|
|
+ {displayData[activeTab].map((metric) => {
|
|
|
|
|
+ const status = getMetricStatus(metric);
|
|
|
|
|
+
|
|
|
|
|
+ return (
|
|
|
<tr
|
|
<tr
|
|
|
- key={i}
|
|
|
|
|
|
|
+ key={metric.id}
|
|
|
className="hover:bg-white/5 transition-colors cursor-pointer"
|
|
className="hover:bg-white/5 transition-colors cursor-pointer"
|
|
|
onClick={() => (window.location.href = `/metrics/${metric.id.toLowerCase()}`)}
|
|
onClick={() => (window.location.href = `/metrics/${metric.id.toLowerCase()}`)}
|
|
|
>
|
|
>
|
|
@@ -208,16 +279,18 @@ export default function DashboardContent() {
|
|
|
<span className="text-on-surface">{metric.name}</span>
|
|
<span className="text-on-surface">{metric.name}</span>
|
|
|
</td>
|
|
</td>
|
|
|
<td className="p-4 text-sm text-secondary">
|
|
<td className="p-4 text-sm text-secondary">
|
|
|
- {metric.subMetrics[0]?.values[0]?.name || "综合能力评估"}
|
|
|
|
|
|
|
+ {metric.id === "D4" ? "后端 D4 指标接口" : "等待后端接口"}
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td className={`p-4 font-mono text-sm ${metric.score == null ? "text-outline" : `text-${metric.colorClass}`}`}>
|
|
|
|
|
+ {metric.avgScore}
|
|
|
</td>
|
|
</td>
|
|
|
- <td className={`p-4 font-mono text-sm text-${metric.colorClass}`}>{metric.avgScore}</td>
|
|
|
|
|
<td className="p-4 whitespace-nowrap">
|
|
<td className="p-4 whitespace-nowrap">
|
|
|
<span className={`text-xs font-bold px-3 py-1 rounded-full border whitespace-nowrap ${status.class}`}>
|
|
<span className={`text-xs font-bold px-3 py-1 rounded-full border whitespace-nowrap ${status.class}`}>
|
|
|
{status.label}
|
|
{status.label}
|
|
|
</span>
|
|
</span>
|
|
|
</td>
|
|
</td>
|
|
|
</tr>
|
|
</tr>
|
|
|
- )
|
|
|
|
|
|
|
+ );
|
|
|
})}
|
|
})}
|
|
|
</tbody>
|
|
</tbody>
|
|
|
</table>
|
|
</table>
|