"use client"; import React from "react"; import { Button } from "@/components/ui/button"; import { Separator } from "@/components/ui/separator"; import { Save, Eye, TestTube, Copy, RotateCcw, Loader2 } from "lucide-react"; import { toast } from "sonner"; // ํƒ€์ž… import import { DataConnectionState, DataConnectionActions } from "../types/redesigned"; interface ActionButtonsProps { state: DataConnectionState; actions: DataConnectionActions; } /** * ๐ŸŽฏ ์•ก์…˜ ๋ฒ„ํŠผ๋“ค * - ์ €์žฅ, ๋ฏธ๋ฆฌ๋ณด๊ธฐ, ํ…Œ์ŠคํŠธ ์‹คํ–‰ * - ์„ค์ • ๋ณต์‚ฌ, ์ดˆ๊ธฐํ™” */ const ActionButtons: React.FC = ({ state, actions }) => { const handleSave = async () => { try { await actions.saveMappings(); } catch (error) { console.error("์ €์žฅ ์‹คํŒจ:", error); } }; const handlePreview = () => { // TODO: ๋ฏธ๋ฆฌ๋ณด๊ธฐ ๋ชจ๋‹ฌ ์—ด๊ธฐ toast.info("๋ฏธ๋ฆฌ๋ณด๊ธฐ ๊ธฐ๋Šฅ์€ ๊ณง ๊ตฌํ˜„๋  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค."); }; const handleTest = async () => { try { await actions.testExecution(); } catch (error) { console.error("ํ…Œ์ŠคํŠธ ์‹คํŒจ:", error); } }; const handleCopySettings = () => { // TODO: ์„ค์ • ๋ณต์‚ฌ ๊ธฐ๋Šฅ toast.info("์„ค์ • ๋ณต์‚ฌ ๊ธฐ๋Šฅ์€ ๊ณง ๊ตฌํ˜„๋  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค."); }; const handleReset = () => { if (confirm("๋ชจ๋“  ์„ค์ •์„ ์ดˆ๊ธฐํ™”ํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?")) { // TODO: ์ƒํƒœ ์ดˆ๊ธฐํ™” toast.success("์„ค์ •์ด ์ดˆ๊ธฐํ™”๋˜์—ˆ์Šต๋‹ˆ๋‹ค."); } }; const canSave = state.fieldMappings.length > 0 && !state.isLoading; const canTest = state.fieldMappings.length > 0 && !state.isLoading; return (
{/* ์ฃผ์š” ์•ก์…˜ */}
{/* ํ…Œ์ŠคํŠธ ์‹คํ–‰ */} {/* ๋ณด์กฐ ์•ก์…˜ */}
{/* ์ƒํƒœ ์ •๋ณด */} {state.fieldMappings.length > 0 && (
{state.fieldMappings.length}๊ฐœ ๋งคํ•‘ ์„ค์ •๋จ {state.validationErrors.length > 0 && ( ({state.validationErrors.length}๊ฐœ ์˜ค๋ฅ˜) )}
)}
); }; export default ActionButtons;