'use client' import Link from 'next/link' import { usePathname } from 'next/navigation' import { motion } from 'framer-motion' import { useTabListKeyboard } from '@/lib/hooks/useTabListKeyboard' import { useAuth } from '@/lib/auth/context' interface SiteNavProps { siteId: string } export default function SiteNav({ siteId }: SiteNavProps) { const pathname = usePathname() const handleTabKeyDown = useTabListKeyboard() const { user } = useAuth() const canEdit = user?.role === 'owner' || user?.role === 'admin' const tabs = [ { label: 'Dashboard', href: `/sites/${siteId}` }, { label: 'Journeys', href: `/sites/${siteId}/journeys` }, { label: 'Funnels', href: `/sites/${siteId}/funnels` }, { label: 'Behavior', href: `/sites/${siteId}/behavior` }, { label: 'Search', href: `/sites/${siteId}/search` }, { label: 'CDN', href: `/sites/${siteId}/cdn` }, { label: 'Uptime', href: `/sites/${siteId}/uptime` }, ...(canEdit ? [{ label: 'Settings', href: `/sites/${siteId}/settings` }] : []), ] const isActive = (href: string) => { if (href === `/sites/${siteId}`) { return pathname === href } return pathname.startsWith(href) } return (