"use client" import { BookOpen, Bug, Crown, ExternalLink, Lightbulb, Mail, type LucideIcon, } from "lucide-react" import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover" import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, } from "@/components/ui/sidebar" import { PageId } from "@/contexts/navigation-context" const supportLinks = [ { name: "Documentation", url: "https://www.swiftcommerce.io/documentation/", icon: BookOpen, }, { name: "Bug Report", url: "https://www.swiftcommerce.io/bug-report/", icon: Bug, }, { name: "Feature Request", url: "https://www.swiftcommerce.io/feature-request/", icon: Lightbulb, }, { name: "Contact Support", url: "https://www.swiftcommerce.io/contact/", icon: Mail, }, ] export function NavProjects({ projects, onNavigate, }: { projects: { name: string url: string icon: LucideIcon pageId?: PageId isExternal?: boolean isSupport?: boolean proFeature?: boolean }[] onNavigate?: (pageId: PageId) => void }) { const handleClick = (item: typeof projects[0], e: React.MouseEvent) => { // If it's an external link, let the browser handle it if (item.isExternal) { return // Don't prevent default - let the navigate } // If it's support, don't navigate (popover will handle it) if (item.isSupport) { e.preventDefault() return } // If it has a pageId, use internal navigation if (item.pageId && onNavigate) { e.preventDefault() onNavigate(item.pageId) } } return ( Quick Access {projects.map((item) => ( {item.isSupport ? ( {item.name}
{supportLinks.map((link) => ( {link.name} ))}
) : ( handleClick(item, e)} target={item.isExternal ? "_blank" : undefined} rel={item.isExternal ? "noopener noreferrer" : undefined} className="cursor-pointer" > {item.name} {item.proFeature && ( )} )} ))} ) }