import React, { useState } from "react";
import {
Layout,
ListTodo,
PlusCircle,
Columns,
LogOut,
Settings,
Building2,
Clock,
ChevronDown,
Shield,
FolderKanban,
BarChart3,
} from "lucide-react";
import { NavLink, Outlet, Navigate, Link } from "react-router-dom";
import { useAuth } from "../contexts/AuthContext";
import { OnboardingModal } from "./OnboardingModal";
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 [showOrgModal, setShowOrgModal] = useState(false);
const [showOrgSwitcher, setShowOrgSwitcher] = useState(false);
const [showTasksDropdown, setShowTasksDropdown] = useState(false);
const [showOrgDropdown, setShowOrgDropdown] = useState(false);
React.useEffect(() => {
if (isAuthenticated && user && user.organizations.length === 0) {
setShowOrgModal(true);
}
}, [isAuthenticated, user]);
if (isLoading) {
return (
);
}
if (!isAuthenticated) {
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
>
)}