"use client"; import React, { useState, useEffect } from "react"; import { db } from "@/lib/firebase"; import { collection, onSnapshot } from "firebase/firestore"; import { motion } from "framer-motion"; import { User, ShieldCheck, Briefcase } from "lucide-react"; interface Employee { id: string; name: string; position: string; department: string; } export default function OrgChartPage() { const [employees, setEmployees] = useState([]); useEffect(() => { const unsub = onSnapshot(collection(db, "employees"), (snap) => { setEmployees(snap.docs.map(doc => ({ id: doc.id, ...doc.data() } as Employee))); }); return () => unsub(); }, []); return (

Structure / Hierarchy

Arquitectura Organizacional en Tiempo Real

{/* CEO Level */}
{/* Departments Level */}
{/* Connecting Lines */}
} employees={employees} /> } employees={employees} /> } employees={employees} />
); } function OrgSection({ title, icon, employees }: { title: string, icon: React.ReactNode, employees: Employee[] }) { return (
{icon}
{title}
{employees.length === 0 ? (
Sin asignar
) : ( employees.slice(0, 3).map((emp, i) => ( )) )}
); } function OrgNode({ label, name, position, type }: { label?: string, name: string, position: string, type?: string }) { return (
{label && {label}}

{name}

{position}

); }