Files
sofa/components/mobile-tab-bar.tsx
T
jakeandClaude Opus 4.6 db3a6cc3d4 Add auto-close registration and admin settings page
First user to register automatically becomes admin and registration
closes. Admins can re-open registration from a new settings page.
Uses Better Auth admin plugin for role management and a new appSettings
table for the registration flag. Mobile tab bar now links to settings
instead of inline logout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 13:51:20 -05:00

65 lines
2.1 KiB
TypeScript

"use client";
import { IconHome, IconSearch, IconSettings } from "@tabler/icons-react";
import { motion } from "motion/react";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useSession } from "@/lib/auth/client";
const tabs = [
{ href: "/dashboard", label: "Home", icon: IconHome },
{ href: "/search", label: "Search", icon: IconSearch },
{ href: "/settings", label: "Settings", icon: IconSettings },
] as const;
export function MobileTabBar() {
const { data: session } = useSession();
const pathname = usePathname();
if (!session?.user) return null;
return (
<nav className="fixed bottom-0 left-0 right-0 z-50 border-t border-border/50 bg-background/90 backdrop-blur-xl sm:hidden">
<div className="flex h-14 items-stretch">
{tabs.map((tab) => {
const Icon = tab.icon;
const isActive =
tab.href === "/dashboard"
? pathname === "/dashboard"
: pathname.startsWith(tab.href);
return (
<Link
key={tab.href}
href={tab.href}
className="relative flex flex-1 flex-col items-center justify-center gap-0.5"
>
<Icon
size={20}
className={isActive ? "text-primary" : "text-muted-foreground"}
/>
<span
className={`text-[10px] font-medium ${isActive ? "text-primary" : "text-muted-foreground"}`}
>
{tab.label}
</span>
{isActive && (
<motion.div
layoutId="mobile-tab-indicator"
className="absolute top-0 h-0.5 w-8 rounded-full bg-primary"
transition={{
type: "spring",
stiffness: 380,
damping: 30,
}}
/>
)}
</Link>
);
})}
</div>
{/* Safe area for devices with home indicator */}
<div className="h-[env(safe-area-inset-bottom)]" />
</nav>
);
}