Spaces:
Running
Running
axeronis commited on
Commit ·
f4a9941
1
Parent(s): e645f21
feat: Full Secondary Nav Bar for tablet/laptop view
Browse files
frontend/app/layout.tsx
CHANGED
|
@@ -14,6 +14,7 @@ import { useEffect } from 'react'
|
|
| 14 |
import { useRouter } from 'next/navigation'
|
| 15 |
import { MobileHeader, MobileSidebarWrapper } from '@/components/MobileNav'
|
| 16 |
import { MobileBottomNav } from '@/components/MobileBottomNav'
|
|
|
|
| 17 |
|
| 18 |
const inter = Inter({ subsets: ['latin', 'cyrillic'] })
|
| 19 |
|
|
@@ -81,6 +82,9 @@ export default function RootLayout({
|
|
| 81 |
{/* Desktop Header */}
|
| 82 |
<Header />
|
| 83 |
|
|
|
|
|
|
|
|
|
|
| 84 |
{/* Mobile Header - FIXED at top - ONLY for Mobile (< md) */}
|
| 85 |
<div className="md:hidden fixed top-0 left-0 right-0 z-[60]">
|
| 86 |
<MobileHeader />
|
|
|
|
| 14 |
import { useRouter } from 'next/navigation'
|
| 15 |
import { MobileHeader, MobileSidebarWrapper } from '@/components/MobileNav'
|
| 16 |
import { MobileBottomNav } from '@/components/MobileBottomNav'
|
| 17 |
+
import { SecondaryNav } from '@/components/SecondaryNav'
|
| 18 |
|
| 19 |
const inter = Inter({ subsets: ['latin', 'cyrillic'] })
|
| 20 |
|
|
|
|
| 82 |
{/* Desktop Header */}
|
| 83 |
<Header />
|
| 84 |
|
| 85 |
+
{/* Secondary Nav - Tablet/Small Desktop Only (Full Sidebar Content) */}
|
| 86 |
+
<SecondaryNav />
|
| 87 |
+
|
| 88 |
{/* Mobile Header - FIXED at top - ONLY for Mobile (< md) */}
|
| 89 |
<div className="md:hidden fixed top-0 left-0 right-0 z-[60]">
|
| 90 |
<MobileHeader />
|
frontend/components/Header.tsx
CHANGED
|
@@ -9,13 +9,7 @@ import Link from 'next/link'
|
|
| 9 |
import { LanguageSwitcher } from './LanguageSwitcher'
|
| 10 |
import { useTranslation } from '@/lib/i18n'
|
| 11 |
|
| 12 |
-
|
| 13 |
-
const navItems = [
|
| 14 |
-
{ href: '/dashboard', labelKey: 'nav.analytics', label: 'Аналитика' },
|
| 15 |
-
{ href: '/chats', labelKey: 'nav.chats', label: 'Чаты' },
|
| 16 |
-
{ href: '/appointments', labelKey: 'nav.appointments', label: 'Записи' },
|
| 17 |
-
{ href: '/settings/brain', labelKey: 'nav.settings', label: 'Настройки' }, // Shortcut to settings
|
| 18 |
-
]
|
| 19 |
|
| 20 |
export function Header() {
|
| 21 |
const { user, logout } = useAuth()
|
|
@@ -76,21 +70,10 @@ export function Header() {
|
|
| 76 |
</Link>
|
| 77 |
</div>
|
| 78 |
|
| 79 |
-
{/* Center:
|
| 80 |
-
<nav className="hidden md:flex lg:hidden items-center gap-6 absolute left-1/2 -translate-x-1/2">
|
| 81 |
-
{navItems.map((item) => (
|
| 82 |
-
<Link
|
| 83 |
-
key={item.href}
|
| 84 |
-
href={item.href}
|
| 85 |
-
className="text-sm font-medium text-slate-400 hover:text-white transition-colors"
|
| 86 |
-
>
|
| 87 |
-
{t(item.labelKey) || item.label}
|
| 88 |
-
</Link>
|
| 89 |
-
))}
|
| 90 |
-
</nav>
|
| 91 |
|
| 92 |
{/* Spacer for LG screens where Nav is in Sidebar, to keep Profile on right */}
|
| 93 |
-
<div className="
|
| 94 |
|
| 95 |
<div className="flex items-center gap-4">
|
| 96 |
{/* Language Switcher moved here if needed, or kept in profile */}
|
|
|
|
| 9 |
import { LanguageSwitcher } from './LanguageSwitcher'
|
| 10 |
import { useTranslation } from '@/lib/i18n'
|
| 11 |
|
| 12 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
export function Header() {
|
| 15 |
const { user, logout } = useAuth()
|
|
|
|
| 70 |
</Link>
|
| 71 |
</div>
|
| 72 |
|
| 73 |
+
{/* Center: Spacer or Title - Nav is now in SecondaryNav below */}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
{/* Spacer for LG screens where Nav is in Sidebar, to keep Profile on right */}
|
| 76 |
+
<div className="flex-1" />
|
| 77 |
|
| 78 |
<div className="flex items-center gap-4">
|
| 79 |
{/* Language Switcher moved here if needed, or kept in profile */}
|
frontend/components/SecondaryNav.tsx
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use client'
|
| 2 |
+
|
| 3 |
+
import Link from 'next/link'
|
| 4 |
+
import { usePathname } from 'next/navigation'
|
| 5 |
+
import {
|
| 6 |
+
LayoutDashboard,
|
| 7 |
+
MessageSquare,
|
| 8 |
+
CreditCard,
|
| 9 |
+
Brain,
|
| 10 |
+
FileText,
|
| 11 |
+
Plug,
|
| 12 |
+
Zap,
|
| 13 |
+
Users,
|
| 14 |
+
Bell,
|
| 15 |
+
Calendar,
|
| 16 |
+
Volume2,
|
| 17 |
+
} from 'lucide-react'
|
| 18 |
+
import { cn } from '@/lib/utils'
|
| 19 |
+
import { useTranslation } from '@/lib/i18n'
|
| 20 |
+
import { useAuth } from '@/contexts/AuthContext'
|
| 21 |
+
import { useRef, useEffect } from 'react'
|
| 22 |
+
|
| 23 |
+
const navItems = [
|
| 24 |
+
{ href: '/dashboard', icon: LayoutDashboard, labelKey: 'nav.analytics', label: 'Аналитика', ownerOnly: true },
|
| 25 |
+
{ href: '/chats', icon: MessageSquare, labelKey: 'nav.chats', label: 'Чаты', ownerOnly: false },
|
| 26 |
+
{ href: '/appointments', icon: Calendar, labelKey: 'nav.appointments', label: 'Записи', ownerOnly: false },
|
| 27 |
+
{ href: '/channels', icon: Plug, labelKey: 'nav.channels', label: 'Каналы', ownerOnly: true },
|
| 28 |
+
{ href: '/settings/brain', icon: Brain, labelKey: 'nav.brain', label: 'AI Мозг', ownerOnly: true },
|
| 29 |
+
{ href: '/settings/voice', icon: Volume2, labelKey: 'nav.voice', label: 'Голос AI', ownerOnly: true },
|
| 30 |
+
{ href: '/settings/playbook', icon: FileText, labelKey: 'nav.funnel', label: 'Воронка', ownerOnly: true },
|
| 31 |
+
{ href: '/settings/team', icon: Users, labelKey: 'nav.team', label: 'Команда', ownerOnly: true },
|
| 32 |
+
{ href: '/settings/notifications', icon: Bell, labelKey: 'nav.notifications', label: 'Уведомления', ownerOnly: false },
|
| 33 |
+
{ href: '/settings/billing', icon: CreditCard, labelKey: 'nav.billing', label: 'Тарифы', ownerOnly: true },
|
| 34 |
+
{ href: '/partner', icon: Zap, labelKey: 'nav.partner', label: 'Партнёрам', ownerOnly: true },
|
| 35 |
+
]
|
| 36 |
+
|
| 37 |
+
export function SecondaryNav() {
|
| 38 |
+
const pathname = usePathname()
|
| 39 |
+
const { user } = useAuth()
|
| 40 |
+
const { t } = useTranslation()
|
| 41 |
+
const scrollContainerRef = useRef<HTMLDivElement>(null)
|
| 42 |
+
|
| 43 |
+
const isOwner = user?.role === 'OWNER' || user?.role === 'admin' || user?.is_superuser
|
| 44 |
+
const visibleItems = navItems.filter(item => isOwner || !item.ownerOnly)
|
| 45 |
+
|
| 46 |
+
const isActive = (path: string) => pathname === path || pathname.startsWith(path + '/')
|
| 47 |
+
|
| 48 |
+
// Scroll active item into view
|
| 49 |
+
useEffect(() => {
|
| 50 |
+
if (scrollContainerRef.current) {
|
| 51 |
+
const activeItem = scrollContainerRef.current.querySelector('[data-active="true"]')
|
| 52 |
+
if (activeItem) {
|
| 53 |
+
activeItem.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' })
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
}, [pathname])
|
| 57 |
+
|
| 58 |
+
return (
|
| 59 |
+
<div className="hidden md:flex lg:hidden w-full h-14 bg-[#050510] border-b border-white/5 sticky top-16 z-20">
|
| 60 |
+
<div
|
| 61 |
+
ref={scrollContainerRef}
|
| 62 |
+
className="flex items-center gap-1 px-4 overflow-x-auto no-scrollbar w-full"
|
| 63 |
+
>
|
| 64 |
+
{visibleItems.map((item) => {
|
| 65 |
+
const active = isActive(item.href)
|
| 66 |
+
const Icon = item.icon
|
| 67 |
+
|
| 68 |
+
return (
|
| 69 |
+
<Link
|
| 70 |
+
key={item.href}
|
| 71 |
+
href={item.href}
|
| 72 |
+
data-active={active}
|
| 73 |
+
className={cn(
|
| 74 |
+
"flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium whitespace-nowrap transition-all duration-200 shrink-0 select-none",
|
| 75 |
+
active
|
| 76 |
+
? "text-indigo-400 bg-indigo-500/10 border border-indigo-500/20 shadow-[0_0_10px_-5px_var(--tw-shadow-color)] shadow-indigo-500/30"
|
| 77 |
+
: "text-slate-400 hover:text-white hover:bg-white/5"
|
| 78 |
+
)}
|
| 79 |
+
>
|
| 80 |
+
<Icon className={cn("w-4 h-4", active ? "text-indigo-400" : "text-slate-500 group-hover:text-slate-300")} />
|
| 81 |
+
<span>{t(item.labelKey) || item.label}</span>
|
| 82 |
+
</Link>
|
| 83 |
+
)
|
| 84 |
+
})}
|
| 85 |
+
</div>
|
| 86 |
+
</div>
|
| 87 |
+
)
|
| 88 |
+
}
|