feat: 품목 관리 및 마스터 데이터 관리 시스템 구현
주요 기능: - 품목 CRUD 기능 (생성, 조회, 수정) - 품목 마스터 데이터 관리 시스템 - BOM(Bill of Materials) 관리 기능 - 도면 캔버스 기능 - 품목 속성 및 카테고리 관리 - 스크린 인쇄 생산 관리 페이지 기술 개선: - localStorage SSR 호환성 수정 (9개 useState 초기화) - Shadcn UI 컴포넌트 추가 (table, tabs, alert, drawer 등) - DataContext 및 DeveloperModeContext 추가 - API 라우트 구현 (items, master-data) - 타입 정의 및 유틸리티 함수 추가 빌드 테스트: ✅ 성공 (3.1초) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
6699
src/contexts/DataContext.tsx
Normal file
6699
src/contexts/DataContext.tsx
Normal file
File diff suppressed because it is too large
Load Diff
113
src/contexts/DeveloperModeContext.tsx
Normal file
113
src/contexts/DeveloperModeContext.tsx
Normal file
@@ -0,0 +1,113 @@
|
||||
'use client';
|
||||
|
||||
import { createContext, useContext, useState, ReactNode } from 'react';
|
||||
|
||||
export interface ComponentMetadata {
|
||||
componentName: string;
|
||||
pagePath: string;
|
||||
description: string;
|
||||
|
||||
// API 정보
|
||||
apis?: {
|
||||
endpoint: string;
|
||||
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
||||
description: string;
|
||||
requestBody?: any;
|
||||
responseBody?: any;
|
||||
queryParams?: { name: string; type: string; required: boolean; description: string }[];
|
||||
pathParams?: { name: string; type: string; description: string }[];
|
||||
}[];
|
||||
|
||||
// 데이터 구조
|
||||
dataStructures?: {
|
||||
name: string;
|
||||
type: string;
|
||||
fields: { name: string; type: string; required: boolean; description: string }[];
|
||||
example?: any;
|
||||
}[];
|
||||
|
||||
// 컴포넌트 정보
|
||||
components?: {
|
||||
name: string;
|
||||
path: string;
|
||||
props?: { name: string; type: string; required: boolean; description: string }[];
|
||||
children?: string[];
|
||||
}[];
|
||||
|
||||
// 상태 관리
|
||||
stateManagement?: {
|
||||
type: 'Context' | 'Local' | 'Props';
|
||||
name: string;
|
||||
description: string;
|
||||
methods?: string[];
|
||||
}[];
|
||||
|
||||
// 의존성
|
||||
dependencies?: {
|
||||
package: string;
|
||||
version?: string;
|
||||
usage: string;
|
||||
}[];
|
||||
|
||||
// DB 스키마 (백엔드)
|
||||
dbSchema?: {
|
||||
tableName: string;
|
||||
columns: { name: string; type: string; nullable: boolean; key?: 'PK' | 'FK'; description: string }[];
|
||||
indexes?: string[];
|
||||
relations?: { table: string; type: '1:1' | '1:N' | 'N:M'; description: string }[];
|
||||
}[];
|
||||
|
||||
// 비즈니스 로직
|
||||
businessLogic?: {
|
||||
name: string;
|
||||
description: string;
|
||||
steps: string[];
|
||||
}[];
|
||||
|
||||
// 유효성 검사
|
||||
validations?: {
|
||||
field: string;
|
||||
rules: string[];
|
||||
errorMessages: string[];
|
||||
}[];
|
||||
}
|
||||
|
||||
interface DeveloperModeContextType {
|
||||
isDeveloperMode: boolean;
|
||||
setIsDeveloperMode: (value: boolean) => void;
|
||||
currentMetadata: ComponentMetadata | null;
|
||||
setCurrentMetadata: (metadata: ComponentMetadata | null) => void;
|
||||
isConsoleExpanded: boolean;
|
||||
setIsConsoleExpanded: (value: boolean) => void;
|
||||
}
|
||||
|
||||
const DeveloperModeContext = createContext<DeveloperModeContextType | undefined>(undefined);
|
||||
|
||||
export function DeveloperModeProvider({ children }: { children: ReactNode }) {
|
||||
const [isDeveloperMode, setIsDeveloperMode] = useState(false);
|
||||
const [currentMetadata, setCurrentMetadata] = useState<ComponentMetadata | null>(null);
|
||||
const [isConsoleExpanded, setIsConsoleExpanded] = useState(true);
|
||||
|
||||
return (
|
||||
<DeveloperModeContext.Provider
|
||||
value={{
|
||||
isDeveloperMode,
|
||||
setIsDeveloperMode,
|
||||
currentMetadata,
|
||||
setCurrentMetadata,
|
||||
isConsoleExpanded,
|
||||
setIsConsoleExpanded,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</DeveloperModeContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export function useDeveloperMode() {
|
||||
const context = useContext(DeveloperModeContext);
|
||||
if (!context) {
|
||||
throw new Error('useDeveloperMode must be used within DeveloperModeProvider');
|
||||
}
|
||||
return context;
|
||||
}
|
||||
Reference in New Issue
Block a user