From cdf0eb29f30705b4ebceccc6a96eb47dd57cbb29 Mon Sep 17 00:00:00 2001 From: hosseintaromi Date: Fri, 18 Jul 2025 14:03:01 +0330 Subject: [PATCH] feat(roles): add role detail page - Complete role information display - Statistics and metadata sections - List of assigned permissions - Quick access to edit and permissions management - Responsive layout with proper Persian typography --- .../roles/role-detail/RoleDetailPage.tsx | 175 ++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 src/pages/roles/role-detail/RoleDetailPage.tsx diff --git a/src/pages/roles/role-detail/RoleDetailPage.tsx b/src/pages/roles/role-detail/RoleDetailPage.tsx new file mode 100644 index 0000000..8a6f74f --- /dev/null +++ b/src/pages/roles/role-detail/RoleDetailPage.tsx @@ -0,0 +1,175 @@ +import { useNavigate, useParams } from "react-router-dom"; +import { useRole } from "../core/_hooks"; +import { Button } from "@/components/ui/Button"; +import { LoadingSpinner } from "@/components/ui/LoadingSpinner"; +import { ArrowRight, Edit, Users, Calendar, FileText } from "lucide-react"; + +const RoleDetailPage = () => { + const navigate = useNavigate(); + const { id = "" } = useParams(); + + const { data: role, isLoading, error } = useRole(id); + + if (isLoading) return ; + if (error) return
خطا در بارگذاری اطلاعات نقش
; + if (!role) return
نقش یافت نشد
; + + return ( +
+
+
+
+ +

+ جزئیات نقش +

+
+ +
+ + +
+
+
+ +
+ {/* اطلاعات اصلی */} +
+
+

+ اطلاعات نقش +

+ +
+
+ +
+

+ {role.title} +

+
+
+ +
+ +
+

+ {role.description} +

+
+
+
+
+
+ + {/* اطلاعات جانبی */} +
+ {/* آمار */} +
+

+ آمار +

+
+
+
+ + + تعداد دسترسی‌ها + +
+ + {role.permissions?.length || 0} + +
+
+
+ + {/* اطلاعات زمانی */} +
+

+ اطلاعات زمانی +

+
+
+
+ + + تاریخ ایجاد + +
+

+ {new Date(role.created_at).toLocaleDateString('fa-IR')} +

+
+ +
+
+ + + آخرین به‌روزرسانی + +
+

+ {new Date(role.updated_at).toLocaleDateString('fa-IR')} +

+
+
+
+
+
+ + {/* لیست دسترسی‌ها */} + {role.permissions && role.permissions.length > 0 && ( +
+
+

+ دسترسی‌های تخصیص یافته +

+
+ {role.permissions.map((permission) => ( +
+

+ {permission.title} +

+

+ {permission.description} +

+
+ ))} +
+
+
+ )} +
+ ); +}; + +export default RoleDetailPage; \ No newline at end of file