Skip to content

Commit

Permalink
Merge pull request #1052 from nataliauvarova/parallel_corpora
Browse files Browse the repository at this point in the history
dnd_enabled
  • Loading branch information
nataliauvarova authored Nov 1, 2023
2 parents dab0a05 + e13bdda commit 6aa6740
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/components/CorporaView/Row.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const Row = ({
id, /* new!!!!! */
moveListItem, /* new!!!!! */
dragAndDropEntries, /* new!!!!! */
dnd_enabled, /* new!!!!!! */
entries /* new!!!!! */
/* eslint-enable react/prop-types */
}) => {
Expand Down Expand Up @@ -151,7 +152,7 @@ const Row = ({
return (
<tr style={isDragging ? { opacity: "0" } : (disabled_flag ? { opacity: "0.5" } : {})} ref={preview} id={id} data-handler-id={handlerId}>
{/* new!!!!! */}
<Table.Cell style={(mode === "edit") ? {} : { display: "none" }}>
<Table.Cell style={(dnd_enabled && (mode === "edit")) ? {} : { display: "none" }}>
<div ref={dragDropRef}>
<Button.Group basic className="lingvo-buttons-group">
<Button icon={<i className="lingvo-icon lingvo-icon_dnd" />} />
Expand Down Expand Up @@ -269,6 +270,7 @@ Row.propTypes = {
index: PropTypes.number, /* ????? new!!!!! */
moveListItem: PropTypes.func, /* new!!!!! */
dragAndDropEntries: PropTypes.func, /* new!!!!! */
dnd_enabled: PropTypes.bool, /* new!!!!! */
entries: PropTypes.array, /* new!!!!! */
};

Expand Down Expand Up @@ -302,6 +304,7 @@ export default onlyUpdateForKeys([
"number",
"id", /* ????? new!!!!! */
"index", /* ????? new!!!!! */
"dnd_enabled", /* ???????? new!!!!! */
/*"moveListItem",*/ /* new!!!!! */
"entries" /* new!!!!! */
])(Row);
6 changes: 4 additions & 2 deletions src/components/CorporaView/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const TableHeader = ({
/* eslint-enable react/prop-types */
onSortModeChange,
onSortModeReset,
dnd_enabled, /* new!!!!!! */
mode /* new!!!!!!! */
}) => {
const getTranslation = useContext(TranslationContext);
Expand All @@ -40,7 +41,7 @@ const TableHeader = ({
<Table.Header style={disabled ? { opacity: "0.5" } : {}}>
<Table.Row>
{/* new!!!!! */}
<Table.HeaderCell className="entityHeader" style={(mode === "edit") ? {} : { display: "none" }}>
<Table.HeaderCell className="entityHeader" style={(dnd_enabled && mode === "edit") ? {} : { display: "none" }}>
&nbsp;
</Table.HeaderCell>
{/* /new!!!!! */}
Expand Down Expand Up @@ -104,6 +105,7 @@ TableHeader.propTypes = {
selectedColumns: PropTypes.array,
onCheckColumn: PropTypes.func,
onCheckAll: PropTypes.func,
dnd_enabled: PropTypes.bool,
mode: PropTypes.string.isRequired /* new!!!!!! */
};

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

export default onlyUpdateForKeys(["columns", "entries", "selectedRows", "selectedColumns", "mode" /* new!!!!! */])(TableHeader);
export default onlyUpdateForKeys(["columns", "entries", "selectedRows", "selectedColumns", "dnd_enabled", /* ???????? new!!!!! */ "mode" /* new!!!!! */])(TableHeader);
10 changes: 6 additions & 4 deletions src/components/CorporaView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Button, Dimmer, Header, Icon, Table } from "semantic-ui-react";
import { gql } from "@apollo/client";
import { graphql } from "@apollo/client/react/hoc";
import update from 'immutability-helper';
import { drop, flow, isEqual, reverse, take, sortBy } from "lodash";
import { drop, flow, isEqual, reverse, sortBy, take } from "lodash";
import PropTypes from "prop-types";
import { branch, compose, renderComponent } from "recompose";
import { bindActionCreators } from "redux";
Expand Down Expand Up @@ -717,11 +717,11 @@ class P extends React.Component {
// sort by 'Order' column or no sorting required
if (!sortByField) {
if (lexgraph_field_id)
[ field, order ] = [ lexgraph_field_id, "a" ];
{[ field, order ] = [ lexgraph_field_id, "a" ];}
else
return es;
{return es;}
}
else ({ field, order } = sortByField);
else {({ field, order } = sortByField);}

if (!field) {
field = lexgraph_field_id ? lexgraph_field_id : [66, 10];
Expand Down Expand Up @@ -1026,6 +1026,7 @@ class P extends React.Component {
onCheckColumn={this.onCheckColumn}
onCheckAll={this.onCheckAll}
mode={mode} /* new!!!!! */
dnd_enabled={this.state.dnd_enabled} /* new!!!!! */
/>
<TableBody
perspectiveId={id}
Expand All @@ -1050,6 +1051,7 @@ class P extends React.Component {
reRender={reRender}
moveListItem={moveListItem} /* new!!!!!! */
dragAndDropEntries={dragAndDropEntries} /* new!!!!! */
dnd_enabled={this.state.dnd_enabled} /* new!!!!! */
/>
</Table>
{/* new!!!!! */}
Expand Down

0 comments on commit 6aa6740

Please sign in to comment.