diff --git a/frontend/src/pages/Admin/AdminDashboard.js b/frontend/src/pages/Admin/AdminDashboard.js
index 41d892f..0dbc6e4 100644
--- a/frontend/src/pages/Admin/AdminDashboard.js
+++ b/frontend/src/pages/Admin/AdminDashboard.js
@@ -1,11 +1,155 @@
-import React from 'react';
+import React, { useState, useEffect } from 'react';
+import { UsersIcon, CogIcon, DatabaseIcon, ChartBarIcon } from '@heroicons/react/24/outline';
+import { adminAPI } from '../../services/api';
+import LoadingSpinner from '../../components/UI/LoadingSpinner';
const AdminDashboard = () => {
+ const [stats, setStats] = useState(null);
+ const [loading, setLoading] = useState(true);
+ const [error, setError] = useState(null);
+
+ useEffect(() => {
+ const fetchDashboardData = async () => {
+ try {
+ setLoading(true);
+ const response = await adminAPI.getDashboard();
+ setStats(response.data.data);
+ setError(null);
+ } catch (err) {
+ console.error('Failed to fetch admin dashboard:', err);
+ setError('Failed to load dashboard data');
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ fetchDashboardData();
+ }, []);
+
+ if (loading) {
+ return (
+
+
Admin Dashboard
+
+
+
+
+ );
+ }
+
+ if (error) {
+ return (
+
+
Admin Dashboard
+
+
+
{error}
+
+
+
+
+ );
+ }
+
+ const statCards = [
+ {
+ title: 'Total Users',
+ value: stats?.stats?.totalUsers || 0,
+ icon: UsersIcon,
+ color: 'blue',
+ subtitle: `${stats?.stats?.adminUsers || 0} admins`
+ },
+ {
+ title: 'Total Properties',
+ value: stats?.stats?.totalProperties || 0,
+ icon: DatabaseIcon,
+ color: 'green',
+ subtitle: `${stats?.stats?.totalEquipment || 0} equipment items`
+ },
+ {
+ title: 'Total Applications',
+ value: stats?.stats?.totalApplications || 0,
+ icon: ChartBarIcon,
+ color: 'purple',
+ subtitle: `${stats?.stats?.recentApplications || 0} recent`
+ },
+ {
+ title: 'Total Products',
+ value: stats?.stats?.totalProducts || 0,
+ icon: CogIcon,
+ color: 'green',
+ subtitle: `${stats?.stats?.customProducts || 0} custom`
+ }
+ ];
+
return (
-
Admin Dashboard
-
-
Admin dashboard coming soon...
+
+
Admin Dashboard
+
System overview and management
+
+
+ {/* Stats Grid */}
+
+ {statCards.map((stat, index) => (
+
+
+
+
+
+
+
{stat.title}
+
{stat.value}
+
{stat.subtitle}
+
+
+
+ ))}
+
+
+ {/* Quick Actions */}
+
+
+
Quick Actions
+
+
+
+
+
+
+
+
+
Recent Activity
+
+ {stats?.recentActivity?.length > 0 ? (
+ stats.recentActivity.map((activity, index) => (
+
+
+
{activity.action}
+
{activity.user}
+
+
{activity.timestamp}
+
+ ))
+ ) : (
+
No recent activity
+ )}
+
+
);