toggleExpanded(item.id) : undefined}
- >
-
-
- {item.label}
-
- {hasChildren && (
-
+ if (hasChildren) {
+ return (
+
+
+ {isExpanded && item.children && (
+
+ {item.children.map(child => renderMenuItem(child, depth + 1))}
+
)}
-
- {hasChildren && isExpanded && (
-
- {item.children?.map(child => (
-
- {child.permission ? (
-
-
- `block px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors ${isActive ? 'bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-300' : ''
- }`
- }
- onClick={onClose}
- >
- {child.label}
-
-
- ) : (
-
- `block px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors ${isActive ? 'bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-300' : ''
- }`
- }
- onClick={onClose}
- >
- {child.label}
-
- )}
-
- ))}
-
- )}
- >
- );
-
- if (!hasChildren) {
- return (
-
- `flex items-center px-4 py-3 rounded-lg transition-colors ${isActive
- ? 'text-primary-700 dark:text-primary-300 bg-primary-100 dark:bg-primary-900'
- : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'
- }`
- }
- onClick={onClose}
- >
-
- {item.label}
-
);
}
- return
{menuContent}
;
+ const menuContent = (
+
+ `w-full flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-colors ${isActive
+ ? 'bg-primary-50 dark:bg-primary-900 text-primary-600 dark:text-primary-400'
+ : 'text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'
+ }`
+ }
+ style={{ paddingLeft: `${paddingLeft + 16}px` }}
+ >
+
+ {item.title}
+
+ );
+
+ if (item.permission) {
+ return (
+
+ {menuContent}
+
+ );
+ }
+
+ return
{menuContent}
;
};
return (
- <>
- {isOpen && (
-
- )}
+
+ {/* Logo */}
+
+
+ پنل مدیریت
+
+
-
-
-
-
-
-
-
- پنل مدیریت
+ {/* Navigation */}
+
+
+ {/* User Info */}
+
+
+
+
+ {user?.first_name?.[0]}{user?.last_name?.[0]}
+
+
+ {user?.first_name} {user?.last_name}
+
+
+ {user?.username}
+
+
-
-
-
-
-
- {user?.first_name?.charAt(0) || 'A'}
-
-
-
-
- {user?.first_name} {user?.last_name}
-
-
- {user?.username}
-
-
-
-
-
-
- >
+
);
};
\ No newline at end of file
diff --git a/src/types/index.ts b/src/types/index.ts
index a1f1be1..ad3e418 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -1,5 +1,42 @@
+import { Permission } from "./auth";
+
export * from "./auth";
+// Permission Management Types
+export interface CreatePermissionRequest {
+ title: string;
+ description: string;
+}
+
+export interface UpdatePermissionRequest {
+ id: number;
+ title: string;
+ description: string;
+}
+
+export interface CreatePermissionResponse {
+ permission: Permission;
+}
+
+export interface UpdatePermissionResponse {
+ permission: Permission;
+}
+
+export interface GetPermissionByIDResponse {
+ permission: Permission;
+}
+
+export interface GetAllPermissionsResponse {
+ permissions: Permission[];
+}
+
+export interface DeletePermissionResponse {
+ message: string;
+}
+
+// Re-export Permission from auth for convenience
+export type { Permission } from "./auth";
+
export interface User {
id: string;
name: string;