+ {/* Stats Cards */}
+
+
+
+ Total Orders
+
+
+
+ {systemStats?.orders || 0}
+
+
+
- {/* Orders Table with Pagination */}
-
+
+
+ Acknowledged
+
+
+
+ {acknowledgedOrders.length}
+
+
+
- {/* Order Analytics */}
-
-
-
- Order Status Distribution
- Breakdown of recent orders by status
-
-
-
-
-
-
-
Acknowledged
+
+
+ Paid
+
+
-
- {orders.length > 0 ? Math.round((acknowledgedOrders.length / orders.length) * 100) : 0}%
-
-
-
-
-
-
Paid
+
+
+ {paidOrders.length}
+
-
- {orders.length > 0 ? Math.round((paidOrders.length / orders.length) * 100) : 0}%
-
-
-
-
-
- {orders.length > 0 ? Math.round((completedOrders.length / orders.length) * 100) : 0}%
-
-
-
-
-
- {orders.length > 0 ? Math.round((cancelledOrders.length / orders.length) * 100) : 0}%
-
-
-
-
-
+
+
-
-
- Order Summary
- Recent order activity breakdown
-
-
-
-
- Total Recent Orders
- {orders.length}
-
-
- Acknowledged
- {acknowledgedOrders.length}
-
-
- Paid
- {paidOrders.length}
-
-
- Completed
- {completedOrders.length}
-
-
- Cancelled
- {cancelledOrders.length}
-
-
-
-
-
+
+
+ Completed
+
+
+
+
+
+ {completedOrders.length}
+
+
+
+
+
+ {/* Orders Table with Pagination */}
+
+
+
+
+ {/* Order Analytics */}
+
+
+
+ Status Distribution
+ Breakdown of active orders
+
+
+
+
+
+
+
+
Acknowledged
+
Waiting for shipment
+
+
+
+ {orders.length > 0 ? Math.round((acknowledgedOrders.length / orders.length) * 100) : 0}%
+
+
+
+
+
+
+
Paid
+
Payment confirmed
+
+
+
+ {orders.length > 0 ? Math.round((paidOrders.length / orders.length) * 100) : 0}%
+
+
+
+
+
+
+
Completed
+
Successfully concluded
+
+
+
+ {orders.length > 0 ? Math.round((completedOrders.length / orders.length) * 100) : 0}%
+
+
+
+
+
+
+
+
+ Activity Summary
+ Recent volume breakdown
+
+
+
+
+ Total Displayed Orders
+ {orders.length}
+
+
+
+
Active
+
{acknowledgedOrders.length + paidOrders.length}
+
+
+
Finished
+
{completedOrders.length}
+
+
+
Voided
+
{cancelledOrders.length}
+
+
+
Success Rate
+
+ {orders.length > 0 ? Math.round((completedOrders.length / (orders.length - (acknowledgedOrders.length + paidOrders.length))) * 100) || 100 : 0}%
+
+
+
+
+
+
+
+
+
);
}
diff --git a/app/dashboard/admin/status/page.tsx b/app/dashboard/admin/status/page.tsx
index f686311..c9b73bf 100644
--- a/app/dashboard/admin/status/page.tsx
+++ b/app/dashboard/admin/status/page.tsx
@@ -1,9 +1,10 @@
import React from "react";
-import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
-import { Server, Database, Cpu, HardDrive, Activity } from "lucide-react";
+import { Server, Database, Cpu, HardDrive, Activity, Zap } from "lucide-react";
import { fetchServer } from "@/lib/api";
import SystemStatusCard from "@/components/admin/SystemStatusCard";
+import { MotionWrapper } from "@/components/ui/motion-wrapper";
export const dynamic = 'force-dynamic';
@@ -35,17 +36,19 @@ export default async function AdminStatusPage() {
console.error("Failed to fetch system status:", err);
error = "Failed to load system status";
}
+
if (error) {
return (
-
+
-
System Status
-
Monitor system health and performance metrics
+
System Status
+
Monitor system health and real-time performance metrics
-
+
-
-
{error}
+
@@ -67,116 +70,176 @@ export default async function AdminStatusPage() {
return Math.round(bytes / Math.pow(1024, i) * 100) / 100 + ' ' + sizes[i];
};
- const memoryUsagePercent = systemStatus ?
+ const memoryUsagePercent = systemStatus ?
Math.round((systemStatus.memory.heapUsed / systemStatus.memory.heapTotal) * 100) : 0;
return (
-
+
-
System Status
-
Monitor system health and performance metrics
+
+ System Status
+
+
+ Monitor system health and real-time performance metrics
+
-
+
+
+
-
- {/* Server Status */}
-
-
- Server Status
-
-
-
-
- Online
-
- {systemStatus ? formatUptime(systemStatus.uptimeSeconds) : 'N/A'}
-
-
-
- Last checked: {new Date().toLocaleTimeString()}
-
-
-
+
+ {/* Server Status */}
+
+
+ Server Uptime
+
+
+
+
+
+
+
+ {systemStatus ? formatUptime(systemStatus.uptimeSeconds) : 'N/A'}
+
+
+
+
+ Online
+
+
+ Checked: {new Date().toLocaleTimeString()}
+
+
+
+
- {/* Database Status */}
-
-
- Database
-
-
-
-
- Connected
-
- {systemStatus ? `${systemStatus.counts.vendors + systemStatus.counts.orders + systemStatus.counts.products} records` : 'N/A'}
-
-
-
- Total collections: 4
-
-
-
+ {/* Database Status */}
+
+
+ Database Health
+
+
+
+
+
+
+
+ {systemStatus ? `${(systemStatus.counts.vendors + systemStatus.counts.orders + systemStatus.counts.products).toLocaleString()}` : '0'}
+
+ records
+
+
+
+ Connected
+
+
+ 4 active collections
+
+
+
+
- {/* Memory Usage */}
-
-
- Memory
-
-
-
-
- 80 ? "destructive" : memoryUsagePercent > 60 ? "secondary" : "outline"}>
- {memoryUsagePercent}%
-
-
- {systemStatus ? formatBytes(systemStatus.memory.heapUsed) : 'N/A'}
-
-
-
- Total: {systemStatus ? formatBytes(systemStatus.memory.heapTotal) : 'N/A'}
-
-
-
+ {/* Memory Usage */}
+
+
+ Memory Usage
+
+
+
+
+
+
+
+ {systemStatus ? formatBytes(systemStatus.memory.heapUsed) : 'N/A'}
+
+ used
+
+
+ 80 ? 'bg-red-500/10 text-red-500 border-red-500/20' :
+ memoryUsagePercent > 60 ? 'bg-yellow-500/10 text-yellow-500 border-yellow-500/20' :
+ 'bg-purple-500/10 text-purple-500 border-purple-500/20'}
+ `}>
+ {memoryUsagePercent}% Load
+
+
+ Total: {systemStatus ? formatBytes(systemStatus.memory.heapTotal) : 'N/A'}
+
+
+
+
- {/* Platform Stats */}
-
-
- Platform Stats
-
-
-
-
- Active
-
- {systemStatus ? `${systemStatus.counts.vendors} vendors` : 'N/A'}
-
-
-
- {systemStatus ? `${systemStatus.counts.orders} orders, ${systemStatus.counts.products} products` : 'N/A'}
-
-
-
+ {/* Platform Stats */}
+
+
+ Platform Activity
+
+
+
+
+
+ {systemStatus ? systemStatus.counts.vendors : '0'}
+
+ Active Vendors
+
+
+
+ Live
+
+
+ {systemStatus ? `${systemStatus.counts.orders} orders` : '0 orders'}
+
+
+
+
- {/* Node.js Version */}
-
-
- Runtime
-
-
-
-
-
- {systemStatus ? `Node ${systemStatus.versions.node}` : 'N/A'}
-
- Runtime
-
-
- {systemStatus ? `V8: ${systemStatus.versions.v8}` : 'N/A'}
-
-
-
-
+ {/* Runtime Info */}
+
+
+ Runtime Environment
+
+
+
+
+
+
+
+
+
+ {systemStatus ? `v${systemStatus.versions.node}` : 'N/A'}
+
+
+
+
+
+
+
+
+ {systemStatus ? systemStatus.versions.v8 : 'N/A'}
+
+
+
+
+
+
+
+ Performance Optimized
+
+
+
+
+
+
+
);
}