diff --git a/src/assets/css/style.css b/src/assets/css/style.css index 69cc6b2..0dc6ce6 100644 --- a/src/assets/css/style.css +++ b/src/assets/css/style.css @@ -759,3 +759,63 @@ foreignObject { font-weight: 600; line-height: 1.6; } + +.modal-overlay { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + background-color: rgba(0, 0, 0, 0.5); /* Màu đen mờ */ + display: flex; + justify-content: center; + align-items: center; + z-index: 1000; +} + +/* Nội dung modal */ +.modal-content { + background-color: white; + padding: 20px; + border-radius: 8px; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); + text-align: center; + width: 400px; +} + +/* Các nút trong modal */ +.modal-content button { + margin: 10px; + padding: 10px 20px; + border: none; + border-radius: 5px; + cursor: pointer; + transition: background-color 0.3s; +} + +/* Style cho nút Yes, No, Both */ +.modal-content button:nth-child(1) { + background-color: #28a745; /* Màu xanh cho Yes */ + color: white; +} + +.modal-content button:nth-child(2) { + background-color: #dc3545; /* Màu đỏ cho No */ + color: white; +} + +.modal-content button:nth-child(3) { + background-color: #ffc107; /* Màu vàng cho Both */ + color: black; +} + +/* Nút Cancel */ +.modal-content button:nth-child(4) { + background-color: #6c757d; /* Màu xám cho Cancel */ + color: white; +} + +/* Hover effect cho các nút */ +.modal-content button:hover { + opacity: 0.8; +} diff --git a/src/nodes/NodeFlow.tsx b/src/nodes/NodeFlow.tsx index ce4bf64..79b7961 100644 --- a/src/nodes/NodeFlow.tsx +++ b/src/nodes/NodeFlow.tsx @@ -10,6 +10,7 @@ import { ReactFlowProvider, useNodesState, useEdgesState, + useStoreApi, } from '@xyflow/react'; import '@xyflow/react/dist/style.css'; import '../assets/css/style.css'; @@ -18,6 +19,7 @@ import ShowPopup from './ShowPopup.tsx'; import { nanoid } from 'nanoid'; import CustomEdge from './CustomEdge'; import MenuFlow from './MenuFlow'; +import DeleteNodeModal from './popup/DeleteNodeModal.tsx'; // Nội dung cho mỗi node const nodeContents = { @@ -53,8 +55,8 @@ const nodeContents = { }; const NodeFlow = ({ initialNodes, initialEdges }) => { - const [nodes, setNodes] = useState(initialNodes); - const [edges, setEdges] = useState(initialEdges); + const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes); + const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges); const [showTabBar, setShowTabBar] = useState(false); const [lastNodeId, setLastNodeId] = useState(nodes[0].id); const [showPopup, setShowPopup] = useState(false); @@ -64,6 +66,9 @@ const NodeFlow = ({ initialNodes, initialEdges }) => { const { screenToFlowPosition } = useReactFlow(); const [showActions, setShowActions] = useState(null); const [showPopupSuccess, setShowPopupSuccess] = useState(false); + const store = useStoreApi(); + const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); + const [deleteNodeId, setDeleteNodeId] = useState(null); const handleAddNoteClick = () => { setShowTabBar(true); @@ -337,7 +342,7 @@ const NodeFlow = ({ initialNodes, initialEdges }) => { Sửa + + + + + + ); +}; + +export default DeleteNodeModal;