"use client"; import { useState } from "react"; import DataFlowList from "@/components/dataflow/DataFlowList"; import { FlowEditor } from "@/components/dataflow/node-editor/FlowEditor"; import { useAuth } from "@/hooks/useAuth"; import { toast } from "sonner"; import { showErrorToast } from "@/lib/utils/toastUtils"; import { Button } from "@/components/ui/button"; import { ArrowLeft } from "lucide-react"; type Step = "list" | "editor"; export default function DataFlowPage() { const { user } = useAuth(); const [currentStep, setCurrentStep] = useState("list"); const [loadingFlowId, setLoadingFlowId] = useState(null); const handleLoadFlow = async (flowId: number | null) => { if (flowId === null) { setLoadingFlowId(null); setCurrentStep("editor"); return; } try { setLoadingFlowId(flowId); setCurrentStep("editor"); toast.success("플로우를 불러왔어요"); } catch (error: any) { console.error("플로우 불러오기 실패:", error); showErrorToast("플로우를 불러오는 데 실패했어요", error, { guidance: "네트워크 연결을 확인해 주세요.", }); } }; const handleBackToList = () => { setCurrentStep("list"); setLoadingFlowId(null); }; if (currentStep === "editor") { return (
); } return (
); }