From a1a34cb2519ea9c411a797e8f5d86c4275a8273a Mon Sep 17 00:00:00 2001 From: m7amedez5511 Date: Sun, 26 Jul 2026 20:08:12 +0300 Subject: [PATCH] Replace SVGs with icons, restructure the table for CRUD operations across the project, standardize the application's display, and build a new template for the table's action buttons. --- README.md | 77 +-- app/components/layout/ConditionalNavbar.tsx | 7 +- app/components/layout/Sidebar.tsx | 12 +- app/components/layout/Topbar.tsx | 3 - app/dashboard/audit/page.tsx | 279 ++------- .../maintenance/[maintenanceId]/page.tsx | 37 +- .../cars/[carId]/maintenance/page.tsx | 4 +- app/dashboard/cars/page.tsx | 199 ++++-- .../clients/[clientId]/addresses/page.tsx | 14 +- app/dashboard/drivers/[driverId]/page.tsx | 9 +- app/dashboard/drivers/page.tsx | 455 ++++---------- app/dashboard/orders/page.tsx | 117 +++- app/dashboard/trips/[tripId]/page.tsx | 18 +- .../trips/archived/[tripId]/page.tsx | 11 +- app/forbidden/page.tsx | 6 +- app/not_found/page.tsx | 5 +- src/Components/Branch/BranchDetailModal.tsx | 5 +- src/Components/Branch/BranchTable.tsx | 204 +++---- .../archive/ArchivedBranchDetailModal.tsx | 5 +- .../Branch/archive/ArchivedBranchTable.tsx | 167 ++---- .../Branch/archive/ArchivedBranchesModal.tsx | 4 +- .../CarMaintananceDetailPanel.tsx | 8 +- .../archive/ArchivedCarMaintananceTable.tsx | 165 +++-- .../archive/ArchivedCarsMaintananceModal.tsx | 4 +- src/Components/Client/Clienttable.tsx | 564 ++++++------------ .../Client/archive/ArchivedClientTable.tsx | 164 ++--- .../Client/archive/ArchivedClientsModal.tsx | 4 +- src/Components/Client/index.ts | 2 +- .../archive/ArchivedClientAddressesTable.tsx | 159 ++--- .../archive/ArchivedClientsAddressesModal.tsx | 4 +- src/Components/Driver/DriverDetailPanel.tsx | 18 +- src/Components/Driver/DriverPhotos.tsx | 15 +- src/Components/Driver/DriverTable.tsx | 146 +++++ .../Driver/archive/ArchivedDriverTable.tsx | 200 +++---- .../Driver/archive/ArchivedDrivers.tsx | 13 +- src/Components/Order/OrderDetailModel.tsx | 10 +- src/Components/Order/OrderFormModal.tsx | 10 +- src/Components/Order/OrderTable.tsx | 299 +++------- .../Order/archive/ArchivedOrderTable.tsx | 172 ++---- .../Order/archive/ArchivedOrdersModal.tsx | 13 +- src/Components/Trip/TripDetailModal.tsx | 3 - src/Components/Trip/TripTable.tsx | 215 +++---- src/Components/Trip/Tripformmodal.tsx | 12 - .../Trip/archive/ArchivedTripModal.tsx | 18 +- .../Trip/archive/ArchivedTripTable.tsx | 178 ++---- src/Components/UI/ActionButtons.tsx | 45 ++ src/Components/UI/ArchiveButton.tsx | 6 +- src/Components/UI/Header.tsx | 12 +- src/Components/UI/ModelCard.tsx | 57 ++ src/Components/UI/ReusableTable.tsx | 273 +++++++++ src/Components/UI/Spinner.tsx | 32 +- src/Components/UI/index.ts | 5 +- src/Components/User/UserTable.tsx | 233 +++----- .../User/archive/Archivedusersmodal.tsx | 13 +- .../User/archive/Archivedusertable.tsx | 173 ++---- src/Components/audit/AuditDetailsModel.tsx | 136 +++++ src/Components/audit/AuditTable.tsx | 129 ++++ src/Components/car/CarDetailPanel.tsx | 15 +- src/Components/car/CarImageGallery.tsx | 9 +- .../car/archive/Archivedcarsmodal.tsx | 4 +- .../car/archive/Archivedcartable.tsx | 198 +++--- src/Components/role/RoleTable.tsx | 213 +++---- .../role/archive/ArchivedRoleDetailModal.tsx | 5 +- .../role/archive/ArchivedRoleTable.tsx | 152 ++--- .../role/archive/ArchivedRolesModal.tsx | 13 +- src/hooks/useDriver.ts | 15 +- src/hooks/useOrder.ts | 14 +- src/hooks/useUser.ts | 18 +- src/types/audit.ts | 14 + src/types/models.ts | 108 ++++ 70 files changed, 2683 insertions(+), 3243 deletions(-) create mode 100644 src/Components/Driver/DriverTable.tsx create mode 100644 src/Components/UI/ActionButtons.tsx create mode 100644 src/Components/UI/ModelCard.tsx create mode 100644 src/Components/UI/ReusableTable.tsx create mode 100644 src/Components/audit/AuditDetailsModel.tsx create mode 100644 src/Components/audit/AuditTable.tsx create mode 100644 src/types/audit.ts create mode 100644 src/types/models.ts diff --git a/README.md b/README.md index b3dc044..ea7c7a6 100644 --- a/README.md +++ b/README.md @@ -1,72 +1,15 @@ -# Slash.sa — منصة إدارة الأسطول واللوجستيات +You are a senior frontend architect specializing in admin dashboards for logistics systems. Your objective is to create a comprehensive redesign plan for the home (dashboard) page of a logistics management system built with Next.js, Tailwind CSS, and TypeScript. This system tracks shipments and orders alongside nine core entities: Users, Drivers, Cars, Trips, Orders, Customers, Branches, Roles, and Audit/Withdrawal. -منصة ويب متكاملة لإدارة عمليات الأسطول واللوجستيات، مبنية بلغة عربية أولًا (Arabic-first) -باتجاه RTL كامل، وموجهة للسوق السعودي. تشمل المنصة إدارة المركبات والسائقين والفروع -والطلبات والرحلات وسجل الصيانة، مع لوحات تحكم منفصلة حسب دور المستخدم (مشرف / عميل / مستخدم ميداني). +The dashboard should display total counts, active counts, and pending counts for each of these entities in separate KPI cards, with visual alerts for anomalies. Additionally, the design must utilize the `@tabler/icons-webfont` icon library. It is imperative to follow the existing template block, ensuring consistency in the color palette, typography scale, spacing system, and layout patterns. The code structure must align with the existing architecture, preserving the component file structure, hooks, types folder, and page layout patterns. -## المتطلبات الأساسية +Divide the page into specific, visually distinct sections that include: KPI cards for totals, active and pending counts; recent activity logs; alert messages for urgent issues; and charts demonstrating trends over time. Each section should be explicitly labeled. Ensure that each component in the output is accompanied by a description of its required data state, including types and default values, to facilitate direct implementation. -- Node.js 20.9 أو أحدث -- npm (أو أي package manager متوافق) +The output must strictly utilize only Tailwind CSS and the `@tabler/icons-webfont` library — no additional UI frameworks or libraries such as Shadcn, Material UI, or Headless UI should be included. -## التقنيات المستخدمة +The final plan should produce a structured document containing: +- A component tree presented as an indented list detailing the hierarchy and relationships. +- A wireframe description outlining the layout section by section in clear text. +- A data/state requirement table for each component that lists the necessary data attributes. +- A responsive design strategy that specifies how each section adapts to mobile, tablet, and desktop views, ensuring all elements remain accessible and legible. -| الطبقة | التقنية | -| -------------------- | ------------------------------------------ | -| الإطار | Next.js 16 (App Router) | -| اللغة | TypeScript | -| التنسيق | Tailwind CSS v4 | -| النماذج والتحقق | react-hook-form + yup | -| الأيقونات | lucide-react (صفحات التسويق) / Tabler Icons Webfont (لوحة التحكم) | -| المصادقة | JWT + HttpOnly cookie + middleware للحماية | - -## هيكل المشروع (مختصر) -app/ -├── (صفحات تسويقية) home, features/app, how_work, prices, frequently_asked_questions -├── dashboard/ لوحة التحكم (محمية بواسطة middleware) -│ ├── cars, drivers, orders, trips, clients, branches, roles, audit, users -├── login, register صفحات المصادقة -├── api/proxy/[...path] بروكسي موحّد لكل طلبات الـ backend -└── components/layout Navbar, Sidebar, Topbar (تُستخدم عبر الصفحات يدويًا) -src/ -├── Components/ مكوّنات لوحة التحكم (مقسّمة حسب الوحدة: Car, Driver, Order...) -├── hooks/ منطق جلب البيانات والطفرات (Create/Update/Delete) لكل وحدة -├── services/ طبقة استدعاء الـ API (كل وحدة لها service منفصل) -├── types/ تعريفات TypeScript لكل نموذج بيانات -├── validations/ مخططات yup للتحقق من صحة النماذج -└── lib/ دوال مساعدة (auth, session, formatters, order-status) -## التشغيل محليًا - -```bash -npm install -npm run dev -``` - -افتح [http://localhost:3000](http://localhost:3000) في المتصفح. - -## الأوامر المتاحة - -| الأمر | الوصف | -| ---------------- | --------------------------------------- | -| `npm run dev` | تشغيل بيئة التطوير (Webpack) | -| `npm run build` | بناء نسخة الإنتاج | -| `npm run start` | تشغيل نسخة الإنتاج المبنية | -| `npm run lint` | فحص الكود بواسطة ESLint | - -## ملاحظات النشر (Deployment) - -- المنصة مبنية على Next.js App Router وتعمل على أي بيئة تدعم Node.js 20.9+ (مثل Vercel). -- كل طلبات الـ backend تمر عبر `app/api/proxy/[...path]/route.ts`، فتأكد من ضبط الـ backend base URL بشكل صحيح قبل النشر. -- التوثيق (Authentication) يعتمد على HttpOnly cookie تُضبط عبر `app/api/auth/set-cookie`، وتُمسح عبر `app/api/clear-cookie` — تأكد من تفعيل `Secure` في بيئة الإنتاج (يتم تلقائيًا حسب `NODE_ENV`). -- الحماية على مستوى الراوت تتم عبر `middleware.ts` — راجع الـ `matcher` فيه عند إضافة مسارات محمية جديدة. - -## المساهمة (Contributing) - -1. أنشئ فرعًا جديدًا من `main` باسم واضح للتغيير (مثال: `feature/car-maintenance-filters`). -2. اتبع نفس أسلوب الكود الموجود: RTL-first، CSS custom property tokens بدل الألوان الثابتة، وهيكلة hooks/services/types/validations لكل وحدة جديدة. -3. شغّل `npm run lint` قبل فتح Pull Request. -4. اكتب وصفًا واضحًا للتغيير وربطه بأي تذكرة (issue) ذات صلة. - -## الترخيص - -جميع الحقوق محفوظة © 2026 Slash.sa \ No newline at end of file +Success criteria for the resulting design must be clearly defined: the dashboard must cover all nine entities, use the specified icon set exclusively, respect the existing design tokens, and create a coherent layout that minimizes navigation clicks while maximizing data visibility. The entire output must be written in clear, technical English. \ No newline at end of file diff --git a/app/components/layout/ConditionalNavbar.tsx b/app/components/layout/ConditionalNavbar.tsx index ab7de6e..a03aba9 100644 --- a/app/components/layout/ConditionalNavbar.tsx +++ b/app/components/layout/ConditionalNavbar.tsx @@ -8,16 +8,11 @@ import Navbar from "./Navbar"; export default function ConditionalNavbar() { const pathname = usePathname(); - // استبدلنا getStoredUser() المباشر بالـ hook عشان يبقى SSR-safe const { user, loading } = useStoredUser(); - // لحد ما نتأكد من حالة تسجيل الدخول من الـ storage، منوريش/مخفيش - // الناف بار عشان نتجنب وميض (flash) قبل الـ hydration يخلص. مفيش - // حاجة تتعرض هنا أصلاً (مفيش avatar/اسم في الناف بار العام)، فـ null - // كافية ومفيش داعي لـ Spinner/InlineLoader في المكان ده. + if (loading) return null; - // لو المستخدم مسجل دخول، أو الصفحة الحالية جوه الداشبورد، منظهرش الناف بار العام const isDashboardRoute = pathname?.startsWith("/dashboard"); if (user || isDashboardRoute) return null; diff --git a/app/components/layout/Sidebar.tsx b/app/components/layout/Sidebar.tsx index cf93166..e743219 100644 --- a/app/components/layout/Sidebar.tsx +++ b/app/components/layout/Sidebar.tsx @@ -288,17 +288,7 @@ export function Sidebar() { color: "#fff", }} > - - - +