diff --git a/.prettierrc b/.prettierrc index 5b4d2b6..e5b3938 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,6 +1,6 @@ { "arrowParens": "avoid", - "printWidth": 120, + "printWidth": 110, "bracketSpacing": true, "endOfLine": "lf", "trailingComma": "es5", diff --git a/src/components/Node/Configurator.jsx b/src/components/Node/Configurator.jsx new file mode 100644 index 0000000..96504ec --- /dev/null +++ b/src/components/Node/Configurator.jsx @@ -0,0 +1,7 @@ +import React, { useState } from 'react'; + +function Configurator() { + return
Configurator
; +} + +export default Configurator; diff --git a/src/components/Node/Joint.jsx b/src/components/Node/Joint.jsx index fed0e5d..2a74729 100644 --- a/src/components/Node/Joint.jsx +++ b/src/components/Node/Joint.jsx @@ -12,17 +12,29 @@ import { useDisclosure, } from '@chakra-ui/react'; import React, { useState } from 'react'; +import Configurator from './Configurator'; function Joint({ children, attr2, predicateName, pivot, match, notMatch, onChange }) { const { isOpen, onOpen, onClose } = useDisclosure(); const [size, setSize] = useState('lg'); const handleOpenModalClick = () => { + buildNewNode(); onOpen(); }; + const buildNewNode = () => { + onChange(); + }; return ( - + {attr2} {predicateName} {pivot} @@ -32,7 +44,10 @@ function Joint({ children, attr2, predicateName, pivot, match, notMatch, onChang {attr2} {predicateName} {pivot} - Text ( kolejny komponent z konfiguratorem) + + Text ( kolejny komponent z konfiguratorem) + + diff --git a/src/components/Node/ModalPopup.jsx b/src/components/Node/ModalPopup.jsx new file mode 100644 index 0000000..9c7aae8 --- /dev/null +++ b/src/components/Node/ModalPopup.jsx @@ -0,0 +1,38 @@ +import React, { useState } from 'react'; +import { + Badge, + Box, + Button, + Modal, + ModalBody, + ModalCloseButton, + ModalContent, + ModalFooter, + ModalHeader, + ModalOverlay, + useDisclosure, +} from '@chakra-ui/react'; + +function ModalPopup({ attr2, predicateName, pivot }) { + const { isOpen, onOpen, onClose } = useDisclosure(); + + const handleOpenModalClick = () => { + onOpen(); + }; + + + + + + {attr2} {predicateName} {pivot} + + + Text ( kolejny komponent z konfiguratorem) + + + + + ; +} + +export default ModalPopup; diff --git a/src/components/Node/index.jsx b/src/components/Node/index.jsx index ee47d15..5caf70a 100644 --- a/src/components/Node/index.jsx +++ b/src/components/Node/index.jsx @@ -5,24 +5,14 @@ import Joint from './Joint'; import Leaf from './Leaf'; const Node = props => { - console.log(props.node); + //console.log(props.node); const [highlighted, setHighlighted] = useState(false); const [node, setNode] = useState(props.node || {}); useEffect(() => setNode(props.node || {}), [props.node, setNode]); - const { - category, - quality, - matchedCount, - notMatchedCount, - match, - notMatch, - attr2, - predicateName, - pivot, - } = node; + const { category, quality, matchedCount, notMatchedCount, match, notMatch, attr2, predicateName, pivot } = node; const onNodeClicked = e => { - console.log(e); + //console.log(e); e.stopPropagation(); console.log('Node clicked', node); //const changed = addComment(node); @@ -34,9 +24,12 @@ const Node = props => { const onChange = useMemo(() => { return node => { - const index = match.findIndex(c => c.id === node.id); - match.splice(index, 1, node); - props.node.match = [...match]; + console.log(node); + // const index = match.findIndex(c => c.id === node.id); + // console.log(index); + // console.log(match); + // match.splice(index, 1, node); + // props.node.match = [...match]; }; }, [match, props.node]); @@ -47,12 +40,7 @@ const Node = props => { return (
{category ? ( - + ) : (