import { useState } from "react"; import { Layout, ListTodo, Plus, Columns, LogOut, Settings, Building2, Clock, ChevronDown, FolderKanban, Tag, BarChart3, PieChart, Search, User, Users, PlusCircle, } from "lucide-react"; import { NavLink, Outlet, Navigate, Link, useLocation } from "react-router-dom"; import { useAuth } from "../contexts/AuthContext"; import { cn } from "../lib/utils"; import { motion } from "framer-motion"; const navLinkClassName = ({ isActive }: { isActive: boolean }) => cn( "inline-flex items-center gap-2 rounded-xl px-4 py-2 text-sm font-semibold transition-all duration-200", isActive ? "bg-brand text-white shadow-md shadow-brand/20" : "text-text-muted hover:bg-surface-muted hover:text-text-main", ); const dropdownItemClassName = ({ isActive }: { isActive: boolean }) => cn( "flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-sm font-bold transition-all duration-200", isActive ? "bg-brand/10 text-brand" : "text-text-muted hover:bg-surface-muted hover:text-text-main", ); export function AppShell() { const { user, isAuthenticated, isLoading, logout, activeOrg, setActiveOrg } = useAuth(); const location = useLocation(); const [showOrgSwitcher, setShowOrgSwitcher] = useState(false); const [showTasksDropdown, setShowTasksDropdown] = useState(false); const [showTeamDropdown, setShowTeamDropdown] = useState(false); const [showAvatarDropdown, setShowAvatarDropdown] = useState(false); const isAdmin = activeOrg?.roles.includes("OWNER") || activeOrg?.roles.includes("ADMIN"); if (isLoading) { return (
); } if (!isAuthenticated) { return ; } if ( isAuthenticated && user && user.organizations.length === 0 && location.pathname !== "/organizations" ) { return ; } return (
{/* Top Navigation */}
BeeTask Workspace
{/* Org Switcher */}
{showOrgSwitcher && ( <>
setShowOrgSwitcher(false)} />
Suas Organizações
{user?.organizations.map((org) => ( ))}
setShowOrgSwitcher(false)} className="flex w-full items-center gap-2 rounded-xl px-3 py-2 text-xs font-bold text-brand hover:bg-brand/5 transition-all" > Gerenciar Organizações
)}
{/* Desktop Navigation */}
{/* Right Actions */}
Nova Tarefa
{/* Avatar Dropdown */}
{showAvatarDropdown && ( <>
setShowAvatarDropdown(false)} />

{user?.name}

{user?.email}

setShowAvatarDropdown(false)} className="flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-sm font-bold text-text-muted hover:bg-surface-muted hover:text-text-main transition-all" > Meu Perfil
)}
{/* Main Content */}
{/* Footer / Mobile Nav */}
); }