Skip to content

Commit

Permalink
fix: remove restoreRowFromArchive from unlockBar
Browse files Browse the repository at this point in the history
  • Loading branch information
smnhgn authored and hermann-p committed Jun 18, 2024
1 parent 1a9a894 commit 141162e
Showing 1 changed file with 18 additions and 27 deletions.
45 changes: 18 additions & 27 deletions src/app/components/overlay/EntityView/EntityViewBody.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ import {
import { addCellId } from "../../../helpers/getCellId";
import { doto, ifElse, maybe, merge } from "../../../helpers/functools";
import { getLanguageOrCountryIcon } from "../../../helpers/multiLanguage";
import {
isLocked,
setRowArchived,
unlockRow
} from "../../../helpers/annotationHelper";
import { isLocked, unlockRow } from "../../../helpers/annotationHelper";
import KeyboardShortcutsHelper from "../../../helpers/KeyboardShortcutsHelper";
import TranslationPopup from "../../entityView/TranslationPopup";

Expand Down Expand Up @@ -297,36 +293,31 @@ class EntityViewBody extends Component {
this.forceUpdate();
};

restoreRowFromArchive = () => {
const { table, row } = this.props;
setRowArchived({ table, row, archived: false });
};

renderUnlockBar = row => {
const buttonClass = classNames("button", { shake: this.state.shaking });
const rowIsArchived = isRowArchived(row);
const rowIsLocked = isLocked(row);
const unlock = rowIsArchived
? this.restoreRowFromArchive
: this.unlockRowTemporary;
const unlock = this.unlockRowTemporary;
const barTitle = rowIsArchived
? "table:archived.is-archived"
: "table:row-is-locked";
const buttonAction = rowIsArchived
? "table:archived.unset-archived"
: "table:unlock-row";

return rowIsArchived || rowIsLocked ? (
<div className="unlock-bar">
<div className="text">
<i className="fa fa-lock" />
<span>{i18n.t(barTitle)}</span>
const buttonAction = "table:unlock-row";

return (
(rowIsArchived || rowIsLocked) && (
<div className="unlock-bar">
<div className="text">
<i className="fa fa-lock" />
<span>{i18n.t(barTitle)}</span>
</div>
{!rowIsArchived && rowIsLocked && (
<button className={buttonClass} onClick={unlock}>
{i18n.t(buttonAction)}
</button>
)}
</div>
<button className={buttonClass} onClick={unlock}>
{i18n.t(buttonAction)}
</button>
</div>
) : null;
)
);
};

// (filterColumn?: groupColumn, cells: cell[]) -> (cell) -> boolean
Expand Down

0 comments on commit 141162e

Please sign in to comment.