Skip to content

Commit

Permalink
kalmyk markup: part
Browse files Browse the repository at this point in the history
  • Loading branch information
nataliauvarova committed Dec 3, 2024
1 parent 07b831c commit 5176cd4
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 11 deletions.
52 changes: 44 additions & 8 deletions src/components/JoinMarkupsModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -25,6 +42,9 @@ const JoinMarkupsModal = ({ perspectiveId, mode, relations, onClose }) => {
console.log("relations===");
console.log(relations);

console.log("joinActive===");
console.log(joinActive);

return (
<Modal className="lingvo-modal2" dimmer open closeIcon onClose={onClose} size="fullscreen">
<Modal.Header>{getTranslation("Join markups")}</Modal.Header>
Expand All @@ -37,14 +57,21 @@ const JoinMarkupsModal = ({ perspectiveId, mode, relations, onClose }) => {
<Table celled padded className="lingvo-perspective-table">
<Table.Header>
<Table.Row>
<Table.HeaderCell>{getTranslation("Left text")}</Table.HeaderCell>
<Table.HeaderCell>
{getTranslation("Left text")}: {firstTextRelation}
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
{relations.map(relation => {
return (
<Table.Row key={relation.id}>
<Table.Cell>Left text</Table.Cell>
<Table.Cell
onClick={e => setFirstTextRelation(relation.id)}
className={(relation.id === firstTextRelation && "selected-text-relation") || ""}
>
Left text Left text Left text Left text Left text
</Table.Cell>
</Table.Row>
);
})}
Expand All @@ -56,14 +83,21 @@ const JoinMarkupsModal = ({ perspectiveId, mode, relations, onClose }) => {
<Table celled padded className="lingvo-perspective-table">
<Table.Header>
<Table.Row>
<Table.HeaderCell>{getTranslation("Right text")}</Table.HeaderCell>
<Table.HeaderCell>
{getTranslation("Right text")}: {secondTextRelation}
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
{relations.map(relation => {
return (
<Table.Row key={relation.id}>
<Table.Cell>Right text</Table.Cell>
<Table.Cell
onClick={e => setSecondTextRelation(relation.id)}
className={(relation.id === secondTextRelation && "selected-text-relation") || ""}
>
Right text Right text Right text Right text
</Table.Cell>
</Table.Row>
);
})}
Expand Down Expand Up @@ -112,15 +146,17 @@ const JoinMarkupsModal = ({ perspectiveId, mode, relations, onClose }) => {
<Button
//icon={<i className="lingvo-icon lingvo-icon_check" />}
content={getTranslation("Join")}
//onClick={onJoinMarkups}
onClick={onAddRelation}
className="lingvo-button-greenest"
disabled={!joinActive}
/>

<Button
//icon={<i className="lingvo-icon lingvo-icon_check" />}
content={getTranslation("Delete")}
//onClick={onJoinMarkups}
//onClick={onDeleteRelation}
className="lingvo-button-redder"
disabled={true}
/>
</div>
</div>
Expand Down
9 changes: 9 additions & 0 deletions src/components/JoinMarkupsModal/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
z-index: 1;
}

& .ui.table tr td {
border-radius: 8px !important;
}

& .ui.table .selected-text-relation {
background: #4e46b4 !important;
color: #fff !important;
}

&:first-of-type {
margin: 0 10px 0 0;
}
Expand Down
19 changes: 16 additions & 3 deletions src/pages/Perspective/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,11 @@
border-radius: 0 8px 8px 0 !important;
}

@media only screen and (max-device-width: 767px), only screen and (max-width: 767px) {
&:only-child {
border-radius: 8px !important;
}

@media only screen and (max-device-width: 767px), only screen and (max-width: 767px) {
&:first-child {
border-radius: 8px 8px 0 0 !important;
}
Expand All @@ -449,6 +452,10 @@
border-radius: 0 0 8px 8px !important;
}

&:only-child {
border-radius: 8px !important;
}

&:not(:last-child) {
&::after {
content: none;
Expand Down Expand Up @@ -482,6 +489,10 @@
border-radius: 0 8px 8px 0 !important;
}

& td:only-child {
border-radius: 8px !important;
}

@media only screen and (max-device-width: 767px), only screen and (max-width: 767px) {
& td:first-child {
border-radius: 8px 8px 0 0 !important;
Expand All @@ -494,6 +505,10 @@
& td:last-child {
border-radius: 0 0 8px 8px !important;
}

& td:only-child {
border-radius: 8px !important;
}
}
}

Expand Down Expand Up @@ -586,7 +601,6 @@
}

&.ui.table thead tr {

& th.lingvo-dnd-headercell {
&_hidden {
display: none !important;
Expand Down Expand Up @@ -690,7 +704,6 @@
color: #372f9d;
}
}

}
/* /lingvo perspective component text */

Expand Down

0 comments on commit 5176cd4

Please sign in to comment.