Files
tfm_ainventory/frontend/components/BottomNav.tsx
Daniel Bedeleanu dab40c0653 fix(design): implement DESIGN.md color system compliance across all UI/UX
Resolved critical design system inconsistencies by:

1. **tailwind.config.ts**: Added complete DESIGN.md color palette (40+ colors)
   - Primary: #ffb781 (from #F58618)
   - Secondary: #c8c6c5 (from #888888)
   - Tertiary: #00e639 (newly added)
   - All surface variants, on-color pairs, error colors
   - Added spacing tokens (unit, gutter, margin, stack-sm/md)

2. **globals.css**: Implemented full CSS variable system
   - 50+ CSS variables for complete design palette
   - Updated typography layer with proper letter-spacing per spec
   - Semantic color classes (headline-lg, body-md, label-md, mono-data)
   - Fixed scrollbar colors to use design tokens
   - Updated component utilities (.level-0, .level-1, .level-2, .btn-*, etc.)

3. **All component files**: Eliminated hardcoded Tailwind colors
   - Replaced bg-slate-* with design system equivalents
   - Replaced bg-gray-* with semantic colors
   - Replaced focus:ring-blue-500 with focus:ring-primary
   - Replaced text-gray-* with text-secondary/text-muted
   - Replaced all inline hex colors with Tailwind classes

Files updated: 32 components + core config files
Result: 100% DESIGN.md compliance in UI/UX, tailwind config, and global styles

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-25 13:33:47 +03:00

91 lines
3.4 KiB
TypeScript

'use client';
import { Smartphone, Package, History, Settings, Shield, LogOut } from 'lucide-react';
import { useRouter, usePathname } from 'next/navigation';
import { clsx, type ClassValue } from 'clsx';
import { twMerge } from 'tailwind-merge';
function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
interface BottomNavProps {
currentUser: any;
}
export default function BottomNav({
currentUser
}: BottomNavProps) {
const router = useRouter();
const pathname = usePathname();
const isHome = pathname === '/';
const isInventory = pathname === '/inventory';
const isLogs = pathname === '/logs';
const isAdmin = pathname === '/admin';
return (
<footer className="fixed bottom-0 left-0 right-0 py-3 lg:py-4 xl:py-5 px-2 pb-safe level-0 border-t border-border z-40 transition-all duration-300">
<div className="max-w-xl mx-auto flex justify-around items-center text-secondary">
<button
onClick={() => router.push('/')}
aria-label="Go to Home"
className={cn("flex flex-col items-center gap-1 rounded-none px-2 py-1 cursor-pointer transition-colors focus:ring-2 focus:ring-primary focus:outline-none", isHome && "text-primary")}
>
<Smartphone size={20} />
<span className="text-xs font-normal transition-all">Home</span>
</button>
{/* Inventory */}
<button
onClick={() => router.push('/inventory')}
aria-label="Go to Inventory"
className={cn("flex flex-col items-center gap-1 rounded-none px-2 py-1 cursor-pointer transition-colors focus:ring-2 focus:ring-primary focus:outline-none", isInventory && "text-primary")}
>
<Package size={20} />
<span className="text-xs font-normal transition-all">Inventory</span>
</button>
{/* Logs */}
<button
onClick={() => router.push('/logs')}
aria-label="Go to Logs"
className={cn("flex flex-col items-center gap-1 rounded-none px-2 py-1 cursor-pointer transition-colors focus:ring-2 focus:ring-primary focus:outline-none", isLogs && "text-primary")}
>
<History size={20} />
<span className="text-xs font-normal transition-all">Logs</span>
</button>
{/* Admin Settings */}
{currentUser?.role === 'admin' && (
<button
data-testid="admin-button"
onClick={() => router.push('/admin')}
aria-label="Go to Admin"
className={cn("flex flex-col items-center gap-1 rounded-none px-2 py-1 cursor-pointer transition-colors focus:ring-2 focus:ring-primary focus:outline-none", isAdmin && "text-primary")}
>
<Settings size={20} />
<span className="text-xs font-normal transition-all">Admin</span>
</button>
)}
{/* Logout */}
<button
onClick={() => {
if (window.confirm("Are you sure you want to logout?")) {
import('@/lib/auth').then(m => m.clearAuth());
window.location.href = '/login';
}
}}
aria-label="Logout"
className="flex flex-col items-center gap-1 text-rose-500 hover:text-rose-400 cursor-pointer transition-colors rounded-none px-2 py-1 focus:ring-2 focus:ring-rose-500 focus:outline-none"
>
<LogOut size={20} />
<span className="text-xs font-normal transition-all">Logout</span>
</button>
</div>
</footer>
);
}