"use client"; import React, { useState, useEffect, ReactNode } from "react"; import { useRouter } from "next/navigation"; import Image from "next/image"; import Header from "@/components/Header"; import SlidingGallery from "@/components/SlidingGallery"; import BackgroundWrapper from "@/components/BackgroundWrapper"; import DestructibleAlert from "@/components/DestructibleAlert"; import { ChevronRight } from "lucide-react"; import styles from "@/css/Home.module.css"; import { API_URL } from "@/lib/auth"; import { Avatar } from "@/components/ui/avatar"; import { getLinkedViews } from "@/lib/gallery-views"; import { getTopThree } from "@/lib/leaderboard"; interface LinkedView { id: string; content: ReactNode; } const page = () => { const router = useRouter(); const [boardData, setBoardData] = useState([]); const [boardError, setBoardError] = useState(null); const [linkedViews, setLinkedViews] = useState(); const performanceData = [ { label: "Mock Test", progress: 20 }, { label: "Topic Test", progress: 70 }, { label: "Subject Test", progress: 50 }, ]; const progressData = [ { label: "Physics", progress: 25 }, { label: "Chemistry", progress: 57 }, ]; useEffect(() => { let isMounted = true; async function fetchBoardData() { try { const response = await fetch(`${API_URL}/leaderboard`); if (!response.ok) { throw new Error("Failed to fetch leaderboard data"); } const data = await response.json(); if (isMounted) setBoardData(data); } catch (error) { if (isMounted) setBoardError(error.message || "An error occurred"); } } const fetchedLinkedViews = getLinkedViews(); setLinkedViews(fetchedLinkedViews); fetchBoardData(); return () => { isMounted = false; }; }, []); return (
{/* Categories Section */}

Categories

{/* Leaderboard Section */}

Leaderboard

Top 3
{getTopThree(boardData).map((student, idx) => (
{student.rank} {student.name}
{student.points}pt
))}
{/* Performance Summary Section */}

Performance Summary

Coming soon.

{/* Progress Tracker Section */}

Progress Tracker

Coming soon.

{/* Daily Quiz Section */}

Daily Quiz

Coming soon.

{/* Live Exams Section */}

Live Exams

Coming soon.

); }; export default page;