Skip to content

Commit

Permalink
"Show unpublished only" button
Browse files Browse the repository at this point in the history
  • Loading branch information
vmonakhov committed Jan 14, 2025
1 parent ec0813a commit 2285085
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/api/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,8 @@ export const stringsToTranslate = [
"Show only the first translation of each word",
"Show sentences",
"Show statistics",
"Show All",
"Show Unpublished Only",
"Showing sentences",
"Sign In",
"Sign out",
Expand Down
31 changes: 22 additions & 9 deletions src/components/PerspectiveView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,8 @@ class P extends React.Component {
sortingField,
limit,
offset,
changePage
changePage,
onUnpublishedOnly
} = this.props;

const query_args = {
Expand Down Expand Up @@ -661,13 +662,21 @@ class P extends React.Component {
/>
)}
{mode === "publish" && isAuthenticated && (
<Button
icon={<i className="lingvo-icon lingvo-icon_check" />}
content={this.context("Publish Entities")}
disabled={approveDisableCondition(lexicalEntries)}
onClick={onApprove}
className="lingvo-button-green lingvo-perspective-button"
/>
<>
<Button
icon={<i className="lingvo-icon lingvo-icon_check" />}
content={this.context("Publish Entities")}
disabled={approveDisableCondition(lexicalEntries)}
onClick={onApprove}
className="lingvo-button-green lingvo-perspective-button"
/>
<Button
content={entitiesMode !== "unpublished" ? this.context("Show Unpublished Only") : this.context("Show All")}
disabled={!entriesTotal}
onClick={onUnpublishedOnly}
className="lingvo-button-lite-violet lingvo-perspective-button"
/>
</>
)}
{mode === "contributions" && isAuthenticated && (
<Button
Expand Down Expand Up @@ -1054,6 +1063,9 @@ export const LexicalEntryByIds = compose(

const PerspectiveViewWrapper = ({ id, className, mode, entitiesMode, page, data,
filter, sortByField, isCaseSens, isRegexp, changePage }) => {

const [unpublishedOnly, setUnpublishedOnly] = useState(false);

if (data.error) {
return null;
}
Expand Down Expand Up @@ -1087,7 +1099,7 @@ const PerspectiveViewWrapper = ({ id, className, mode, entitiesMode, page, data,
id={id}
className={className}
mode={mode}
entitiesMode={entitiesMode}
entitiesMode={mode==="publish" && unpublishedOnly ? "unpublished" : entitiesMode}
page={page}
limit={ROWS_PER_PAGE}
offset={ROWS_PER_PAGE * (page - 1)}
Expand All @@ -1098,6 +1110,7 @@ const PerspectiveViewWrapper = ({ id, className, mode, entitiesMode, page, data,
columns={columns}
reRender={reRender}
changePage={changePage}
onUnpublishedOnly={() => setUnpublishedOnly(!unpublishedOnly)}
/>
);
};
Expand Down

0 comments on commit 2285085

Please sign in to comment.