"use client"; import { config } from "@repo/config"; import { useSession } from "@saas/auth/hooks/use-session"; import { useActiveOrganization } from "@saas/organizations/hooks/use-active-organization"; import { UserMenu } from "@saas/shared/components/UserMenu"; import { Logo } from "@shared/components/Logo"; import { cn } from "@ui/lib"; import { BotMessageSquareIcon, ChevronRightIcon, HomeIcon, SettingsIcon, UserCog2Icon, UserCogIcon, } from "lucide-react"; import { useTranslations } from "next-intl"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { OrganzationSelect } from "../../organizations/components/OrganizationSelect"; export function NavBar() { const t = useTranslations(); const pathname = usePathname(); const { user } = useSession(); const { activeOrganization } = useActiveOrganization(); const { useSidebarLayout } = config.ui.saas; const basePath = activeOrganization ? `/app/${activeOrganization.slug}` : "/app"; const menuItems = [ { label: t("app.menu.start"), href: basePath, icon: HomeIcon, isActive: pathname === basePath, }, { label: t("app.menu.aiChatbot"), href: activeOrganization ? `/app/${activeOrganization.slug}/chatbot` : "/app/chatbot", icon: BotMessageSquareIcon, isActive: pathname.includes("/chatbot"), }, ...(activeOrganization ? [ { label: t("app.menu.organizationSettings"), href: `${basePath}/settings`, icon: SettingsIcon, isActive: pathname.startsWith(`${basePath}/settings/`), }, ] : []), { label: t("app.menu.accountSettings"), href: "/app/settings", icon: UserCog2Icon, isActive: pathname.startsWith("/app/settings/"), }, ...(user?.role === "admin" ? [ { label: t("app.menu.admin"), href: "/app/admin", icon: UserCogIcon, isActive: pathname.startsWith("/app/admin/"), }, ] : []), ]; return ( ); }