Skip to content

Commit f1a47c8

Browse files
Widen all layout panels and add Recharts to Dashboard
1 parent 66b0f44 commit f1a47c8

3 files changed

Lines changed: 33 additions & 4 deletions

File tree

frontend/src/components/Dashboard/ProgressDashboard.tsx

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect, useState } from 'react';
22
import { useAuth } from '../../context/AuthContext';
33
import { Flame, Trophy, CheckCircle, BookOpen, Star } from 'lucide-react';
4-
4+
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts';
55
interface UserStats {
66
streak: number;
77
total_solved: number;
@@ -50,8 +50,19 @@ export const ProgressDashboard: React.FC = () => {
5050

5151
if (!stats) return <div style={{ padding: '2rem', textAlign: 'center' }}>Loading dashboard...</div>;
5252

53+
const chartData = Array.from({ length: 14 }).map((_, i) => {
54+
const d = new Date();
55+
d.setDate(d.getDate() - (13 - i));
56+
const dateStr = d.toISOString().split('T')[0];
57+
const shortDate = d.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
58+
return {
59+
date: shortDate,
60+
solved: stats.activity_map[dateStr] || 0
61+
};
62+
});
63+
5364
return (
54-
<div className="main-content" style={{ padding: '2rem', maxWidth: '900px', margin: '0 auto', width: '100%' }}>
65+
<div className="main-content" style={{ padding: '2rem', maxWidth: '1200px', margin: '0 auto', width: '100%' }}>
5566
<h2 style={{ marginBottom: '2rem' }}>Learning Progress</h2>
5667

5768
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: '1.5rem', marginBottom: '2rem' }}>
@@ -131,6 +142,24 @@ export const ProgressDashboard: React.FC = () => {
131142
</ul>
132143
</div>
133144
</div>
145+
146+
<div className="glass" style={{ padding: '1.5rem', marginTop: '1.5rem' }}>
147+
<h3 style={{ marginBottom: '1.5rem' }}>Problems Solved (Last 14 Days)</h3>
148+
<div style={{ width: '100%', height: 300 }}>
149+
<ResponsiveContainer width="100%" height="100%">
150+
<LineChart data={chartData} margin={{ top: 5, right: 20, bottom: 5, left: 0 }}>
151+
<CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.1)" />
152+
<XAxis dataKey="date" stroke="rgba(255,255,255,0.5)" />
153+
<YAxis stroke="rgba(255,255,255,0.5)" allowDecimals={false} />
154+
<Tooltip
155+
contentStyle={{ backgroundColor: 'hsl(var(--bg-primary))', border: '1px solid rgba(255,255,255,0.1)', borderRadius: '8px' }}
156+
itemStyle={{ color: 'hsl(var(--accent-primary))' }}
157+
/>
158+
<Line type="monotone" dataKey="solved" name="Questions Solved" stroke="hsl(var(--accent-primary))" strokeWidth={3} dot={{ r: 4, fill: 'hsl(var(--accent-primary))' }} activeDot={{ r: 8 }} />
159+
</LineChart>
160+
</ResponsiveContainer>
161+
</div>
162+
</div>
134163
</div>
135164
);
136165
};

frontend/src/components/Graphing/GraphPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const GraphPanel: React.FC = () => {
4040
};
4141

4242
return (
43-
<div className="main-content" style={{ padding: '2rem', maxWidth: '800px', margin: '0 auto', width: '100%', height: '100vh', display: 'flex', flexDirection: 'column' }}>
43+
<div className="main-content" style={{ padding: '2rem', maxWidth: '1200px', margin: '0 auto', width: '100%', height: '100vh', display: 'flex', flexDirection: 'column' }}>
4444
<h2 style={{ marginBottom: '1.5rem' }}>📈 Interactive Graphing</h2>
4545

4646
<div className="glass" style={{ padding: '1.5rem', marginBottom: '1.5rem', display: 'flex', gap: '1rem', flexWrap: 'wrap' }}>

frontend/src/components/Quiz/NCERTQuizPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export const NCERTQuizPanel: React.FC = () => {
231231
const displayQuestion = state.currentQuestionRaw.split(/Answer:/i)[0].trim();
232232

233233
return (
234-
<div className="main-content" style={{ padding: '2rem', maxWidth: '800px', margin: '0 auto', width: '100%', overflowY: 'auto', height: '100vh', boxSizing: 'border-box' }}>
234+
<div className="main-content" style={{ padding: '2rem', maxWidth: '1200px', margin: '0 auto', width: '100%', overflowY: 'auto', height: '100vh', boxSizing: 'border-box' }}>
235235
<h2>📚 NCERT Practice</h2>
236236
<p style={{ color: 'var(--text-secondary)', marginBottom: '1.5rem' }}>Select a class, chapter, and exercise to practice NCERT questions.</p>
237237

0 commit comments

Comments
 (0)