commit
This commit is contained in:
107
plans/change-user-menu.md
Normal file
107
plans/change-user-menu.md
Normal file
@@ -0,0 +1,107 @@
|
||||
You are a Senior Full Stack Engineer.
|
||||
|
||||
Project:
|
||||
Training Management System (TMS)
|
||||
|
||||
Current task:
|
||||
Update User Dropdown Menu based on management feedback.
|
||||
|
||||
Important constraints:
|
||||
|
||||
- Do NOT change folder structure.
|
||||
- Do NOT migrate ORM.
|
||||
- Do NOT break existing Auth.js session.
|
||||
- Keep Thai UI.
|
||||
- Minimal-impact changes only.
|
||||
|
||||
Requirements:
|
||||
|
||||
1. In the user dropdown menu, display employee code under or near the user name/email.
|
||||
|
||||
Current display:
|
||||
|
||||
- Name
|
||||
- Email
|
||||
|
||||
New display:
|
||||
|
||||
- Name
|
||||
- Employee Code
|
||||
- Email
|
||||
|
||||
Thai label:
|
||||
|
||||
- รหัสพนักงาน: EMP001
|
||||
|
||||
If employeeCode is missing:
|
||||
|
||||
- รหัสพนักงาน: -
|
||||
|
||||
2. Remove the Profile menu item from the dropdown.
|
||||
|
||||
Current dropdown items:
|
||||
|
||||
- Dashboard
|
||||
- Profile
|
||||
- Log out
|
||||
|
||||
New dropdown items:
|
||||
|
||||
- Dashboard
|
||||
- Log out
|
||||
|
||||
3. Keep Dashboard menu item.
|
||||
|
||||
4. Keep Log out menu item.
|
||||
|
||||
5. Ensure employeeCode is available from:
|
||||
|
||||
- Auth.js session
|
||||
- user query
|
||||
- or existing user object
|
||||
|
||||
6. If employeeCode is not currently included in session:
|
||||
|
||||
- update session callback/type mapping safely
|
||||
- do not expose sensitive fields
|
||||
|
||||
Files likely involved:
|
||||
|
||||
- src/components/layout/user-nav.tsx
|
||||
- src/auth.ts
|
||||
- src/lib/auth/session.ts
|
||||
- src/types/next-auth.d.ts
|
||||
- src/db/schema.ts only if employeeCode already exists but not selected
|
||||
|
||||
Output Review File:
|
||||
|
||||
Create:
|
||||
docs/management-change-user-menu-review.md
|
||||
|
||||
Include:
|
||||
|
||||
1. Summary
|
||||
2. Files Changed
|
||||
3. Session Changes
|
||||
4. UI Changes
|
||||
5. Permission/Security Notes
|
||||
6. Manual Test Checklist
|
||||
7. Known Limitations
|
||||
|
||||
Manual Test Checklist:
|
||||
|
||||
- User dropdown shows name.
|
||||
- User dropdown shows employee code.
|
||||
- User dropdown shows email.
|
||||
- Missing employee code displays "-".
|
||||
- Profile menu is removed.
|
||||
- Dashboard menu still works.
|
||||
- Log out still works.
|
||||
- No password hash or sensitive data is exposed.
|
||||
- Works for Employee.
|
||||
- Works for HRD.
|
||||
|
||||
Return:
|
||||
|
||||
- Complete code changes with file paths.
|
||||
- Content of docs/management-change-user-menu-review.md.
|
||||
Reference in New Issue
Block a user