[feat]: Item Master 데이터 관리 기능 구현 및 타입 에러 수정
- ItemMasterDataManagement 컴포넌트 구조화 (tabs, dialogs, components 분리) - HierarchyTab 타입 에러 수정 (BOMItem section_id, updated_at 추가) - API 클라이언트 구현 (item-master.ts, 13개 엔드포인트) - ItemMasterContext 구현 (상태 관리 및 데이터 흐름) - 백엔드 요구사항 문서 작성 (CORS 설정, API 스펙 등) - SSR 호환성 수정 (navigator API typeof window 체크) - 미사용 변수 ESLint 에러 해결 - Context 리팩토링 (AuthContext, RootProvider 추가) - API 유틸리티 추가 (error-handler, logger, transformers) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
248
claudedocs/UNUSED_FILES_REPORT.md
Normal file
248
claudedocs/UNUSED_FILES_REPORT.md
Normal file
@@ -0,0 +1,248 @@
|
||||
# 미사용 파일 분석 보고서
|
||||
|
||||
## 📊 요약
|
||||
|
||||
**총 미사용 파일: 51개**
|
||||
- Context 파일: 8개 (전혀 사용 안함)
|
||||
- Active 컴포넌트: 1개 (BOMManager.tsx)
|
||||
- 부분 사용: 1개 (DeveloperModeContext.tsx)
|
||||
- 이미 정리됨: 42개 (components/_unused/)
|
||||
|
||||
## 🔴 완전 미사용 파일 (삭제 권장)
|
||||
|
||||
### Context 파일 (8개)
|
||||
모두 `RootProvider.tsx`에만 포함되어 있고, 실제 페이지/컴포넌트에서는 전혀 사용되지 않음
|
||||
|
||||
| 파일명 | 경로 | 사용처 | 상태 |
|
||||
|--------|------|--------|------|
|
||||
| FacilitiesContext.tsx | src/contexts/ | RootProvider만 | ❌ 미사용 |
|
||||
| AccountingContext.tsx | src/contexts/ | RootProvider만 | ❌ 미사용 |
|
||||
| HRContext.tsx | src/contexts/ | RootProvider만 | ❌ 미사용 |
|
||||
| ShippingContext.tsx | src/contexts/ | RootProvider만 | ❌ 미사용 |
|
||||
| InventoryContext.tsx | src/contexts/ | RootProvider만 | ❌ 미사용 |
|
||||
| ProductionContext.tsx | src/contexts/ | RootProvider만 | ❌ 미사용 |
|
||||
| PricingContext.tsx | src/contexts/ | RootProvider만 | ❌ 미사용 |
|
||||
| SalesContext.tsx | src/contexts/ | RootProvider만 | ❌ 미사용 |
|
||||
|
||||
**영향 분석:**
|
||||
- 이 8개 Context는 React SPA에서 있었던 것으로 추정
|
||||
- Next.js 마이그레이션 후 관련 페이지가 구현되지 않음
|
||||
- `RootProvider.tsx`에서만 import되고 실제 사용은 없음
|
||||
- 안전하게 제거 가능 (빌드/런타임 영향 없음)
|
||||
|
||||
### 컴포넌트 (1개)
|
||||
|
||||
| 파일명 | 경로 | 라인수 | 사용처 | 상태 |
|
||||
|--------|------|--------|--------|------|
|
||||
| BOMManager.tsx | src/components/items/ | 485 | 없음 | ❌ 미사용 |
|
||||
|
||||
**영향 분석:**
|
||||
- BOMManagementSection.tsx가 대신 사용됨 (ItemMasterDataManagement에서 사용)
|
||||
- 485줄의 구형 컴포넌트
|
||||
- `_unused/` 디렉토리로 이동 권장
|
||||
|
||||
## 🟡 부분 사용 파일 (검토 필요)
|
||||
|
||||
### DeveloperModeContext.tsx
|
||||
|
||||
**현재 상태:**
|
||||
- ✅ Provider는 `(protected)/layout.tsx`에 연결됨
|
||||
- ✅ `PageLayout.tsx`에서 import하고 사용
|
||||
- ❌ 하지만 실제로 `devMetadata` prop을 전달하는 곳은 없음
|
||||
|
||||
**사용 분석:**
|
||||
```typescript
|
||||
// PageLayout.tsx - devMetadata를 받지만...
|
||||
export function PageLayout({ devMetadata, ... }) {
|
||||
const { setCurrentMetadata } = useDeveloperMode();
|
||||
|
||||
useEffect(() => {
|
||||
if (devMetadata) { // 실제로 devMetadata를 전달하는 곳이 없음
|
||||
setCurrentMetadata(devMetadata);
|
||||
}
|
||||
}, []);
|
||||
}
|
||||
|
||||
// ItemMasterDataManagement.tsx - 유일하게 PageLayout을 사용
|
||||
<PageLayout> {/* devMetadata 전달 안함 */}
|
||||
...
|
||||
</PageLayout>
|
||||
```
|
||||
|
||||
**권장 사항:**
|
||||
1. **Option 1 (삭제)**: 개발자 모드 기능을 사용하지 않는다면 제거
|
||||
2. **Option 2 (활용)**: 개발자 모드 기능이 필요하면 devMetadata 전달 구현
|
||||
3. **Option 3 (보류)**: 향후 사용 계획이 있으면 유지
|
||||
|
||||
## ✅ 정상 사용 파일
|
||||
|
||||
### Context (3개)
|
||||
| 파일명 | 사용처 |
|
||||
|--------|--------|
|
||||
| AuthContext.tsx | LoginPage, SignupPage, useAuth hook 사용 중 |
|
||||
| ItemMasterContext.tsx | ItemMasterDataManagement 등에서 사용 중 |
|
||||
| ThemeContext.tsx | DashboardLayout, ThemeSelect에서 사용 중 |
|
||||
|
||||
### 컴포넌트
|
||||
| 파일명 | 사용처 |
|
||||
|--------|--------|
|
||||
| FileUpload.tsx | ItemForm.tsx에서 import 및 사용 |
|
||||
| DrawingCanvas.tsx | ItemForm.tsx에서 사용 (`<DrawingCanvas` 확인) |
|
||||
| ThemeSelect.tsx | LoginPage, SignupPage에서 사용 |
|
||||
| LanguageSelect.tsx | LoginPage, SignupPage에서 사용 |
|
||||
| PageLayout.tsx | ItemMasterDataManagement에서 사용 |
|
||||
| ItemMasterDataManagement.tsx | master-data/item-master-data-management/page.tsx에서 사용 |
|
||||
|
||||
## 📁 이미 정리된 파일
|
||||
|
||||
`components/_unused/` 디렉토리에 **42개 구형 컴포넌트**가 이미 정리되어 있음:
|
||||
|
||||
### Root 컴포넌트 (3개)
|
||||
- LanguageSwitcher.tsx
|
||||
- WelcomeMessage.tsx
|
||||
- NavigationMenu.tsx
|
||||
|
||||
### Business 컴포넌트 (39개)
|
||||
- ApprovalManagement.tsx
|
||||
- AccountingManagement.tsx
|
||||
- BOMManagement.tsx
|
||||
- Board.tsx
|
||||
- CodeManagement.tsx
|
||||
- ContactModal.tsx
|
||||
- DemoRequestPage.tsx
|
||||
- DrawingCanvas.tsx
|
||||
- EquipmentManagement.tsx
|
||||
- HRManagement.tsx
|
||||
- ItemManagement.tsx
|
||||
- LandingPage.tsx
|
||||
- LoginPage.tsx
|
||||
- LotManagement.tsx
|
||||
- MasterData.tsx
|
||||
- MaterialManagement.tsx
|
||||
- MenuCustomization.tsx
|
||||
- MenuCustomizationGuide.tsx
|
||||
- OrderManagement.tsx
|
||||
- PricingManagement.tsx
|
||||
- ProductManagement.tsx
|
||||
- ProductionManagement.tsx
|
||||
- ProductionManagerDashboard.tsx
|
||||
- QualityManagement.tsx
|
||||
- QuoteCreation.tsx
|
||||
- QuoteSimulation.tsx
|
||||
- ReceivingWrite.tsx
|
||||
- Reports.tsx
|
||||
- SalesLeadDashboard.tsx
|
||||
- SalesManagement.tsx
|
||||
- SalesManagement-clean.tsx
|
||||
- ShippingManagement.tsx
|
||||
- SignupPage.tsx
|
||||
- SystemAdminDashboard.tsx
|
||||
- SystemManagement.tsx
|
||||
- UserManagement.tsx
|
||||
- WorkerDashboard.tsx
|
||||
- WorkerPerformance.tsx
|
||||
- 기타...
|
||||
|
||||
## 🎯 정리 액션 플랜
|
||||
|
||||
### Phase 1: 안전한 정리 (즉시 실행 가능)
|
||||
|
||||
**1. Context 파일 8개 제거**
|
||||
```bash
|
||||
# RootProvider.tsx에서 import 제거 필요
|
||||
rm src/contexts/FacilitiesContext.tsx
|
||||
rm src/contexts/AccountingContext.tsx
|
||||
rm src/contexts/HRContext.tsx
|
||||
rm src/contexts/ShippingContext.tsx
|
||||
rm src/contexts/InventoryContext.tsx
|
||||
rm src/contexts/ProductionContext.tsx
|
||||
rm src/contexts/PricingContext.tsx
|
||||
rm src/contexts/SalesContext.tsx
|
||||
```
|
||||
|
||||
**2. BOMManager.tsx를 _unused로 이동**
|
||||
```bash
|
||||
mv src/components/items/BOMManager.tsx src/components/_unused/business/
|
||||
```
|
||||
|
||||
**3. RootProvider.tsx 수정**
|
||||
8개 Context import와 Provider 래퍼 제거
|
||||
```typescript
|
||||
// Before: 10개 Provider 중첩
|
||||
// After: 2개만 남김 (AuthContext, ItemMasterContext)
|
||||
```
|
||||
|
||||
### Phase 2: DeveloperModeContext 결정
|
||||
|
||||
**Option A - 삭제하는 경우:**
|
||||
```bash
|
||||
# 1. DeveloperModeContext.tsx 삭제
|
||||
rm src/contexts/DeveloperModeContext.tsx
|
||||
|
||||
# 2. layout.tsx에서 Provider 제거
|
||||
# 3. PageLayout.tsx에서 useDeveloperMode 제거
|
||||
```
|
||||
|
||||
**Option B - 유지하는 경우:**
|
||||
- 현재 상태로 유지 (기능 구현 시까지)
|
||||
- 또는 devMetadata 기능 실제 구현
|
||||
|
||||
### Phase 3: _unused 디렉토리 최종 정리
|
||||
|
||||
**향후 삭제 가능:**
|
||||
```bash
|
||||
# 완전히 사용하지 않을 것이 확실하면
|
||||
rm -rf src/components/_unused/
|
||||
```
|
||||
|
||||
## 📈 정리 후 예상 효과
|
||||
|
||||
### 코드베이스 감소
|
||||
- Context 파일: 8개 제거 → 약 2,000-3,000 라인 감소
|
||||
- BOMManager: 485 라인 감소
|
||||
- **총 예상: ~2,500-3,500 라인 감소**
|
||||
|
||||
### 빌드 성능 개선
|
||||
- 불필요한 Context Provider 제거로 앱 초기화 속도 개선
|
||||
- 번들 크기 감소 (tree-shaking 효과)
|
||||
|
||||
### 유지보수성 향상
|
||||
- 코드베이스 명확성 증가
|
||||
- 신규 개발자 혼란 방지
|
||||
- 불필요한 의존성 제거
|
||||
|
||||
## ⚠️ 주의사항
|
||||
|
||||
### 삭제 전 확인사항
|
||||
1. ✅ git 커밋 상태 확인 (롤백 가능하도록)
|
||||
2. ✅ 빌드 테스트: `npm run build`
|
||||
3. ✅ TypeScript 체크: `npm run type-check`
|
||||
4. ✅ 개발 서버 실행 및 주요 페이지 동작 확인
|
||||
|
||||
### 롤백 계획
|
||||
```bash
|
||||
# 문제 발생 시 git으로 복구
|
||||
git checkout src/contexts/FacilitiesContext.tsx
|
||||
# 또는
|
||||
git reset --hard HEAD
|
||||
```
|
||||
|
||||
## 📝 권장 실행 순서
|
||||
|
||||
1. ✅ **git 브랜치 생성**: `git checkout -b cleanup/unused-files`
|
||||
2. ✅ **Phase 1 실행**: Context 8개 + BOMManager 정리
|
||||
3. ✅ **빌드 검증**: `npm run build`
|
||||
4. ✅ **동작 테스트**: 개발 서버로 주요 페이지 확인
|
||||
5. ✅ **커밋**: `git commit -m "chore: 미사용 Context 파일 8개 및 BOMManager 제거"`
|
||||
6. 🔄 **Phase 2 검토**: DeveloperModeContext 유지/삭제 결정
|
||||
7. 🔄 **Phase 3 검토**: _unused 디렉토리 최종 삭제 여부 결정
|
||||
|
||||
## 🔍 추가 검토 필요 항목
|
||||
|
||||
다음 파일들은 사용 여부를 추가 확인 필요:
|
||||
|
||||
1. **EmptyPage.tsx**: 현재 사용 확인 필요
|
||||
2. **chart-wrapper.tsx**: 차트 사용 페이지 구현 시 필요할 수 있음
|
||||
3. **ItemTypeSelect.tsx**: items 관련 페이지에서 사용 가능성
|
||||
|
||||
이 파일들은 grep으로 사용처를 확인한 후 결정하는 것이 안전합니다.
|
||||
Reference in New Issue
Block a user