import { json } from "@remix-run/node"; import { useLoaderData } from "@remix-run/react"; import { BarChart3, Users, Recycle, DollarSign, TrendingUp, TrendingDown, Package, MapPin, Clock, AlertCircle } from "lucide-react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "~/components/ui/card"; import { Badge } from "~/components/ui/badge"; import { Button } from "~/components/ui/button"; export const loader = async () => { const dashboardData = { stats: { totalUsers: 1234, totalWaste: 5678, totalRevenue: 98765, activeCollectors: 45 }, recentTransactions: [ { id: 1, user: "Ahmad Rizki", type: "Plastik", amount: 15000, time: "2 menit lalu" }, { id: 2, user: "Siti Nurhaliza", type: "Kertas", amount: 8500, time: "5 menit lalu" }, { id: 3, user: "Budi Santoso", type: "Logam", amount: 25000, time: "10 menit lalu" }, { id: 4, user: "Diana Putri", type: "Plastik", amount: 12000, time: "15 menit lalu" } ], wasteStats: [ { type: "Plastik", percentage: 45, color: "bg-blue-500" }, { type: "Kertas", percentage: 30, color: "bg-green-500" }, { type: "Logam", percentage: 15, color: "bg-yellow-500" }, { type: "Organik", percentage: 10, color: "bg-red-500" } ], alerts: [ { id: 1, message: "Kapasitas gudang Pengepul A mencapai 85%", type: "warning", time: "1 jam lalu" }, { id: 2, message: "Harga plastik naik 15% hari ini", type: "info", time: "2 jam lalu" }, { id: 3, message: "5 pengepul baru menunggu verifikasi", type: "urgent", time: "3 jam lalu" } ] }; return json({ dashboardData }); }; export default function AdminDashboard() { const { dashboardData } = useLoaderData(); return (
{/* Header */}

Dashboard Overview

Kelola ekosistem pengelolaan sampah secara terpadu

{/* Stats Cards */}
Total Pengguna
{dashboardData.stats.totalUsers.toLocaleString()}

+12% dari bulan lalu

Total Sampah (kg)
{dashboardData.stats.totalWaste.toLocaleString()}

+8% dari bulan lalu

Total Revenue
Rp {dashboardData.stats.totalRevenue.toLocaleString()}

+23% dari bulan lalu

Pengepul Aktif
{dashboardData.stats.activeCollectors}

-2% dari bulan lalu

{/* Content Grid */}
{/* Recent Transactions */} Transaksi Terbaru Aktivitas transaksi sampah dalam 24 jam terakhir
{dashboardData.recentTransactions.map((transaction) => (

{transaction.user}

{transaction.type}

Rp {transaction.amount.toLocaleString()}

{transaction.time}

))}
{/* Side Panel */}
{/* Waste Statistics */} Distribusi Jenis Sampah Persentase berdasarkan volume {dashboardData.wasteStats.map((waste, index) => (
{waste.type} {waste.percentage}%
))}
{/* Alerts */} Notifikasi Penting {dashboardData.alerts.map((alert) => (

{alert.message}

{alert.type}

{alert.time}

))}
{/* Quick Actions */} Quick Actions Aksi cepat untuk mengelola sistem
); }