import React, { useState, useCallback } from "react"; import { useLocation } from "react-router-dom"; import { nanoid } from "nanoid"; import "./assets/css/style.css"; import imageStart from "./assets/images/ILLO_MiniSpot_2-Paths-v2_1080x1080.png"; import PopupListFlow from "./Popups/PopupListFlow"; import { mainNode } from "./data/data"; import App from "./App"; const BuildFlow = () => { const [showPopup, setShowPopup] = useState(true); const location = useLocation(); const [selectedFlow, setSelectedFlow] = useState(null); const query = new URLSearchParams(location.search); const flowName = query.get("flowName"); const handleAddStartPointClick = () => { setShowPopup(true); }; const hidePopup = () => { setShowPopup(false); }; const handleSelectFlow = (flow) => { setSelectedFlow(flow); // Lưu flow đã chọn hidePopup(); // Ẩn popup sau khi chọn flow // Tìm node khớp với flow trong mainNode const selectedMainNode = mainNode.find((node) => node.key === flow); if (selectedMainNode) { // Tạo một node từ mainNode const newNode = { id: `${selectedMainNode.id}`, // Sử dụng id từ mainNode type: "input", data: { label: (
This is what kicks off your contact's journey. You choose the starting point, then contacts who meet the criteria will enter your map and begin their journey.