"use client"; import React, { useState, useEffect } from "react"; import { db, auth } from "@/lib/firebase"; import { collection, onSnapshot, query, orderBy, limit } from "firebase/firestore"; import Link from "next/link"; import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, BarChart, Bar, Cell } from 'recharts'; import { Package, Users, ShoppingCart, LayoutDashboard } from 'lucide-react'; import { motion } from 'framer-motion'; const dummyData = [ { name: 'Lun', sales: 4000, products: 2400 }, { name: 'Mar', sales: 3000, products: 1398 }, { name: 'Mie', sales: 2000, products: 9800 }, { name: 'Jue', sales: 2780, products: 3908 }, { name: 'Vie', sales: 1890, products: 4800 }, { name: 'Sab', sales: 2390, products: 3800 }, { name: 'Dom', sales: 3490, products: 4300 }, ]; export default function Dashboard() { const [stats, setStats] = useState({ products: 0, clients: 0, salesCount: 0, revenue: 0 }); useEffect(() => { const unsubProducts = onSnapshot(collection(db, "products"), (snap) => setStats((p) => ({ ...p, products: snap.size }))); const unsubClients = onSnapshot(collection(db, "clients"), (snap) => setStats((p) => ({ ...p, clients: snap.size }))); const unsubSales = onSnapshot(collection(db, "sales"), (snap) => { let rev = 0; snap.forEach((doc) => rev += doc.data().total || 0); setStats((p) => ({ ...p, salesCount: snap.size, revenue: rev })); }); return () => { unsubProducts(); unsubClients(); unsubSales(); }; }, []); return (

ERP / NEXUS

Plataforma de Control Empresarial Inteligente

En Vivo
Global
{/* Stats Table */}
} color="from-blue-600" /> } color="from-purple-600" /> } color="from-orange-600" /> } color="from-emerald-600" />
{/* Advanced Chart */}

Rendimiento Mensual / Revenue

{/* Inventory Widget */}
DATA

Distribución / Stock

); } function StatCard({ title, value, icon, color }: any) { return (
{icon}

{title}

{value}

); } function ProgressWidget({ label, value, color }: any) { return (
{label} {value}%
); }