mirror of
https://github.com/idrainformatica/PecFlow.git
synced 2026-06-16 12:45:42 +02:00
Multitenancy
This commit is contained in:
@@ -48,6 +48,7 @@ import {
|
||||
Bell,
|
||||
Star,
|
||||
Archive,
|
||||
Building2,
|
||||
} from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useAuth } from '@/hooks/useAuth'
|
||||
@@ -71,7 +72,7 @@ export function Sidebar() {
|
||||
/** Set degli ID virtual box che l'utente ha esplicitamente chiuso. */
|
||||
const [collapsedVboxes, setCollapsedVboxes] = useState<Set<string>>(new Set())
|
||||
|
||||
const { user, isAdmin, logout } = useAuth()
|
||||
const { user, isAdmin, isSuperAdmin, logout } = useAuth()
|
||||
const unreadCount = useInboxStore((s) => s.unreadCount)
|
||||
|
||||
// Le caselle PEC vengono caricate qui e condivise via React Query cache
|
||||
@@ -387,6 +388,40 @@ export function Sidebar() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ── Sezione Super Admin – visibile solo ai super_admin ── */}
|
||||
{isSuperAdmin && (
|
||||
<div>
|
||||
{!collapsed && (
|
||||
<>
|
||||
<div className="border-t border-purple-900/50 mx-4 mb-3" />
|
||||
<p className="px-4 mb-1.5 text-xs font-semibold text-purple-400 uppercase tracking-wider">
|
||||
Super Admin
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
{collapsed && <div className="border-t border-purple-900/50 mx-3 mb-2" />}
|
||||
|
||||
<div className="space-y-0.5 px-2">
|
||||
<NavLink
|
||||
to="/multitenant"
|
||||
className={({ isActive }) =>
|
||||
cn(
|
||||
'flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors',
|
||||
isActive
|
||||
? 'bg-purple-700 text-white'
|
||||
: 'text-purple-300 hover:bg-purple-900/40 hover:text-white',
|
||||
collapsed && 'justify-center px-2',
|
||||
)
|
||||
}
|
||||
title={collapsed ? 'Multi-Tenant' : undefined}
|
||||
>
|
||||
<Building2 className="h-5 w-5 flex-shrink-0" />
|
||||
{!collapsed && <span>Multi-Tenant</span>}
|
||||
</NavLink>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</nav>
|
||||
|
||||
{/* ── Profilo utente + logout ── */}
|
||||
|
||||
Reference in New Issue
Block a user