diff --git a/frontend/src/hooks/useWorkspace.ts b/frontend/src/hooks/useWorkspace.ts index a45d657..b555d7e 100644 --- a/frontend/src/hooks/useWorkspace.ts +++ b/frontend/src/hooks/useWorkspace.ts @@ -1,5 +1,6 @@ import { useState, useEffect, useCallback } from 'react'; import { useMyWorkspaces, useWorkspaceContext, type WorkspaceContext } from '@/api/hooks/workspaces'; +import { useAuthStore } from '@/store/authStore'; const STORAGE_KEY = 'leocrm-active-workspace'; @@ -47,7 +48,10 @@ export function useWorkspace() { // Check if a module is visible in the current workspace const isModuleVisible = useCallback((moduleKey: string): boolean => { - // If no workspace context, show all (backward compatible) + // System admins see all modules regardless of workspace + const user = useAuthStore.getState().user; + if (user?.is_system_admin) return true; + // If no workspace context, show all (backward compatible) if (!context?.workspace_id || !context?.modules?.length) return true; return visibleModuleKeys.has(moduleKey); }, [context, visibleModuleKeys]);