From 8d0898a1069d0f888bcad60bd1951ed4431bf951 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 5 Aug 2025 23:06:54 +0000 Subject: [PATCH] Create dashboard page for logged-in users cgen-00270b8e8bfa4d03954bc930ac69979f --- client/pages/Dashboard.tsx | 338 +++++++++++++++++++++++++++++++++++++ 1 file changed, 338 insertions(+) create mode 100644 client/pages/Dashboard.tsx diff --git a/client/pages/Dashboard.tsx b/client/pages/Dashboard.tsx new file mode 100644 index 00000000..79da1bb6 --- /dev/null +++ b/client/pages/Dashboard.tsx @@ -0,0 +1,338 @@ +import { useState, useEffect } from "react"; +import Layout from "@/components/Layout"; +import { Button } from "@/components/ui/button"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; +import LoadingScreen from "@/components/LoadingScreen"; +import { Link } from "react-router-dom"; +import { + User, + Settings, + Activity, + TrendingUp, + Zap, + Target, + Users, + Calendar, + Bell, + Star, + Trophy, + Rocket, + Code, + Database, + Shield, + ChevronRight, + MoreHorizontal, + Play, + Pause, + BarChart3 +} from "lucide-react"; + +export default function Dashboard() { + const [isLoading, setIsLoading] = useState(true); + const [activeProjects, setActiveProjects] = useState(3); + + useEffect(() => { + const timer = setTimeout(() => { + setIsLoading(false); + }, 1000); + + return () => clearTimeout(timer); + }, []); + + // Mock user data + const user = { + name: "Alex Thompson", + role: "Game Developer", + level: 15, + xp: 2450, + nextLevelXp: 3000, + avatar: "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=100&h=100&fit=crop&crop=face", + joinDate: "March 2024", + streak: 12 + }; + + const stats = [ + { label: "Active Projects", value: activeProjects, icon: Rocket, color: "from-blue-500 to-purple-600" }, + { label: "Completed Tasks", value: 47, icon: Trophy, color: "from-green-500 to-blue-600" }, + { label: "Team Members", value: 8, icon: Users, color: "from-purple-500 to-pink-600" }, + { label: "Performance Score", value: "94%", icon: TrendingUp, color: "from-orange-500 to-red-600" } + ]; + + const recentProjects = [ + { + name: "Neural Network AI", + progress: 75, + status: "In Progress", + dueDate: "Dec 15", + team: 4, + priority: "High" + }, + { + name: "Blockchain Integration", + progress: 60, + status: "Development", + dueDate: "Dec 20", + team: 3, + priority: "Medium" + }, + { + name: "Cloud Infrastructure", + progress: 90, + status: "Testing", + dueDate: "Dec 10", + team: 6, + priority: "High" + } + ]; + + const achievements = [ + { title: "Code Master", description: "Completed 50+ coding challenges", icon: Code, earned: true }, + { title: "Team Player", description: "Collaborated on 10+ projects", icon: Users, earned: true }, + { title: "Innovation Leader", description: "Led 5+ innovative projects", icon: Rocket, earned: false }, + { title: "Database Wizard", description: "Optimized 20+ databases", icon: Database, earned: false } + ]; + + const quickActions = [ + { title: "Start New Project", icon: Rocket, color: "from-blue-500 to-purple-600" }, + { title: "Join Team", icon: Users, color: "from-green-500 to-blue-600" }, + { title: "Access Labs", icon: Zap, color: "from-yellow-500 to-orange-600" }, + { title: "View Analytics", icon: BarChart3, color: "from-purple-500 to-pink-600" } + ]; + + if (isLoading) { + return ; + } + + return ( + +
+
+ {/* Header */} +
+
+
+

+ Welcome back, {user.name} +

+

+ {user.role} • Level {user.level} • {user.streak} day streak 🔥 +

+
+
+ + +
+
+
+ +
+ {/* Left Sidebar - User Profile */} +
+ {/* Profile Card */} + + +
+
+ User Avatar +
+
+
+

{user.name}

+

{user.role}

+ + Level {user.level} + +
+ + {/* XP Progress */} +
+
+ XP Progress + {user.xp} / {user.nextLevelXp} +
+
+
+
+
+
+ + + + {/* Quick Actions */} + + + Quick Actions + + + {quickActions.map((action, index) => { + const Icon = action.icon; + return ( + + ); + })} + + +
+ + {/* Main Content */} +
+ {/* Stats Grid */} +
+ {stats.map((stat, index) => { + const Icon = stat.icon; + return ( + + +
+
+

{stat.label}

+

{stat.value}

+
+
+ +
+
+
+
+ ); + })} +
+ + {/* Recent Projects */} + + +
+
+ Recent Projects + Your active development projects +
+ +
+
+ + {recentProjects.map((project, index) => ( +
+
+
+ +
+
+

{project.name}

+

+ Due {project.dueDate} • {project.team} team members +

+
+
+
+
+

{project.progress}%

+
+
+
+
+ + {project.priority} + + +
+
+ ))} + + + + {/* Achievements */} + + + Achievements + Your progress and accomplishments + + +
+ {achievements.map((achievement, index) => { + const Icon = achievement.icon; + return ( +
+
+
+ +
+
+

+ {achievement.title} +

+

+ {achievement.description} +

+
+ {achievement.earned && ( + + )} +
+
+ ); + })} +
+
+
+
+
+
+
+ + ); +}