'use client'; import { ChevronLeft } from 'lucide-react'; import { useRouter, usePathname } from 'next/navigation'; import { cn } from '@/lib/utils'; import { useMobileChrome } from './mobile-layout-provider'; /** * Fixed compact topbar (52px + safe-area top inset). Renders the page title * (auto-truncating), an optional back button, and an optional primary action * — all driven by `useMobileChrome()` from the active page. */ export function MobileTopbar() { const { title, primaryAction, showBackButton } = useMobileChrome(); const router = useRouter(); const pathname = usePathname(); // Fall back to the last path segment (Title Case) if no page-supplied title. const fallbackTitle = pathname .split('/') .filter(Boolean) .pop() ?.replace(/-/g, ' ') .replace(/\b\w/g, (c) => c.toUpperCase()) ?? 'Port Nimara'; return (
{showBackButton ? ( ) : (
)}

{title ?? fallbackTitle}

{primaryAction}
); }