'use client'; import { Plus } from 'lucide-react'; import { useRouter } from 'next/navigation'; import { useUIStore } from '@/stores/ui-store'; import { Button } from '@/components/ui/button'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Separator } from '@/components/ui/separator'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { Breadcrumbs } from '@/components/layout/breadcrumbs'; import { CommandSearch } from '@/components/search/command-search'; import { Inbox } from '@/components/layout/inbox'; import { UserMenu } from '@/components/layout/user-menu'; import type { Port } from '@/lib/db/schema/ports'; interface TopbarProps { ports: Port[]; user?: { name: string; email: string }; } export function Topbar({ ports, user }: TopbarProps) { const router = useRouter(); const currentPortSlug = useUIStore((s) => s.currentPortSlug); const base = currentPortSlug ? `/${currentPortSlug}` : ''; return ( // Three-column grid: breadcrumbs left, search center, actions right. // The brand logo lives in the sidebar header (per design feedback) so the // topbar center is dedicated to the global search bar.
{/* LEFT: breadcrumbs / page title */}
{/* CENTER: global search - capped width and horizontally centered inside its grid slot so it sits visually in the middle of the topbar regardless of breadcrumb / action-row width. */}
{/* RIGHT: action row */}
{/* + New dropdown */} Create {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */} router.push(`${base}/clients/new` as any)}> New Client {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */} router.push(`${base}/interests/new` as any)}> New Interest {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */} router.push(`${base}/expenses/new` as any)}> New Expense {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */} router.push(`${base}/reminders/new` as any)}> New Reminder {/* Unified inbox - combines system alerts (operational) and personal notifications (user-targeted) into a single bell with two tabs. Replaces the previous AlertBell + NotificationBell pair. */} {/* User menu - single source of truth for the profile dropdown. Same component is mounted in the sidebar footer so the menu items (incl. port switcher) stay consistent across triggers. */} {(user?.name ?? 'U').slice(0, 1).toUpperCase()} } />
); }