Implement active user tiers, class-based Tailwind theme switcher, 3-tiled static dashboard layout, Minio object storage integration, school & state settings database sync, and streak wishes onboarding modal
This commit is contained in:
@@ -7,9 +7,10 @@ import { Label } from "@/components/ui/label"
|
||||
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from "recharts"
|
||||
import { Activity, Clock, Flame, AlertTriangle, RefreshCw } from "lucide-react"
|
||||
|
||||
import { useActiveUser } from "@/hooks/useActiveUser"
|
||||
|
||||
// Hardcoded mock UUIDs for this sprint
|
||||
const PARENT_ID = "parent-123"
|
||||
const STUDENT_ID = "b0e17378-864d-439e-8806-708dc48a891b"
|
||||
|
||||
const DICTIONARY = {
|
||||
en: {
|
||||
@@ -49,6 +50,7 @@ const DICTIONARY = {
|
||||
}
|
||||
|
||||
export default function ParentDashboard() {
|
||||
const { userId, loading: userLoading } = useActiveUser()
|
||||
const [lang, setLang] = useState<'en' | 'hi'>('en')
|
||||
const [data, setData] = useState<any>(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
@@ -56,9 +58,10 @@ export default function ParentDashboard() {
|
||||
const t = DICTIONARY[lang]
|
||||
|
||||
useEffect(() => {
|
||||
if (userLoading || !userId) return;
|
||||
async function fetchDashboard() {
|
||||
try {
|
||||
const res = await fetch(`http://localhost:8000/api/parent/${PARENT_ID}/dashboard/${STUDENT_ID}`)
|
||||
const res = await fetch(`/api/parent/${PARENT_ID}/dashboard/${userId}`)
|
||||
if (!res.ok) throw new Error("Failed to fetch")
|
||||
const payload = await res.json()
|
||||
setData(payload)
|
||||
@@ -89,7 +92,7 @@ export default function ParentDashboard() {
|
||||
}
|
||||
}
|
||||
fetchDashboard()
|
||||
}, [])
|
||||
}, [userId, userLoading])
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user