import { useMemo } from "react"; import { NavLink, useLocation } from "@/lib/router"; import { useQuery } from "@tanstack/react-query"; import { House, CircleDot, SquarePen, Users, Inbox, } from "lucide-react"; import { sidebarBadgesApi } from "../api/sidebarBadges"; import { useCompany } from "../context/CompanyContext"; import { useDialog } from "../context/DialogContext"; import { queryKeys } from "../lib/queryKeys"; import { cn } from "../lib/utils"; interface MobileBottomNavProps { visible: boolean; } interface MobileNavLinkItem { type: "link"; to: string; label: string; icon: typeof House; badge?: number; } interface MobileNavActionItem { type: "action"; label: string; icon: typeof SquarePen; onClick: () => void; } type MobileNavItem = MobileNavLinkItem | MobileNavActionItem; export function MobileBottomNav({ visible }: MobileBottomNavProps) { const location = useLocation(); const { selectedCompanyId } = useCompany(); const { openNewIssue } = useDialog(); const { data: sidebarBadges } = useQuery({ queryKey: queryKeys.sidebarBadges(selectedCompanyId!), queryFn: () => sidebarBadgesApi.get(selectedCompanyId!), enabled: !!selectedCompanyId, }); const items = useMemo( () => [ { type: "link", to: "/dashboard", label: "Home", icon: House }, { type: "link", to: "/issues", label: "Issues", icon: CircleDot }, { type: "action", label: "Create", icon: SquarePen, onClick: () => openNewIssue() }, { type: "link", to: "/agents/all", label: "Agents", icon: Users }, { type: "link", to: "/inbox", label: "Inbox", icon: Inbox, badge: sidebarBadges?.inbox, }, ], [openNewIssue, sidebarBadges?.inbox], ); return ( ); }