File size: 8,978 Bytes
addbdb1 8811e47 addbdb1 8811e47 addbdb1 8811e47 addbdb1 8811e47 addbdb1 b811a8f addbdb1 b86abde addbdb1 8811e47 addbdb1 8811e47 addbdb1 8811e47 addbdb1 b86abde addbdb1 8811e47 addbdb1 8811e47 addbdb1 b86abde addbdb1 8811e47 addbdb1 b86abde addbdb1 8811e47 addbdb1 8811e47 addbdb1 8811e47 b811a8f b86abde | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | import React from "react";
import YearlyStreak from "../components/dashboard/YearlyStreak";
import FeedbackScore from "../components/dashboard/FeedBackScore";
import SkillRadarChart from "../components/dashboard/SkillRadarChart";
import { generateYearlyStreakData } from "../utils/generateYearlyStreakData";
import { useAuth } from "../components/context/AuthContext";
import {
PlayCircle,
FileText,
CheckCircle,
Brain,
TrendingUp,
AlertCircle,
Clock,
} from "lucide-react";
const Dashboard = () => {
const { username } = useAuth();
const streakData = generateYearlyStreakData();
// Mock Data for Charts
const radarData = [
{ skill: "DSA", value: 70 },
{ skill: "System Design", value: 60 },
{ skill: "Communication", value: 85 },
{ skill: "Problem Solving", value: 75 },
{ skill: "Accuracy", value: 68 },
{ skill: "Time Mgmt", value: 80 },
];
// Mock Data for Recent Activity
const recentActivities = [
{
id: 1,
type: "interview",
title: "React Native Interview",
date: "Today, 10:23 AM",
score: "85%",
icon: <PlayCircle size={20} />,
},
{
id: 2,
type: "quiz",
title: "Frontend Basics MCQ",
date: "Yesterday",
score: "92%",
icon: <CheckCircle size={20} />,
},
{
id: 3,
type: "note",
title: "System_Design_Notes.pdf",
date: "2 days ago",
status: "Uploaded",
icon: <FileText size={20} />,
},
];
// Mock Data for Quiz Stats
const quizStats = {
completed: 15,
accuracy: 72,
weakestTopic: "Dynamic Programming",
strongestTopic: "React Hooks",
};
return (
// 1. Page Background: #434E78
<div className="px-6 py-8 space-y-8 min-h-screen text-white bg-[#434E78] font-sans">
{/* ----------- HEADER SECTION ----------- */}
<div className="flex flex-col md:flex-row md:items-center justify-between gap-4">
<div>
<h1 className="text-3xl lg:text-4xl font-bold font-handwriting tracking-wide">
Welcome back,{" "}
<span className="text-[#F7E396]">{username || "User"}!</span>
</h1>
<p className="text-[#607B8F] text-gray-300 mt-1">
Track your progress and stay consistent.
</p>
</div>
<button className="px-6 py-3 bg-[#F7E396] text-[#434E78] rounded-xl shadow-lg hover:bg-[#E97F4A] hover:text-white transition-all duration-300 font-bold flex items-center gap-2 transform hover:-translate-y-1">
<PlayCircle size={20} />
Start New Interview
</button>
</div>
{/* ----------- TOP ROW: Performance & Skills ----------- */}
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
{/* 1. AI Feedback Score */}
<div className="bg-[#607B8F] rounded-2xl shadow-xl p-6 border border-white/10 flex flex-col justify-between">
<div className="flex items-center justify-between mb-4">
<h2 className="text-xl font-bold text-white flex items-center gap-2">
<Brain className="text-[#F7E396]" size={24} /> AI Feedback Score
</h2>
<span className="text-xs font-mono text-[#F7E396] bg-[#434E78] px-2 py-1 rounded">
AVG
</span>
</div>
{/* Passed prop to handle transparent background in child */}
<FeedbackScore
confidence={78}
clarity={82}
accuracy={70}
speed={65}
improvements={[
"Improve explanation clarity",
"Practice more DP problems",
]}
/>
</div>
{/* 2. Skill Radar Chart */}
<div className="bg-[#607B8F] rounded-2xl shadow-xl p-6 border border-white/10">
<div className="flex items-center justify-between mb-2">
<h2 className="text-xl font-bold text-white flex items-center gap-2">
<TrendingUp className="text-[#F7E396]" size={24} /> Skill Analysis
</h2>
</div>
<div className="h-64 w-full">
<SkillRadarChart data={radarData} />
</div>
</div>
</div>
{/* ----------- MIDDLE ROW: Activity & Quiz Stats ----------- */}
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
{/* 3. Recent Activity List */}
<div className="bg-[#607B8F] rounded-2xl shadow-xl p-6 border border-white/10">
<h2 className="text-xl font-bold text-white mb-6 flex items-center gap-2">
<Clock className="text-[#F7E396]" size={24} /> Recent Activity
</h2>
<div className="space-y-4">
{recentActivities.map((item) => (
<div
key={item.id}
className="flex items-center justify-between p-4 bg-[#434E78]/50 rounded-xl border border-white/5 hover:border-[#F7E396]/50 transition cursor-pointer"
>
<div className="flex items-center gap-4">
<div
className={`p-3 rounded-full ${
item.type === "interview"
? "bg-blue-500/20 text-blue-300"
: item.type === "quiz"
? "bg-green-500/20 text-green-300"
: "bg-purple-500/20 text-purple-300"
}`}
>
{item.icon}
</div>
<div>
<h4 className="font-semibold text-white">{item.title}</h4>
<p className="text-xs text-gray-300">{item.date}</p>
</div>
</div>
<div className="text-right">
{item.score ? (
<span className="text-lg font-bold text-[#F7E396]">
{item.score}
</span>
) : (
<span className="text-xs bg-white/10 px-2 py-1 rounded text-gray-300">
{item.status}
</span>
)}
</div>
</div>
))}
</div>
</div>
{/* 4. Quiz & Knowledge Metrics */}
<div className="bg-[#607B8F] rounded-2xl shadow-xl p-6 border border-white/10 flex flex-col justify-between">
<div>
<h2 className="text-xl font-bold text-white mb-6 flex items-center gap-2">
<CheckCircle className="text-[#F7E396]" size={24} /> Quiz &
Knowledge
</h2>
<div className="grid grid-cols-2 gap-4 mb-6">
<div className="p-4 bg-[#434E78]/50 rounded-xl border border-white/5">
<p className="text-gray-300 text-sm">Quizzes Completed</p>
<p className="text-3xl font-bold text-white mt-1">
{quizStats.completed}
</p>
</div>
<div className="p-4 bg-[#434E78]/50 rounded-xl border border-white/5">
<p className="text-gray-300 text-sm">Avg. Accuracy</p>
<p className="text-3xl font-bold text-[#F7E396] mt-1">
{quizStats.accuracy}%
</p>
</div>
</div>
<div className="space-y-3">
<div className="flex justify-between items-center p-3 bg-red-500/10 border border-red-500/20 rounded-lg">
<span className="text-sm text-red-200 flex items-center gap-2">
<AlertCircle size={16} /> Weakest Topic
</span>
<span className="font-bold text-red-100">
{quizStats.weakestTopic}
</span>
</div>
<div className="flex justify-between items-center p-3 bg-green-500/10 border border-green-500/20 rounded-lg">
<span className="text-sm text-green-200 flex items-center gap-2">
<TrendingUp size={16} /> Strongest Topic
</span>
<span className="font-bold text-green-100">
{quizStats.strongestTopic}
</span>
</div>
</div>
</div>
<button className="w-full mt-6 py-3 rounded-lg border border-white/20 text-white hover:bg-white/10 transition text-sm font-semibold">
View Detailed Analysis
</button>
</div>
</div>
{/* ----------- BOTTOM ROW: Yearly Streak ----------- */}
<div className="bg-[#607B8F] rounded-2xl shadow-xl p-6 border border-white/10">
<h2 className="text-xl font-bold mb-4 text-white flex items-center gap-2">
<Clock className="text-[#F7E396]" size={24} /> Activity Streak
</h2>
{/* Container for the streak chart to handle responsiveness */}
<div className="overflow-x-auto pb-2">
<YearlyStreak data={streakData} />
</div>
</div>
</div>
);
};
export default Dashboard;
|