|
1 | 1 | import { useState, useEffect, useCallback } from 'react'; |
2 | 2 | import { useNavigate, Link } from 'react-router-dom'; |
3 | | -import { Plus, Edit, Trash2, Users, Shield, Code, BarChart3, AlertTriangle, Loader2, Activity, Percent, Clock, Download, Upload } from 'lucide-react'; |
| 3 | +import { Plus, Edit, Trash2, Users, Shield, Code, BarChart3, AlertTriangle, Loader2, Activity, Percent, Clock, Download, Upload, Trophy } from 'lucide-react'; |
4 | 4 | import toast from 'react-hot-toast'; |
5 | 5 | import { useAuth } from '../context/AuthContext'; |
6 | 6 | import api from '../services/api'; |
@@ -275,6 +275,35 @@ export default function Admin() { |
275 | 275 | </div> |
276 | 276 | )} |
277 | 277 |
|
| 278 | + {/* Top Users */} |
| 279 | + {adminStats?.topUsers && adminStats.topUsers.length > 0 && ( |
| 280 | + <div className="card p-6 mb-6"> |
| 281 | + <h2 className="text-lg font-semibold text-white mb-4 flex items-center gap-2"> |
| 282 | + <Trophy className="w-5 h-5 text-amber-400" /> 活跃用户 Top 10 |
| 283 | + </h2> |
| 284 | + <div className="overflow-x-auto"> |
| 285 | + <table className="w-full text-sm"> |
| 286 | + <thead> |
| 287 | + <tr className="border-b border-dark-700"> |
| 288 | + <th className="text-left py-2 px-3 text-dark-400">#</th> |
| 289 | + <th className="text-left py-2 px-3 text-dark-400">用户名</th> |
| 290 | + <th className="text-right py-2 px-3 text-dark-400">提交次数</th> |
| 291 | + </tr> |
| 292 | + </thead> |
| 293 | + <tbody> |
| 294 | + {adminStats.topUsers.map((u: any, i: number) => ( |
| 295 | + <tr key={i} className="border-b border-dark-800"> |
| 296 | + <td className="py-2 px-3 text-dark-400">{i + 1}</td> |
| 297 | + <td className="py-2 px-3 text-white">{u.username}</td> |
| 298 | + <td className="py-2 px-3 text-dark-300 text-right">{u.submission_count}</td> |
| 299 | + </tr> |
| 300 | + ))} |
| 301 | + </tbody> |
| 302 | + </table> |
| 303 | + </div> |
| 304 | + </div> |
| 305 | + )} |
| 306 | + |
278 | 307 | {/* System Info */} |
279 | 308 | {systemInfo && ( |
280 | 309 | <div className="card p-6 mb-6"> |
|
0 commit comments