"use client"; import React, { useState } from "react"; import { Database, ArrowRight, CheckCircle } from "lucide-react"; import { Connection } from "../types/redesigned"; interface ConnectionStepProps { fromConnection?: Connection; toConnection?: Connection; onFromConnectionChange: (connection: Connection) => void; onToConnectionChange: (connection: Connection) => void; onNext: () => void; } // 임시 연결 데이터 (실제로는 API에서 가져올 것) const mockConnections: Connection[] = [ { id: "conn1", name: "메인 데이터베이스", type: "PostgreSQL", host: "localhost", port: 5432, database: "main_db", username: "admin", tables: [] }, { id: "conn2", name: "외부 API", type: "REST API", host: "api.example.com", port: 443, database: "external", username: "api_user", tables: [] }, { id: "conn3", name: "백업 데이터베이스", type: "MySQL", host: "backup.local", port: 3306, database: "backup_db", username: "backup_user", tables: [] } ]; export const ConnectionStep: React.FC = ({ fromConnection, toConnection, onFromConnectionChange, onToConnectionChange, onNext, }) => { const [selectedFrom, setSelectedFrom] = useState(fromConnection?.id || ""); const [selectedTo, setSelectedTo] = useState(toConnection?.id || ""); const handleFromSelect = (connectionId: string) => { const connection = mockConnections.find(c => c.id === connectionId); if (connection) { setSelectedFrom(connectionId); onFromConnectionChange(connection); } }; const handleToSelect = (connectionId: string) => { const connection = mockConnections.find(c => c.id === connectionId); if (connection) { setSelectedTo(connectionId); onToConnectionChange(connection); } }; const canProceed = selectedFrom && selectedTo && selectedFrom !== selectedTo; return (

연결 선택

데이터를 가져올 연결과 저장할 연결을 선택하세요

{/* FROM 연결 */}
1

FROM 연결

(데이터 소스)
{mockConnections.map((connection) => (
handleFromSelect(connection.id)} >

{connection.name}

{connection.type}

{connection.host}:{connection.port}

{selectedFrom === connection.id && ( )}
))}
{/* 화살표 */}
{/* TO 연결 */}
2

TO 연결

(데이터 대상)
{mockConnections.map((connection) => (
handleToSelect(connection.id)} >

{connection.name}

{connection.type}

{connection.host}:{connection.port}

{selectedTo === connection.id && ( )}
))}
{/* 다음 버튼 */}
); };