2025-09-26 01:28:51 +09:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import React from "react";
|
2025-10-01 16:15:53 +09:00
|
|
|
import { CheckCircle, XCircle, AlertCircle, Database } from "lucide-react";
|
|
|
|
|
import { MappingStats, FieldMapping } from "../types/redesigned";
|
2025-09-26 01:28:51 +09:00
|
|
|
|
2025-10-01 16:15:53 +09:00
|
|
|
interface MappingInfoPanelProps {
|
|
|
|
|
mappingStats: MappingStats;
|
|
|
|
|
fieldMappings: FieldMapping[];
|
|
|
|
|
selectedMapping?: string;
|
|
|
|
|
onMappingSelect: (mappingId: string) => void;
|
|
|
|
|
}
|
2025-09-26 01:28:51 +09:00
|
|
|
|
2025-10-01 16:15:53 +09:00
|
|
|
export const MappingInfoPanel: React.FC<MappingInfoPanelProps> = ({
|
|
|
|
|
mappingStats,
|
|
|
|
|
fieldMappings,
|
|
|
|
|
selectedMapping,
|
|
|
|
|
onMappingSelect,
|
|
|
|
|
}) => {
|
2025-09-26 01:28:51 +09:00
|
|
|
return (
|
2025-10-01 16:15:53 +09:00
|
|
|
<div className="p-6">
|
2026-03-10 18:30:18 +09:00
|
|
|
<h2 className="mb-4 text-lg font-semibold text-gray-900">매핑 정보</h2>
|
2025-09-26 01:28:51 +09:00
|
|
|
|
2025-10-01 16:15:53 +09:00
|
|
|
{/* 통계 카드 */}
|
2026-03-10 18:30:18 +09:00
|
|
|
<div className="mb-6 grid grid-cols-2 gap-3">
|
|
|
|
|
<div className="rounded-lg border border-green-200 bg-green-50 p-3">
|
2025-10-01 16:15:53 +09:00
|
|
|
<div className="flex items-center gap-2">
|
2026-03-10 18:30:18 +09:00
|
|
|
<CheckCircle className="h-4 w-4 text-green-600" />
|
2025-10-01 16:15:53 +09:00
|
|
|
<span className="text-sm font-medium text-green-800">유효한 매핑</span>
|
|
|
|
|
</div>
|
2026-03-10 18:30:18 +09:00
|
|
|
<div className="mt-1 text-2xl font-bold text-green-900">{mappingStats.validMappings}</div>
|
2025-09-26 01:28:51 +09:00
|
|
|
</div>
|
|
|
|
|
|
2026-03-10 18:30:18 +09:00
|
|
|
<div className="bg-destructive/10 border-destructive/20 rounded-lg border p-3">
|
2025-10-01 16:15:53 +09:00
|
|
|
<div className="flex items-center gap-2">
|
2026-03-10 18:30:18 +09:00
|
|
|
<XCircle className="text-destructive h-4 w-4" />
|
2025-10-01 16:15:53 +09:00
|
|
|
<span className="text-sm font-medium text-red-800">오류 매핑</span>
|
|
|
|
|
</div>
|
2026-03-10 18:30:18 +09:00
|
|
|
<div className="mt-1 text-2xl font-bold text-red-900">{mappingStats.invalidMappings}</div>
|
2025-10-01 16:15:53 +09:00
|
|
|
</div>
|
2025-09-26 01:28:51 +09:00
|
|
|
|
2026-03-10 18:30:18 +09:00
|
|
|
<div className="bg-accent border-primary/20 rounded-lg border p-3">
|
2025-10-01 16:15:53 +09:00
|
|
|
<div className="flex items-center gap-2">
|
2026-03-10 18:30:18 +09:00
|
|
|
<Database className="text-primary h-4 w-4" />
|
2025-10-01 16:15:53 +09:00
|
|
|
<span className="text-sm font-medium text-blue-800">총 매핑</span>
|
2025-09-26 01:28:51 +09:00
|
|
|
</div>
|
2026-03-10 18:30:18 +09:00
|
|
|
<div className="mt-1 text-2xl font-bold text-blue-900">{mappingStats.totalMappings}</div>
|
2025-10-01 16:15:53 +09:00
|
|
|
</div>
|
2025-09-26 01:28:51 +09:00
|
|
|
|
2026-03-10 18:30:18 +09:00
|
|
|
<div className="rounded-lg border border-yellow-200 bg-yellow-50 p-3">
|
2025-10-01 16:15:53 +09:00
|
|
|
<div className="flex items-center gap-2">
|
2026-03-10 18:30:18 +09:00
|
|
|
<AlertCircle className="h-4 w-4 text-yellow-600" />
|
2025-10-01 16:15:53 +09:00
|
|
|
<span className="text-sm font-medium text-yellow-800">누락 필드</span>
|
2025-09-26 01:28:51 +09:00
|
|
|
</div>
|
2026-03-10 18:30:18 +09:00
|
|
|
<div className="mt-1 text-2xl font-bold text-yellow-900">{mappingStats.missingRequiredFields}</div>
|
2025-10-01 16:15:53 +09:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-09-26 01:28:51 +09:00
|
|
|
|
2025-10-01 16:15:53 +09:00
|
|
|
{/* 매핑 목록 */}
|
|
|
|
|
<div className="space-y-2">
|
2026-03-10 18:30:18 +09:00
|
|
|
<h3 className="mb-2 text-sm font-medium text-gray-700">필드 매핑 목록</h3>
|
|
|
|
|
|
2025-10-01 16:15:53 +09:00
|
|
|
{fieldMappings.length === 0 ? (
|
2026-03-10 18:30:18 +09:00
|
|
|
<div className="py-8 text-center text-gray-500">
|
|
|
|
|
<Database className="mx-auto mb-2 h-8 w-8 opacity-50" />
|
2025-10-01 16:15:53 +09:00
|
|
|
<p className="text-sm">아직 매핑이 없습니다</p>
|
|
|
|
|
<p className="text-xs">3단계에서 필드를 매핑하세요</p>
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
2026-03-10 18:30:18 +09:00
|
|
|
<div className="max-h-64 space-y-1 overflow-y-auto">
|
2025-10-01 16:15:53 +09:00
|
|
|
{fieldMappings.map((mapping) => (
|
|
|
|
|
<div
|
|
|
|
|
key={mapping.id}
|
2026-03-10 18:30:18 +09:00
|
|
|
className={`cursor-pointer rounded-lg border p-3 transition-all duration-200 ${
|
2025-10-01 16:15:53 +09:00
|
|
|
selectedMapping === mapping.id
|
|
|
|
|
? "border-orange-500 bg-orange-50"
|
|
|
|
|
: mapping.isValid
|
2026-03-10 18:30:18 +09:00
|
|
|
? "border-green-200 bg-green-50 hover:border-green-300"
|
|
|
|
|
: "border-destructive/20 bg-destructive/10 hover:border-red-300"
|
2025-10-01 16:15:53 +09:00
|
|
|
}`}
|
|
|
|
|
onClick={() => onMappingSelect(mapping.id)}
|
|
|
|
|
>
|
|
|
|
|
<div className="flex items-center justify-between">
|
2026-03-10 18:30:18 +09:00
|
|
|
<div className="min-w-0 flex-1">
|
2025-10-01 16:15:53 +09:00
|
|
|
<div className="flex items-center gap-2">
|
2026-03-10 18:30:18 +09:00
|
|
|
<span className="truncate text-sm font-medium text-gray-900">{mapping.fromField.name}</span>
|
2025-10-01 16:15:53 +09:00
|
|
|
<span className="text-gray-400">→</span>
|
2026-03-10 18:30:18 +09:00
|
|
|
<span className="truncate text-sm font-medium text-gray-900">{mapping.toField.name}</span>
|
2025-10-01 16:15:53 +09:00
|
|
|
</div>
|
2026-03-10 18:30:18 +09:00
|
|
|
<div className="mt-1 flex items-center gap-2">
|
|
|
|
|
<span
|
|
|
|
|
className={`rounded px-2 py-1 text-xs ${
|
|
|
|
|
mapping.fromField.type === mapping.toField.type
|
|
|
|
|
? "bg-green-100 text-green-800"
|
|
|
|
|
: "bg-yellow-100 text-yellow-800"
|
|
|
|
|
}`}
|
|
|
|
|
>
|
2025-10-01 16:15:53 +09:00
|
|
|
{mapping.fromField.type}
|
|
|
|
|
</span>
|
|
|
|
|
<span className="text-gray-400">→</span>
|
2026-03-10 18:30:18 +09:00
|
|
|
<span
|
|
|
|
|
className={`rounded px-2 py-1 text-xs ${
|
|
|
|
|
mapping.fromField.type === mapping.toField.type
|
|
|
|
|
? "bg-green-100 text-green-800"
|
|
|
|
|
: "bg-yellow-100 text-yellow-800"
|
|
|
|
|
}`}
|
|
|
|
|
>
|
2025-10-01 16:15:53 +09:00
|
|
|
{mapping.toField.type}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-03-10 18:30:18 +09:00
|
|
|
|
2025-10-01 16:15:53 +09:00
|
|
|
<div className="ml-2">
|
|
|
|
|
{mapping.isValid ? (
|
2026-03-10 18:30:18 +09:00
|
|
|
<CheckCircle className="h-4 w-4 text-green-600" />
|
2025-10-01 16:15:53 +09:00
|
|
|
) : (
|
2026-03-10 18:30:18 +09:00
|
|
|
<XCircle className="text-destructive h-4 w-4" />
|
2025-10-01 16:15:53 +09:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-03-10 18:30:18 +09:00
|
|
|
|
2025-10-01 16:15:53 +09:00
|
|
|
{mapping.validationMessage && (
|
2026-03-10 18:30:18 +09:00
|
|
|
<p className="text-destructive mt-1 text-xs">{mapping.validationMessage}</p>
|
2025-10-01 16:15:53 +09:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
2025-09-26 01:28:51 +09:00
|
|
|
</div>
|
|
|
|
|
)}
|
2025-10-01 16:15:53 +09:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-09-26 01:28:51 +09:00
|
|
|
);
|
2026-03-10 18:30:18 +09:00
|
|
|
};
|