'use client'; import { useAuth } from '@/contexts/AuthContext'; import { useSelectedChild } from '@/contexts/SelectedChildContext'; import { LoadingSpinner } from '@/components/common/LoadingSpinner'; import { MentorDashboard } from '@/components/dashboard/MentorDashboard'; import { ClientDashboard } from '@/components/dashboard/ClientDashboard'; import { ParentDashboard } from '@/components/dashboard/ParentDashboard'; export default function DashboardPage() { const { user, loading: authLoading } = useAuth(); const { selectedChild, loading: childLoading, childrenList } = useSelectedChild(); if (authLoading) { return ; } if (!user) { return null; } if (user.role === 'mentor') { return ; } if (user.role === 'client') { return ; } // Родитель: те же страницы, что и студент — показываем дашборд выбранного ребёнка if (user.role === 'parent') { if (childLoading && childrenList.length === 0) { return ; } if (childrenList.length === 0) { return (

Нет привязанных детей. Обратитесь к администратору.

); } if (selectedChild) { return ; } return ; } return (

Неизвестная роль пользователя

); }