- ItemMasterDataManagement.tsx SSR 호환성 작업 계획 수립 - 6곳의 localStorage useState 초기화 수정 대상 파악 - 대용량 파일 작업 전략 및 세션 재개 방법 문서화 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
4.2 KiB
4.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)