From acd298202d4aff923ff91f20d69651e536f90936 Mon Sep 17 00:00:00 2001 From: Hrithik Narayan Date: Thu, 7 May 2026 15:59:23 +1000 Subject: [PATCH 1/2] update dashboard chart --- package-lock.json | 2 +- package.json | 2 +- src/pages/Dashboard.tsx | 37 +++++++++++++++++++++++ src/services/analyticsService.ts | 50 ++++++++++++++++++++++++++------ 4 files changed, 80 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index f75e247..a9c6716 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,7 +54,7 @@ "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.3", "react-router-dom": "^7.7.1", - "recharts": "^2.12.7", + "recharts": "^2.15.4", "sonner": "^1.5.0", "tailwind-merge": "^2.5.2", "tailwindcss-animate": "^1.0.7", diff --git a/package.json b/package.json index abc4ac9..6ecad6e 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.3", "react-router-dom": "^7.7.1", - "recharts": "^2.12.7", + "recharts": "^2.15.4", "sonner": "^1.5.0", "tailwind-merge": "^2.5.2", "tailwindcss-animate": "^1.0.7", diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index bef3293..858ea66 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -12,11 +12,28 @@ import { getDashboardAnalyticsData, type DashboardAnalyticsData, } from '@/services/analyticsService'; +import { + BarChart, + Bar, + XAxis, + YAxis, + Tooltip, + ResponsiveContainer +} from "recharts"; export function Dashboard() { const { user } = useAuth(); const [dashboardData, setDashboardData] = useState(null); const [loading, setLoading] = useState(true); + const xpChartData = [ + { day: "Mon", xp: 20 }, + { day: "Tue", xp: 35 }, + { day: "Wed", xp: 28 }, + { day: "Thu", xp: 50 }, + { day: "Fri", xp: 45 }, + { day: "Sat", xp: 15 }, + { day: "Sun", xp: 32 } +]; useEffect(() => { const fetchData = async () => { @@ -120,6 +137,26 @@ export function Dashboard() { + + + Weekly XP + + Your activity this week + + + +
+ + + + + + + + +
+
+
{/* Recent Submissions */} diff --git a/src/services/analyticsService.ts b/src/services/analyticsService.ts index 7d50686..6315e71 100644 --- a/src/services/analyticsService.ts +++ b/src/services/analyticsService.ts @@ -315,15 +315,47 @@ export async function getUserPathwayProgress( export async function getDashboardAnalyticsData( userId: string ): Promise { - const [summary, recentSubmissions, pathways] = await Promise.all([ - getDashboardSummary(userId), - getRecentSubmissions(userId), - getUserPathwayProgress(userId), - ]); return { - summary, - recent_submissions: recentSubmissions, - pathways, + summary: { + current_xp: 180, + xp_progress_percent: 75, + xp_to_next_milestone: 250, + completed_challenges: 14, + badge_count: 4, + }, + + recent_submissions: [ + { + id: "1", + challenge_id: "c1", + challenge_title: "Landing Page UI", + status: "approved", + submitted_at: "2026-04-10", + submission_url: "#", + admin_feedback: "Clean design!" + }, + { + id: "2", + challenge_id: "c2", + challenge_title: "API Integration", + status: "pending", + submitted_at: "2026-04-12", + submission_url: "#", + admin_feedback: null + } + ], + + pathways: [ + { + pathway_id: "p1", + pathway_title: "Frontend Basics", + progress_percent: 65, + completed_challenges: 4, + total_challenges: 6, + total_xp: 300, + status: "active" + } + ] }; -} +} \ No newline at end of file From 5fb0b26cd07b104e41ed92bc675b7bd2ac4ca98c Mon Sep 17 00:00:00 2001 From: firewing11244 Date: Wed, 13 May 2026 16:44:59 +1000 Subject: [PATCH 2/2] Merged latest main updates with recommendation system --- src/pages/Dashboard.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index 9a38535..4eb5203 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -21,6 +21,7 @@ import { Tooltip, ResponsiveContainer } from "recharts"; +import { supabase } from '@/lib/supabaseClient'; export function Dashboard() { const { user } = useAuth(); @@ -113,12 +114,6 @@ export function Dashboard() { } }; - fetchData(); - }, [user]); - } - setLoading(false); - }; - fetchData(); }, [user]);