import { useAuth } from "@/_core/hooks/useAuth"; import { trpc } from "@/lib/trpc"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Progress } from "@/components/ui/progress"; import { Skeleton } from "@/components/ui/skeleton"; import { Target, Video, Activity, TrendingUp, Award, Clock, Zap, BarChart3, ChevronRight } from "lucide-react"; import { useLocation } from "wouter"; import { ResponsiveContainer, LineChart, Line, XAxis, YAxis, Tooltip, CartesianGrid, AreaChart, Area } from "recharts"; function NTRPBadge({ rating }: { rating: number }) { let level = "初学者"; let color = "bg-gray-100 text-gray-700"; if (rating >= 4.0) { level = "高级竞技"; color = "bg-purple-100 text-purple-700"; } else if (rating >= 3.0) { level = "中高级"; color = "bg-blue-100 text-blue-700"; } else if (rating >= 2.5) { level = "中级"; color = "bg-green-100 text-green-700"; } else if (rating >= 2.0) { level = "初中级"; color = "bg-yellow-100 text-yellow-700"; } else if (rating >= 1.5) { level = "初级"; color = "bg-orange-100 text-orange-700"; } return ( NTRP {rating.toFixed(1)} · {level} ); } export default function Dashboard() { const { user } = useAuth(); const { data: stats, isLoading } = trpc.profile.stats.useQuery(); const [, setLocation] = useLocation(); if (isLoading) { return (
NTRP评分
{(stats?.ntrpRating || 1.5).toFixed(1)}
训练次数
{stats?.totalSessions || 0}
训练时长
{stats?.totalMinutes || 0}分钟
总击球数
{stats?.totalShots || 0}
完成视频分析后将显示评分趋势
{a.exerciseType || "综合分析"}
{new Date(a.createdAt).toLocaleDateString("zh-CN")} {a.shotCount ? ` · ${a.shotCount}次击球` : ""}
上传训练视频后可查看分析结果