import LightButton from "@/components/buttons/LightButton"; import Input from "@/components/Input"; import { X } from "lucide-react"; import { useRef } from "react"; interface AddTextPairModalProps { isOpen: boolean; onClose: () => void; onAdd: ( text1: string, text2: string, locale1: string, locale2: string, ) => void; } export default function AddTextPairModal({ isOpen, onClose, onAdd, }: AddTextPairModalProps) { const input1Ref = useRef(null); const input2Ref = useRef(null); const input3Ref = useRef(null); const input4Ref = useRef(null); if (!isOpen) return null; const handleAdd = () => { if ( !input1Ref.current?.value || !input2Ref.current?.value || !input3Ref.current?.value || !input4Ref.current?.value ) return; const text1 = input1Ref.current.value; const text2 = input2Ref.current.value; const locale1 = input3Ref.current.value; const locale2 = input4Ref.current.value; if ( typeof text1 === "string" && typeof text2 === "string" && typeof locale1 === "string" && typeof locale2 === "string" && text1.trim() !== "" && text2.trim() !== "" && locale1.trim() !== "" && locale2.trim() !== "" ) { onAdd(text1, text2, locale1, locale2); input1Ref.current.value = ""; input2Ref.current.value = ""; } }; return (
{ if (e.key === "Enter") { e.preventDefault(); handleAdd(); } }} >

Add New Text Pair

text1
text2
locale1
locale2
Add
); }