[CLAUDE] FE-Admin+FE-User: Plan CA Chunk C — Sidebar filter 2 app (admin HIDE + user SHOW)

fe-admin/src/components/Layout.tsx:
- Add ADMIN_HIDDEN_MASTER_KEYS Set với 9 menu key danh mục
- Extend isAdminHidden predicate: hide Ct_* + ADMIN_HIDDEN_MASTER_KEYS
- Master/Suppliers/Projects/Departments/Catalogs/4 sub-catalogs giờ ẩn khỏi admin sidebar

fe-user/src/components/Layout.tsx:
- Remove `Master, Suppliers, Projects, Departments` khỏi USER_HIDDEN_KEYS
- Catalogs (root + 4 leaf) auto-visible qua tree-inherit từ Master
- Giữ ẩn `System, Users, Roles, Permissions, Forms, Reports` (admin tools)

Verify:
- npm run build × 2 app PASS 0 TS err
- fe-admin bundle `index-BQidGwKU.js` 1,404 KB gz 357 KB (rotate)
- fe-user bundle `index-Co8LTtad.js` 1,317 KB gz 342 KB (rotate)
- Pattern 5 (mirror 2 app §3.9) applied — cùng 1 plan touch 2 file Layout

Plan CA chain:
- Chunk A 80d39a0 BE Role + Seed (em main solo)
- Chunk B 06a441c FE move 4 pages (Implementer Case 2)
- Chunk C (this) sidebar filter (em main solo)
- Pending Chunk D: smoke verify + tạo demo user catalog.manager@solutions.com.vn

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-05-22 11:00:29 +07:00
parent 80d39a06fb
commit c995f42e0d
2 changed files with 14 additions and 2 deletions

View File

@ -108,8 +108,16 @@ function resolvePath(key: string): string | null {
// Admin side: hide the per-ContractType contract submenu (Ct_*) — that's a
// user-app concern. Keep Wf_* workflow-admin leaves.
// [Plan CA S29 2026-05-22] cũng hide "Cấu hình danh mục dùng chung" (Master +
// Catalogs) — đã move sang fe-user/eoffice. Admin vẫn phân quyền role × menu ×
// CRUD qua /system/permissions (Permission Matrix tự reflect 9 menu key này).
const ADMIN_HIDDEN_MASTER_KEYS = new Set([
'Master', 'Suppliers', 'Projects', 'Departments',
'Catalogs', 'CatalogUnits', 'CatalogMaterials', 'CatalogServices', 'CatalogWorkItems',
])
function isAdminHidden(key: string): boolean {
return key.startsWith('Ct_')
return key.startsWith('Ct_') || ADMIN_HIDDEN_MASTER_KEYS.has(key)
}
function filterForAdmin(nodes: MenuNode[]): MenuNode[] {