3.5 KiB
You are a Senior Frontend Engineer.
Project: Training Management System (TMS)
Current task: Refactor HRD/Admin sidebar navigation into grouped menu.
Requirement: Group the following HRD/Admin menus under a parent menu named "ข้อมูลหลัก":
ข้อมูลหลัก ├─ พนักงาน ├─ หลักสูตร ├─ นโยบาย ├─ ประกาศ
Important constraints:
- Do NOT delete routes.
- Do NOT delete APIs.
- Do NOT change database schema.
- Do NOT break existing role-based navigation.
- Do NOT affect Employee sidebar.
- Keep Thai UI.
- Keep responsive/mobile sidebar behavior.
- Minimal-impact changes only.
Navigation behavior:
- HRD/Admin sidebar should show parent menu:
- ข้อมูลหลัก
- Under "ข้อมูลหลัก", show submenu items:
-
พนักงาน Route: /dashboard/users or /dashboard/employees Use whichever route currently exists for employee/user management.
-
หลักสูตร Route: /dashboard/courses
-
นโยบาย Route: /dashboard/training-policy
-
ประกาศ Route: /dashboard/announcements
- Remove these items from the root level of HRD/Admin sidebar:
- พนักงาน
- หลักสูตร
- นโยบาย
- ประกาศ
- Keep other HRD/Admin root menus unchanged, such as:
- แดชบอร์ด
- รอตรวจสอบ
- ประวัติการอบรม
- นำเข้าพนักงาน
- รายงาน
- Audit Log
-
Employee sidebar must not be affected.
-
Sidebar UX:
- Parent menu "ข้อมูลหลัก" should be collapsible if the current sidebar supports nested items.
- If the current sidebar does not support collapsible groups, use existing nested item pattern if available.
- Submenu should highlight active route.
- If user is currently on one of child routes, parent menu should appear active/open.
- Mobile behavior:
- Nested menu must work in mobile drawer.
- Sidebar should close after selecting submenu on mobile if current behavior supports it.
- Long Thai labels must not overflow.
Files likely involved:
- src/config/nav-config.ts
- src/components/layout/app-sidebar.tsx
- src/components/layout/nav-main.tsx
- src/components/layout/sidebar-nav.tsx
- src/components/ui/sidebar.tsx
Output Review File:
Create: docs/management-change-sidebar-master-data-group-review.md
Include:
- Summary
- Files Changed
- Navigation Before
- Navigation After
- Role Impact
- Active Route Behavior
- Mobile Sidebar Behavior
- Manual Test Checklist
- Known Limitations
Manual Test Checklist:
- HRD/Admin sees "ข้อมูลหลัก" parent menu.
- "ข้อมูลหลัก" contains พนักงาน.
- "ข้อมูลหลัก" contains หลักสูตร.
- "ข้อมูลหลัก" contains นโยบาย.
- "ข้อมูลหลัก" contains ประกาศ.
- Root-level พนักงาน menu is removed.
- Root-level หลักสูตร menu is removed.
- Root-level นโยบาย menu is removed.
- Root-level ประกาศ menu is removed.
- Other HRD/Admin menus still work.
- Employee sidebar is unchanged.
- Active submenu is highlighted.
- Parent menu opens when child route is active.
- Mobile sidebar nested menu works.
- No route or API was deleted.
Return:
- Complete code changes with file paths.
- Content of docs/management-change-sidebar-master-data-group-review.md.