diff --git a/src/components/JoinMarkupsModal/index.js b/src/components/JoinMarkupsModal/index.js index 13021c84..350546be 100644 --- a/src/components/JoinMarkupsModal/index.js +++ b/src/components/JoinMarkupsModal/index.js @@ -9,10 +9,27 @@ import "./styles.scss"; const JoinMarkupsModal = ({ perspectiveId, mode, relations, onClose }) => { const getTranslation = useContext(TranslationContext); - //const [firstTextRelation, setFirstTextRelation] = useState(null); - //const [secondTextRelation, setSecondTextRelation] = useState(null); + const [firstTextRelation, setFirstTextRelation] = useState(null); + const [secondTextRelation, setSecondTextRelation] = useState(null); const [typeRelation, setTypeRelation] = useState(null); + const joinActive = firstTextRelation && secondTextRelation && typeRelation; + + const onAddRelation = useCallback( + /*newMetadata*/ () => { + console.log("onAddRelation!!!!!!!"); + setFirstTextRelation(null); + setSecondTextRelation(null); + setTypeRelation(null); + /*updateLanguageMetadata({ + variables: { id: language.id, metadata: newMetadata } + }).then(() => setMetadata(newMetadata));*/ + }, + [ + /*language, updateLanguageMetadata*/ + ] + ); + console.log("perspectiveId===="); console.log(perspectiveId); @@ -25,6 +42,9 @@ const JoinMarkupsModal = ({ perspectiveId, mode, relations, onClose }) => { console.log("relations==="); console.log(relations); + console.log("joinActive==="); + console.log(joinActive); + return ( {getTranslation("Join markups")} @@ -37,14 +57,21 @@ const JoinMarkupsModal = ({ perspectiveId, mode, relations, onClose }) => { - {getTranslation("Left text")} + + {getTranslation("Left text")}: {firstTextRelation} + {relations.map(relation => { return ( - Left text + setFirstTextRelation(relation.id)} + className={(relation.id === firstTextRelation && "selected-text-relation") || ""} + > + Left text Left text Left text Left text Left text + ); })} @@ -56,14 +83,21 @@ const JoinMarkupsModal = ({ perspectiveId, mode, relations, onClose }) => {
- {getTranslation("Right text")} + + {getTranslation("Right text")}: {secondTextRelation} + {relations.map(relation => { return ( - Right text + setSecondTextRelation(relation.id)} + className={(relation.id === secondTextRelation && "selected-text-relation") || ""} + > + Right text Right text Right text Right text + ); })} @@ -112,15 +146,17 @@ const JoinMarkupsModal = ({ perspectiveId, mode, relations, onClose }) => {