diff --git a/app/dashboard/admin/orders/page.tsx b/app/dashboard/admin/orders/page.tsx index 9733c00..8da0c31 100644 --- a/app/dashboard/admin/orders/page.tsx +++ b/app/dashboard/admin/orders/page.tsx @@ -1,8 +1,9 @@ import React from "react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; -import { Package, AlertTriangle } from "lucide-react"; +import { Package, AlertTriangle, CheckCircle2, XCircle, DollarSign } from "lucide-react"; import { fetchServer } from "@/lib/api"; import OrdersTable from "@/components/admin/OrdersTable"; +import { MotionWrapper } from "@/components/ui/motion-wrapper"; export const dynamic = 'force-dynamic'; @@ -26,7 +27,6 @@ interface SystemStats { chats: number; } - export default async function AdminOrdersPage() { let orders: Order[] = []; let systemStats: SystemStats | null = null; @@ -46,14 +46,14 @@ export default async function AdminOrdersPage() { if (error) { return ( -
+
-

Recent Orders

-

Monitor and manage platform orders

+

Recent Orders

+

Monitor and manage platform orders

- + -
+

{error}

@@ -62,146 +62,182 @@ export default async function AdminOrdersPage() { ); } - const acknowledgedOrders = orders.filter(o => o.status === 'acknowledged'); const paidOrders = orders.filter(o => o.status === 'paid'); const completedOrders = orders.filter(o => o.status === 'completed'); const cancelledOrders = orders.filter(o => o.status === 'cancelled'); return ( -
+
-

Recent Orders

-

Monitor and manage platform orders

+

+ Recent Orders +

+

+ Monitor and manage platform transaction activity +

- {/* Stats Cards */} -
- - - Total Orders - - - -
{systemStats?.orders || 0}
-

All platform orders

-
-
- - - Acknowledged - - - -
{acknowledgedOrders.length}
-

Vendor accepted

-
-
- - - Paid - - - -
{paidOrders.length}
-

Payment received

-
-
- - - Completed - - - -
{completedOrders.length}
-

Successfully delivered

-
-
-
+ +
+ {/* Stats Cards */} +
+ + + Total Orders +
+ +
+
+ +
{systemStats?.orders || 0}
+
+
+

Lifetime volume

+
+ + - {/* Orders Table with Pagination */} - + + + Acknowledged +
+ +
+
+ +
{acknowledgedOrders.length}
+
+
+

Vendor pending

+
+ + - {/* 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}
+
+
+

Processing

- - {orders.length > 0 ? Math.round((paidOrders.length / orders.length) * 100) : 0}% - -
-
-
-
- Completed -
- - {orders.length > 0 ? Math.round((completedOrders.length / orders.length) * 100) : 0}% - -
-
-
-
- Cancelled -
- - {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}
+
+
+

Delivered

+
+ + +
+ + {/* 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}

+
+ +

{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 +
+ +
+
+ +
+
+
+

Node.js

+

Runtime

+
+ + {systemStatus ? `v${systemStatus.versions.node}` : 'N/A'} + +
+ +
+ +
+
+

V8

+

Engine

+
+ + {systemStatus ? systemStatus.versions.v8 : 'N/A'} + +
+ +
+ +
+ + Performance Optimized +
+
+ + +
+
+
); }