diff --git a/src/component/modals/GraphCompDetails.jsx b/src/component/modals/GraphCompDetails.jsx index a8316a0c..86b52197 100644 --- a/src/component/modals/GraphCompDetails.jsx +++ b/src/component/modals/GraphCompDetails.jsx @@ -14,7 +14,8 @@ const ModalComp = ({ closeModal, superState, dispatcher }) => { const [createHelpClicked, setCreateHelpClicked] = useState(false); const { modalPayload, ModelOpen } = superState; const { - cb, title, submitText, Children, defaultStyle, defaultLabel, labelAllowed, type, + cb, title, submitText, Children, defaultStyle, defaultLabel, + defaultSummary, labelAllowed, type, } = modalPayload; useEffect(() => { @@ -22,16 +23,24 @@ const ModalComp = ({ closeModal, superState, dispatcher }) => { }, [ModelOpen]); useEffect(() => { - setData({ label: defaultLabel || '', style: defaultStyle }); + setData({ + label: defaultLabel || '', + style: defaultStyle, + summary: defaultSummary || '', + }); setErrorMessage(''); - }, [defaultLabel, defaultStyle]); + }, [defaultLabel, defaultStyle, defaultSummary]); const submit = (e) => { e.preventDefault(); - const message = cb(data.label, data.style); + const message = cb(data.label, data.style, data.summary || ''); if (message.ok) { setErrorMessage(''); - setData({ label: defaultLabel || '', style: defaultStyle }); + setData({ + label: defaultLabel || '', + style: defaultStyle, + summary: defaultSummary || '', + }); closeModal(); } else setErrorMessage(message.err); }; @@ -173,4 +182,5 @@ const ModalComp = ({ closeModal, superState, dispatcher }) => { ); }; + export default ModalComp; diff --git a/src/component/modals/NodeDetails.jsx b/src/component/modals/NodeDetails.jsx index 5bd76bb8..6d12459f 100644 --- a/src/component/modals/NodeDetails.jsx +++ b/src/component/modals/NodeDetails.jsx @@ -18,6 +18,9 @@ const NodeDetails = ({ const indexOfFile = []; indexOfFile.push(0); + const currentLabel = String(data.label || ''); + const currentSummary = String(data.summary || ''); + const setStyle = (prop) => { setData({ ...data, style: { ...data.style, ...prop } }); }; @@ -42,7 +45,7 @@ const NodeDetails = ({ }, [state.fileState]); useEffect(() => { - if (!widthSet) { + if (!widthSet && textRef.current) { setStyle({ width: Math.max(data.style.width, Math.min(500, textRef.current.offsetWidth + 20)), }); @@ -50,8 +53,8 @@ const NodeDetails = ({ }, [!widthSet && data.label]); useEffect(() => { - setLabelName(data.label.split(':')[0]); - }, [data.label]); + setLabelName(currentLabel.split(':')[0]); + }, [currentLabel]); return (