- BOM 항목 추가/수정/삭제 시 섹션탭 즉시 반영 - 섹션 복제 시 UI 즉시 업데이트 (null vs undefined 이슈 해결) - 항목 수정 기능 추가 (useTemplateManagement) - 실시간 동기화 문서 추가 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
5.2 KiB
5.2 KiB
Dashboard Migration Summary
Migration Date
2025-11-10
Source
From: /Users/byeongcheolryu/codebridgex/sam_project/sam-react (Vite React)
To: /Users/byeongcheolryu/codebridgex/sam_project/sam-next/sma-next-project/sam-react-prod (Next.js)
Components Migrated
Dashboard Components (src/components/business/)
- Dashboard.tsx - Main dashboard router with lazy loading
- CEODashboard.tsx - CEO role dashboard
- ProductionManagerDashboard.tsx - Production Manager dashboard
- WorkerDashboard.tsx - Worker role dashboard
- SystemAdminDashboard.tsx - System Admin dashboard
- SalesLeadDashboard.tsx - Sales Lead dashboard
Layout Components
- DashboardLayout.tsx (src/layouts/) - Main layout with sidebar, header, and role switching
Supporting Components
- Sidebar.tsx (src/components/layout/) - Navigation sidebar component
Hooks
- useUserRole.ts - Hook for managing user roles
- useCurrentTime.ts - Hook for current time display
State Management (src/store/)
- menuStore.ts - Zustand store for menu state
- themeStore.ts - Zustand store for theme management
- demoStore.ts - Demo data store
UI Components
- calendar.tsx - Calendar component
- sheet.tsx - Sheet/drawer component
- chart-wrapper.tsx - Chart wrapper component
Dependencies Installed
{
"zustand": "^latest",
"recharts": "^latest",
"react-day-picker": "^8",
"date-fns": "^latest",
"@radix-ui/react-dropdown-menu": "^latest",
"@radix-ui/react-dialog": "^latest",
"@radix-ui/react-checkbox": "^latest",
"@radix-ui/react-switch": "^latest",
"@radix-ui/react-popover": "^latest"
}
Key Adaptations for Next.js
1. Router Changes
- Before:
react-router-domwithuseNavigate()and<Outlet /> - After: Next.js with
useRouter(),usePathname()fromnext/navigation
2. Client Components
- Added
'use client'directive to:src/layouts/DashboardLayout.tsxsrc/components/business/Dashboard.tsx- All dashboard role components
3. Layout Pattern
- Before:
<Outlet />for nested routes - After:
{children}prop pattern
4. Props Interface
Added DashboardLayoutProps interface:
interface DashboardLayoutProps {
children: React.ReactNode;
}
Role-Based Dashboard System
The system supports 5 user roles:
- CEO - Full dashboard with business metrics
- ProductionManager - Production-focused dashboard
- Worker - Simple work performance dashboard
- SystemAdmin - System management dashboard
- Sales - Sales and leads dashboard
Role switching is handled via:
- localStorage user data
useUserRole()hook- Real-time updates via
roleChangedevent - Dynamic menu generation based on role
Known Issues / Future Work
ESLint Warnings
Many components have ESLint warnings for:
- Unused variables
- Unused imports
- TypeScript
anytypes - Missing type definitions
These need to be cleaned up but don't affect functionality.
Missing Features
- Some business components were copied but may need additional UI components
- Route definitions in
app/directory need to be created - API integration may need updates for Next.js API routes
Next Steps
- Create dashboard routes in
src/app/dashboard/ - Clean up ESLint errors and warnings
- Test all role-based dashboards
- Add missing UI components as needed
- Update API calls for Next.js API routes
- Add authentication guards
- Test role switching functionality
File Structure
src/
├── app/
│ └── dashboard/ # (To be created)
├── components/
│ ├── business/ # All business components
│ ├── layout/
│ │ └── Sidebar.tsx
│ └── ui/ # UI primitives
├── hooks/
│ ├── useUserRole.ts
│ └── useCurrentTime.ts
├── layouts/
│ └── DashboardLayout.tsx
└── store/
├── menuStore.ts
├── themeStore.ts
└── demoStore.ts
Testing
To test the migration:
- Run
npm run dev - Navigate to
/dashboard - Test role switching via dropdown
- Verify each dashboard loads correctly
- Check responsive design (mobile/desktop)
관련 파일
프론트엔드
src/components/business/Dashboard.tsx- 대시보드 라우터 (lazy loading)src/components/business/CEODashboard.tsx- CEO 대시보드src/components/business/ProductionManagerDashboard.tsx- 생산관리자 대시보드src/components/business/WorkerDashboard.tsx- 작업자 대시보드src/components/business/SystemAdminDashboard.tsx- 시스템관리자 대시보드src/components/business/SalesLeadDashboard.tsx- 영업 대시보드src/layouts/DashboardLayout.tsx- 대시보드 레이아웃src/components/layout/Sidebar.tsx- 사이드바 컴포넌트src/hooks/useUserRole.ts- 역할 관리 훅src/hooks/useCurrentTime.ts- 현재 시간 훅src/store/menuStore.ts- 메뉴 상태 관리 (Zustand)src/store/themeStore.ts- 테마 상태 관리 (Zustand)
참조 문서
claudedocs/dashboard/[IMPL-2025-11-10] dashboard-integration-complete.md- 대시보드 통합 완료