"use client"; import { motion, AnimatePresence } from "framer-motion"; import { useState } from "react"; import type { Edge } from "@xyflow/react"; interface EdgeLabelModalProps { edge: Edge | null; isOpen: boolean; onClose: () => void; onSave: (edgeId: string, label: string) => void; } export default function EdgeLabelModal({ edge, isOpen, onClose, onSave }: EdgeLabelModalProps) { const [label, setLabel] = useState(edge?.label as string || ''); const [labelType, setLabelType] = useState<'custom' | 'true' | 'false' | 'none'>( edge?.label === 'true' ? 'true' : edge?.label === 'false' ? 'false' : edge?.label ? 'custom' : 'none' ); const handleSave = () => { if (!edge) return; let finalLabel = ''; if (labelType === 'true') finalLabel = 'true'; else if (labelType === 'false') finalLabel = 'false'; else if (labelType === 'custom') finalLabel = label; onSave(edge.id, finalLabel); onClose(); }; if (!edge) return null; return ( {isOpen && ( e.stopPropagation()} className="bg-accent-white rounded-16 shadow-2xl max-w-400 w-full" > {/* Header */}

Edit Connection

Add a label to this connection

{/* Content */}
{/* Label Type */}
{/* Custom Label Input */} {labelType === 'custom' && (
setLabel(e.target.value)} placeholder="Enter label text" className="w-full px-12 py-8 bg-background-base border border-border-faint rounded-8 text-body-medium text-accent-black focus:outline-none focus:border-heat-100 transition-colors" />
)}
{/* Footer */}
)}
); }