2026-03-27 11:34:09 +01:00
|
|
|
import React from 'react';
|
2026-04-09 09:24:17 +02:00
|
|
|
import { FileText, Table, Box, DollarSign, Package, Clock, History } from 'lucide-react';
|
2026-03-27 11:34:09 +01:00
|
|
|
import { cn } from '../lib/utils';
|
|
|
|
|
|
|
|
|
|
interface SidebarProps {
|
|
|
|
|
activeModule: string;
|
2026-04-09 09:24:17 +02:00
|
|
|
setActiveModule: (m: 'descriptions' | 'article_details' | 'matrix' | 'dimensions' | 'pricing' | 'pending_validation' | 'history') => void;
|
2026-04-11 15:00:58 +02:00
|
|
|
userEmail: string;
|
2026-03-27 11:34:09 +01:00
|
|
|
}
|
|
|
|
|
|
2026-04-11 15:00:58 +02:00
|
|
|
export function Sidebar({ activeModule, setActiveModule, userEmail }: SidebarProps) {
|
|
|
|
|
const isMasterUser = userEmail?.toLowerCase() === 'christian.vidal@craze-group.com';
|
|
|
|
|
|
2026-03-27 11:34:09 +01:00
|
|
|
const navItems = [
|
|
|
|
|
{ id: 'matrix', label: 'Matrix', icon: Table },
|
2026-03-29 17:13:30 +02:00
|
|
|
{ id: 'descriptions', label: 'Product Descriptions', icon: FileText },
|
2026-04-08 16:10:14 +02:00
|
|
|
{ id: 'article_details', label: 'Article Details', icon: Package },
|
2026-03-29 17:30:04 +02:00
|
|
|
{ id: 'dimensions', label: 'Dimensions', icon: Box },
|
2026-04-07 11:23:34 +02:00
|
|
|
{ id: 'pricing', label: 'Pricing & Units', icon: DollarSign },
|
2026-04-11 15:00:58 +02:00
|
|
|
...(isMasterUser ? [
|
|
|
|
|
{ id: 'pending_validation', label: 'Pending Validation', icon: Clock },
|
|
|
|
|
{ id: 'history', label: 'Change History', icon: History }
|
|
|
|
|
] : [])
|
2026-03-27 11:34:09 +01:00
|
|
|
] as const;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<aside className="w-60 bg-slate-800 border-r border-slate-700 flex flex-col shrink-0">
|
|
|
|
|
<div className="p-4 text-xs font-semibold text-slate-400 uppercase tracking-wider">
|
|
|
|
|
Modules
|
|
|
|
|
</div>
|
|
|
|
|
<nav className="flex-1 px-2 space-y-1">
|
|
|
|
|
{navItems.map((item) => {
|
|
|
|
|
const Icon = item.icon;
|
|
|
|
|
const isActive = activeModule === item.id;
|
|
|
|
|
return (
|
|
|
|
|
<button
|
|
|
|
|
key={item.id}
|
|
|
|
|
onClick={() => setActiveModule(item.id)}
|
|
|
|
|
className={cn(
|
|
|
|
|
"w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-sm font-medium transition-colors",
|
2026-03-29 17:13:30 +02:00
|
|
|
isActive
|
|
|
|
|
? "bg-blue-600/10 text-blue-400"
|
2026-03-27 11:34:09 +01:00
|
|
|
: "text-slate-300 hover:bg-slate-700/50 hover:text-white"
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<Icon className={cn("w-5 h-5", isActive ? "text-blue-500" : "text-slate-400")} />
|
|
|
|
|
{item.label}
|
|
|
|
|
</button>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</nav>
|
|
|
|
|
</aside>
|
|
|
|
|
);
|
|
|
|
|
}
|