Skip to content

Commit

Permalink
Merge pull request #1064 from nataliauvarova/parallel_corpora
Browse files Browse the repository at this point in the history
remove trash comments (part)
  • Loading branch information
nataliauvarova authored Nov 15, 2023
2 parents 1438244 + 9c9ca2a commit 1360db5
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 54 deletions.
9 changes: 0 additions & 9 deletions src/components/CorporaView/Row.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ const Row = ({
/* eslint-enable react/prop-types */
}) => {

/* new!!!!!! */

const ref = useRef(null);

// useDrag - the list item is draggable
Expand Down Expand Up @@ -186,8 +184,6 @@ const Row = ({

const dragDropRef = dragRef(dropRef(ref));

/* /new!!!!!! */

const entry_id_str = id2str(entry.id);

const [ disabled, setDisabled ] = useState(false);
Expand All @@ -198,15 +194,13 @@ const Row = ({

return (
<tr style={isDragging ? { opacity: "0" } : (disabled_flag ? { opacity: "0.5" } : {})} ref={preview} id={id} data-handler-id={handlerId}>
{/* new!!!!! */}
<Table.Cell className={(dnd_enabled && (mode === "edit")) ? "lingvo-dnd-column" : "lingvo-dnd-column lingvo-dnd-column_hidden"}>
<div ref={dragDropRef}>
<Button.Group basic className="lingvo-buttons-group">
<Button icon={<i className="lingvo-icon lingvo-icon_dnd" />} />
</Button.Group>
</div>
</Table.Cell>
{/* /new!!!!! */}
{selectEntries && (
<Table.Cell>
{!remove_selection_flag && (
Expand Down Expand Up @@ -258,7 +252,6 @@ const Row = ({
disabled={disabled_flag}
reRender={reRender}
number={number}
/*index={index}*/ /* new!!!!! */
/>
))}

Expand Down Expand Up @@ -352,7 +345,5 @@ export default onlyUpdateForKeys([
"id", /* ????? new!!!!! */
"index", /* ????? new!!!!! */
"dnd_enabled", /* ???????? new!!!!! */

/*"moveListItem",*/ /* new!!!!! */
"entries" /* new!!!!! */
])(Row);
23 changes: 1 addition & 22 deletions src/components/CorporaView/TableBody.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useCallback, useState } from "react";
import React from "react";
import { Table } from "semantic-ui-react";
/*import update from 'immutability-helper';*/
import PropTypes from "prop-types";
import { onlyUpdateForKeys } from "recompose";

Expand All @@ -10,35 +9,16 @@ const TableBody = ({ entries, ...rest }) => {

console.log('Render Entries!!!');

/*
const [cards, setCards] = useState(entries);
const moveListItem = useCallback((dragIndex, hoverIndex) => {
console.log('!!!!!!!!!!!!moveListItem!!!!!!!!!!!!!!');
setCards((prevCards) =>
update(prevCards, {
$splice: [
[dragIndex, 1],
[hoverIndex, 0, prevCards[dragIndex]],
],
}),
);
}, []);
*/

return (
<Table.Body>
{entries.map((entry, index) => (
/*{cards.map((entry, index) => (*/
<Row
entries={entries}
/*entries={cards}*/
key={entry.id}
index={index}
id={entry.id}
entry={entry}
number={(index + 1).toString()}
/*moveListItem={moveListItem}*/
{...rest}
/>
))}
Expand Down Expand Up @@ -66,7 +46,6 @@ TableBody.propTypes = {
resetCheckedColumn: PropTypes.func,
resetCheckedAll: PropTypes.func,
reRender: PropTypes.func,
/*dragAndDropEntries: PropTypes.func*/ /* new!!!!! */
};

TableBody.defaultProps = {
Expand Down
8 changes: 4 additions & 4 deletions src/components/CorporaView/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const TableHeader = ({
/* eslint-enable react/prop-types */
onSortModeChange,
onSortModeReset,
dnd_enabled, /* new!!!!!! */
mode /* new!!!!!!! */
dnd_enabled,
mode
}) => {
const getTranslation = useContext(TranslationContext);

Expand Down Expand Up @@ -104,7 +104,7 @@ TableHeader.propTypes = {
onCheckColumn: PropTypes.func,
onCheckAll: PropTypes.func,
dnd_enabled: PropTypes.bool,
mode: PropTypes.string.isRequired /* new!!!!!! */
mode: PropTypes.string.isRequired
};

TableHeader.defaultProps = {
Expand All @@ -119,4 +119,4 @@ TableHeader.defaultProps = {
onCheckAll: () => {}
};

export default onlyUpdateForKeys(["columns", "entries", "selectedRows", "selectedColumns", "dnd_enabled", /* ???????? new!!!!! */ "mode" /* new!!!!! */])(TableHeader);
export default onlyUpdateForKeys(["columns", "entries", "selectedRows", "selectedColumns", "dnd_enabled", "mode"])(TableHeader);
13 changes: 4 additions & 9 deletions src/components/LexicalEntryCorp/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ const TextEntityContent = ({
const [read_only, setReadOnly] = useState(is_order_column);
const [is_number, setIsNumber] = useState(is_order_column);

/* new!!!!!! */
const [dropped, setDropped] = useState(null);
/* /new!!!!!! */

const onEdit = useCallback(() => {
if (!edit) {
Expand All @@ -53,8 +51,6 @@ const TextEntityContent = ({
}
}, [edit, content]);

/* new!!!!! */

const onKeyDown = useCallback((event) => {

breakdown(event, parentEntity, entity);
Expand All @@ -79,7 +75,6 @@ const TextEntityContent = ({
}
});

/* /new!!!!! */
const text = is_number ? number : entity.content;

if (checkEntries) {
Expand Down Expand Up @@ -385,8 +380,8 @@ const Edit = ({
onSave,
onCancel,
is_being_created,
parentEntity, /* new!!!!!! */
breakdown /* new!!!!! */
parentEntity,
breakdown
}) => {

const [content, setContent] = useState("");
Expand Down Expand Up @@ -445,8 +440,8 @@ const Edit = ({
Edit.propTypes = {
onSave: PropTypes.func,
onCancel: PropTypes.func,
parentEntity: PropTypes.object, /* new!!!!!! */
breakdown: PropTypes.func /* new!!!!! */
parentEntity: PropTypes.object,
breakdown: PropTypes.func
};

Edit.defaultProps = {
Expand Down
7 changes: 0 additions & 7 deletions src/components/LexicalEntryCorp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ const lexicalEntryQuery = gql`
}
`;

/* new!!!!!! */
const getSelectionStart = (o) => {
if (o.createTextRange) {
const r = document.selection.createRange().duplicate();
Expand All @@ -122,7 +121,6 @@ const getSelectionEnd = (o) => {
return o.selectionEnd;
}
};
/* /new!!!!!! */

const getComponent = dataType =>
({
Expand Down Expand Up @@ -175,20 +173,16 @@ const Entities = ({

const getTranslation = useContext(TranslationContext);

/* new!!!!! */
const [{ isOver }, dropRef] = useDrop({
accept: 'entity',
drop: (item) => {
/*console.log('useDrop: item====');
console.log(item);*/
remove(item);
create(item.content, parentEntity == null ? null : parentEntity.id);
},
collect: (monitor) => ({
isOver: monitor.isOver()
})
});
/* /new!!!!! */

const update_check = useCallback(() => {
/* Checking if we need to manually update perspective data. */
Expand Down Expand Up @@ -394,7 +388,6 @@ const Entities = ({

delete remove_set2[entity_id_str];
setRemoveSet(remove_set2);
/*console.log('after remove!!!!!');*/

update_check();
});
Expand Down
6 changes: 3 additions & 3 deletions src/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4009,7 +4009,7 @@ body {
}
}

/* new!!!!! */
/* textarea */
&_textarea {
border-radius: 10px !important;
font-family: Rubik, Arial, sans-serif !important;
Expand All @@ -4028,7 +4028,7 @@ body {
outline: none !important;
box-shadow: none !important;

overflow: hidden !important; /* ???????? */
overflow: hidden !important;

&:focus {
border: 1px solid #5d54cd !important;
Expand All @@ -4041,7 +4041,7 @@ body {
}

}
/* /new!!!!! */
/* /textarea */

}
/* /lingvo input action */
Expand Down

0 comments on commit 1360db5

Please sign in to comment.