Add debugging to dashboard cards and fix data display - Added console logging to see exact data being passed to dashboard cards - Enhanced debug section to show data types and values - Added specific debugging for SuperAdmin dashboard rendering
This commit is contained in:
parent
7c28c49e75
commit
f2bc8795ea
1 changed files with 100 additions and 82 deletions
|
|
@ -156,11 +156,28 @@ const Dashboard = () => {
|
||||||
<p><strong>Course Stats:</strong> {JSON.stringify(courseStats)}</p>
|
<p><strong>Course Stats:</strong> {JSON.stringify(courseStats)}</p>
|
||||||
<p><strong>User Role:</strong> {user?.role}</p>
|
<p><strong>User Role:</strong> {user?.role}</p>
|
||||||
<p><strong>Is Super Admin:</strong> {isSuperAdmin ? 'Yes' : 'No'}</p>
|
<p><strong>Is Super Admin:</strong> {isSuperAdmin ? 'Yes' : 'No'}</p>
|
||||||
|
<p><strong>Card Values:</strong></p>
|
||||||
|
<ul className="ml-4">
|
||||||
|
<li>Total Users: {userStats?.stats?.totalUsers} (type: {typeof userStats?.stats?.totalUsers})</li>
|
||||||
|
<li>Trainers: {userStats?.stats?.trainers} (type: {typeof userStats?.stats?.trainers})</li>
|
||||||
|
<li>Trainees: {userStats?.stats?.trainees} (type: {typeof userStats?.stats?.trainees})</li>
|
||||||
|
<li>Total Courses: {courseStats?.stats?.totalCourses} (type: {typeof courseStats?.stats?.totalCourses})</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderSuperAdminDashboard = () => (
|
const renderSuperAdminDashboard = () => {
|
||||||
|
console.log('Rendering SuperAdmin dashboard with data:', {
|
||||||
|
userStats,
|
||||||
|
courseStats,
|
||||||
|
totalUsers: userStats?.stats?.totalUsers,
|
||||||
|
trainers: userStats?.stats?.trainers,
|
||||||
|
trainees: userStats?.stats?.trainees,
|
||||||
|
totalCourses: courseStats?.stats?.totalCourses
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||||
<div className="card">
|
<div className="card">
|
||||||
|
|
@ -254,6 +271,7 @@ const Dashboard = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const renderTrainerDashboard = () => (
|
const renderTrainerDashboard = () => (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue