mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 15:35:23 +02:00
feat: restrict History and Pending Validation tabs to master user
This commit is contained in:
+1
-1
@@ -485,7 +485,7 @@ export default function App() {
|
|||||||
isSavingAll={isSavingAll}
|
isSavingAll={isSavingAll}
|
||||||
/>
|
/>
|
||||||
<div className="flex flex-1 overflow-hidden">
|
<div className="flex flex-1 overflow-hidden">
|
||||||
<Sidebar activeModule={activeModule} setActiveModule={setActiveModule} />
|
<Sidebar activeModule={activeModule} setActiveModule={setActiveModule} userEmail={session.user.email} />
|
||||||
<main className="flex-1 overflow-auto relative p-6 bg-[#041021]">
|
<main className="flex-1 overflow-auto relative p-6 bg-[#041021]">
|
||||||
{isLoadingDefault ? (
|
{isLoadingDefault ? (
|
||||||
<div className="flex flex-col items-center justify-center h-full text-slate-400">
|
<div className="flex flex-col items-center justify-center h-full text-slate-400">
|
||||||
|
|||||||
@@ -5,17 +5,22 @@ import { cn } from '../lib/utils';
|
|||||||
interface SidebarProps {
|
interface SidebarProps {
|
||||||
activeModule: string;
|
activeModule: string;
|
||||||
setActiveModule: (m: 'descriptions' | 'article_details' | 'matrix' | 'dimensions' | 'pricing' | 'pending_validation' | 'history') => void;
|
setActiveModule: (m: 'descriptions' | 'article_details' | 'matrix' | 'dimensions' | 'pricing' | 'pending_validation' | 'history') => void;
|
||||||
|
userEmail: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Sidebar({ activeModule, setActiveModule }: SidebarProps) {
|
export function Sidebar({ activeModule, setActiveModule, userEmail }: SidebarProps) {
|
||||||
|
const isMasterUser = userEmail?.toLowerCase() === 'christian.vidal@craze-group.com';
|
||||||
|
|
||||||
const navItems = [
|
const navItems = [
|
||||||
{ id: 'matrix', label: 'Matrix', icon: Table },
|
{ id: 'matrix', label: 'Matrix', icon: Table },
|
||||||
{ id: 'descriptions', label: 'Product Descriptions', icon: FileText },
|
{ id: 'descriptions', label: 'Product Descriptions', icon: FileText },
|
||||||
{ id: 'article_details', label: 'Article Details', icon: Package },
|
{ id: 'article_details', label: 'Article Details', icon: Package },
|
||||||
{ id: 'dimensions', label: 'Dimensions', icon: Box },
|
{ id: 'dimensions', label: 'Dimensions', icon: Box },
|
||||||
{ id: 'pricing', label: 'Pricing & Units', icon: DollarSign },
|
{ id: 'pricing', label: 'Pricing & Units', icon: DollarSign },
|
||||||
{ id: 'pending_validation', label: 'Pending Validation', icon: Clock },
|
...(isMasterUser ? [
|
||||||
{ id: 'history', label: 'Change History', icon: History },
|
{ id: 'pending_validation', label: 'Pending Validation', icon: Clock },
|
||||||
|
{ id: 'history', label: 'Change History', icon: History }
|
||||||
|
] : [])
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user