import { Dialog, Transition } from '@headlessui/react' import { Fragment } from 'react' import { useCalc, CreateNewVariable } from './AvailableVarsHelpers' import { ActionButton } from './ActionButton' import { faPlus } from '@fortawesome/free-solid-svg-icons' import { toast } from 'react-hot-toast' export const SetVarNameModal = ({ isOpen, onResolve, onReject, valueName, }: { isOpen: boolean onResolve: (a: { variableName?: string }) => void onReject: (a: any) => void value: number valueName: string }) => { const { isNewVariableNameUnique, newVariableName, setNewVariableName } = useCalc({ value: '', initialVariableName: valueName }) return (
{ e.preventDefault() onResolve({ variableName: newVariableName, }) toast.success(`Added variable ${newVariableName}`) }} >
Add variable onReject(false)}> Cancel
) }