diff --git a/app/bots/BotNavigation.tsx b/app/bots/BotNavigation.tsx index 163ea84..c487254 100644 --- a/app/bots/BotNavigation.tsx +++ b/app/bots/BotNavigation.tsx @@ -5,6 +5,8 @@ import Link from 'next/link'; import type { Route } from 'next'; import { usePathname } from 'next/navigation'; import { Dialog, Transition } from '@headlessui/react'; +import { BotSwitcher, SiteMenuDropdown } from '@/components/navigation'; +import { menuItems } from '@/data/menuItems'; interface MenuItem { id: string; @@ -14,6 +16,7 @@ interface MenuItem { } interface BotNavigationProps { + botSlug: string; botTitle: string; botEmoji: string; botDescription?: string; @@ -27,11 +30,12 @@ interface BotNavigationProps { * Reusable navigation component for bot detail pages */ const BotNavigation: React.FC = ({ + botSlug, botTitle, botEmoji, - botDescription = '', + botDescription: _botDescription = '', accentColor = 'blue', - menuItems, + menuItems: sectionMenuItems, chatLink, sections = true, }) => { @@ -40,22 +44,25 @@ const BotNavigation: React.FC = ({ const [lastScrollY, setLastScrollY] = useState(0); const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); + // Filter site nav items (exclude button items like "Contact Us") + const siteNavItems = menuItems.filter(item => !item.isButton); + // Handle scroll events to highlight active section useEffect(() => { const handleScroll = () => { const currentScrollY = window.scrollY; - + // Determine active section when sections are enabled if (sections) { - const sectionIds = menuItems + const sectionIds = sectionMenuItems .filter(item => item.section) .map(item => item.section as string); - + // Find which section is currently in view const sectionElements = sectionIds .map(id => document.getElementById(id)) .filter(Boolean); - + for (let i = sectionElements.length - 1; i >= 0; i--) { const section = sectionElements[i]; if (section && section.getBoundingClientRect().top <= 300) { @@ -64,24 +71,24 @@ const BotNavigation: React.FC = ({ } } } - + setLastScrollY(currentScrollY); }; window.addEventListener('scroll', handleScroll, { passive: true }); handleScroll(); // Initial check - + return () => window.removeEventListener('scroll', handleScroll); - }, [lastScrollY, menuItems, sections]); + }, [lastScrollY, sectionMenuItems, sections]); // Handle smooth scrolling when clicking a menu item const scrollToSection = (sectionId: string | undefined) => { if (!sectionId) return; - + const element = document.getElementById(sectionId); if (element) { window.scrollTo({ - top: element.offsetTop - 100, + top: element.offsetTop - 100, behavior: 'smooth', }); setActiveSection(sectionId); @@ -90,15 +97,6 @@ const BotNavigation: React.FC = ({ } }; - // Scroll to top function for logo click - const scrollToTop = () => { - window.scrollTo({ - top: 0, - behavior: 'smooth' - }); - setIsMobileMenuOpen(false); - }; - const colorClasses = { blue: { logo: 'bg-blue-100', @@ -145,61 +143,42 @@ const BotNavigation: React.FC = ({ // Get the appropriate color classes or default to blue const colors = colorClasses[accentColor as keyof typeof colorClasses] || colorClasses.blue; - const navClasses = lastScrollY > 100 - ? 'bg-white shadow-md border-b border-gray-200' + const navClasses = lastScrollY > 100 + ? 'bg-white shadow-md border-b border-gray-200' : 'bg-white border-b border-gray-200'; return ( -