'use client'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { useEffect, useState } from 'react'; import { ClipboardList, Droplets, Receipt, Users, type LucideIcon } from 'lucide-react'; import { CLOCK_TABS } from '@/lib/clock-access'; import type { UserAccess } from '@/lib/auth-policy'; const ICONS: Record = { '/clock': Users, '/clock/stock': Droplets, '/clock/job-cards': ClipboardList, '/clock/slips': Receipt }; /** Mobile-app style tab bar. Each access level sees only its own tabs. Hidden on sign-in / password screens. */ export function ClockBottomNav({ access = 'full' }: { access?: UserAccess }) { const path = usePathname(); // Highlight the tapped tab at once: the next page takes a moment to load and an // unchanged bar reads as "the tap did not register". const [tapped, setTapped] = useState(null); useEffect(() => setTapped(null), [path]); if (path.startsWith('/clock/login') || path.startsWith('/clock/change-password')) return null; const tabs = CLOCK_TABS[access]; return ; }