diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx
index fc89efe..e27ea16 100644
--- a/src/components/layout/Sidebar.tsx
+++ b/src/components/layout/Sidebar.tsx
@@ -19,7 +19,7 @@ import { useTenantTheme } from "@/hooks/useTenantTheme";
import { AuthenticatedImage } from "@/components/shared";
interface MenuItem {
- icon: React.ComponentType<{ className?: string }>;
+ icon: React.ComponentType<{ className?: string; strokeWidth?: number }>;
label: string;
path: string;
requiredPermission?: {
diff --git a/src/features/dashboard/components/QuickActions.tsx b/src/features/dashboard/components/QuickActions.tsx
index 10ed81a..aa23730 100644
--- a/src/features/dashboard/components/QuickActions.tsx
+++ b/src/features/dashboard/components/QuickActions.tsx
@@ -1,42 +1,69 @@
import { useNavigate } from 'react-router-dom';
-import { Plus, UserPlus, Shield, Settings } from 'lucide-react';
-import { Card, CardHeader, CardContent } from '@/components/ui/card';
+import { Plus, UserPlus, Shield, Settings, Building2, BadgeCheck } from 'lucide-react';
+import { useAppSelector } from '@/hooks/redux-hooks';
import type { QuickAction } from '@/types/dashboard';
export const QuickActions = () => {
const navigate = useNavigate();
+ const { roles } = useAppSelector((state) => state.auth);
- const quickActions: QuickAction[] = [
- { icon: Plus, label: 'New Tenant', onClick: () => navigate('/tenants') },
- { icon: UserPlus, label: 'Invite User', onClick: () => navigate('/tenants') },
- { icon: Shield, label: 'Add Role', onClick: () => navigate('/tenants') },
- { icon: Settings, label: 'Config', onClick: () => console.log('Config') },
+ // Simple roles array parsing
+ let rolesArray: string[] = [];
+ if (Array.isArray(roles)) {
+ rolesArray = roles;
+ } else if (typeof roles === "string") {
+ try {
+ rolesArray = JSON.parse(roles);
+ } catch {
+ rolesArray = [];
+ }
+ }
+
+ const isSuperAdmin = rolesArray.includes('super_admin');
+
+ // Define actions based on role
+ const superAdminActions: QuickAction[] = [
+ { icon: Plus, label: 'New Tenant', onClick: () => navigate('/tenants/create-wizard') },
+ { icon: UserPlus, label: 'New User', onClick: () => console.log('New User') },
+ { icon: Shield, label: 'New Role', onClick: () => console.log('New Role') },
+ { icon: Settings, label: 'New Config', onClick: () => console.log('Config') },
];
+ const tenantAdminActions: QuickAction[] = [
+ { icon: UserPlus, label: 'New User', onClick: () => navigate('/tenant/users') },
+ { icon: Shield, label: 'New Role', onClick: () => navigate('/tenant/roles') },
+ { icon: Building2, label: 'New Dept', onClick: () => navigate('/tenant/departments') },
+ { icon: BadgeCheck, label: 'New Desig', onClick: () => navigate('/tenant/designations') },
+ ];
+
+ const actions = isSuperAdmin ? superAdminActions : tenantAdminActions;
+
return (
- Quick Actions
-
{error}
-No recent activity found
-| - Action - | -- Resource Type - | -- Resource ID - | -- IP Address - | -- Timestamp - | +
|---|
| User Profile | +Timestamp | +Resource Type | +Action | +|
|---|---|---|---|---|
|
+
+
+
+
+
+
+ {log.user ? `${log.user.first_name || ''} ${log.user.last_name || ''}`.trim() || log.user.email.split('@')[0] : 'System User'}
+
+ {log.user && {log.user.email}}
+
+ |
+ + {formatRelativeTime(log.created_at)} + | ++ {log.resource_type} + | +
+ |
|
|
- |
- - {log.resource_type} - | -- {log.resource_id || 'N/A'} - | -- {log.ip_address || 'N/A'} - | -- {formatRelativeTime(log.created_at)} - | -