Files
sam-react-prod/src/components/organisms/ScreenVersionHistory.tsx
byeongcheolryu 3be5714805 refactor: 품목관리 시스템 리팩토링 및 Sales 페이지 추가
DynamicItemForm 개선:
- 품목코드 자동생성 기능 추가
- 조건부 표시 로직 개선
- 불필요한 컴포넌트 정리 (DynamicField, DynamicSection 등)
- 타입 시스템 단순화

새로운 기능:
- Sales 페이지 마이그레이션 (견적관리, 거래처관리)
- 공통 컴포넌트 추가 (atoms, molecules, organisms, templates)

문서화:
- 구현 문서 및 참조 문서 추가

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 12:48:41 +09:00

75 lines
2.4 KiB
TypeScript

"use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { History } from "lucide-react";
interface VersionHistoryItem {
id: string;
version: number;
changeDescription: string;
changedBy: string;
changedAt: string;
}
interface ScreenVersionHistoryProps {
versionHistory: VersionHistoryItem[];
title?: string;
colorScheme?: {
border: string;
background: string;
text: string;
};
maxVisible?: number;
}
export function ScreenVersionHistory({
versionHistory,
title = "수정 이력",
colorScheme = {
border: "border-purple-200 dark:border-purple-800",
background: "bg-purple-50 dark:bg-purple-950/30",
text: "text-purple-700 dark:text-purple-300"
},
maxVisible = 3
}: ScreenVersionHistoryProps) {
if (versionHistory.length === 0) {
return null;
}
return (
<Card className={`${colorScheme.border} ${colorScheme.background}`}>
<CardHeader>
<CardTitle className={`flex items-center gap-2 ${colorScheme.text}`}>
<History className="h-5 w-5" />
{title}
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="bg-background border rounded-lg p-4">
<div className="text-sm space-y-2">
<div className="flex items-center justify-between mb-2">
<span className={`font-semibold ${colorScheme.text}`}> </span>
<Badge variant="secondary"> {versionHistory.length}</Badge>
</div>
<div className="max-h-32 overflow-y-auto space-y-2">
{versionHistory.slice().reverse().slice(0, maxVisible).map((history) => (
<div key={history.id} className="flex items-center gap-2 text-xs">
<Badge variant="outline">v{history.version}</Badge>
<span className="text-muted-foreground"></span>
<span>{history.changeDescription}</span>
<span className="text-muted-foreground"></span>
<span className="text-muted-foreground">{history.changedBy}</span>
<span className="text-muted-foreground ml-auto">
{new Date(history.changedAt).toLocaleDateString('ko-KR')}
</span>
</div>
))}
</div>
</div>
</div>
</CardContent>
</Card>
);
}