Skip to content

Commit

Permalink
MBS-12942: Also indicate if target has pending edits in rels editor
Browse files Browse the repository at this point in the history
We were already showing if the relationship itself has pending edits,
but not if the target entity has them (which the old relationship editor
used to indicate with a highlight).
Aerozol made us a nice icon to use for this, and I think
it's quite useful to have it and link to the entity's open edits page.
  • Loading branch information
reosarevok committed Mar 15, 2023
1 parent 445a74b commit 183beaf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions root/static/images/icons/open_edits_for_entity.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
import * as React from 'react';
import * as tree from 'weight-balanced-tree';

import openEditsForEntityIconUrl
from '../../../images/icons/open_edits_for_entity.svg';
import openEditsForRelIconUrl
from '../../../images/icons/open_edits_for_rel.svg';
import ButtonPopover from '../../common/components/ButtonPopover.js';
import DescriptiveLink from '../../common/components/DescriptiveLink.js';
import {bracketedText} from '../../common/utility/bracketed.js';
import {displayLinkAttributesText}
from '../../common/utility/displayLinkAttribute.js';
import entityHref from '../../common/utility/entityHref.js';
import {
performReactUpdateAndMaintainFocus,
} from '../../common/utility/focusManagement.js';
Expand Down Expand Up @@ -80,7 +83,8 @@ const RelationshipItem = (React.memo<PropsT>(({
const [sourceCredit, targetCredit] = backward
? [relationship.entity1_credit, relationship.entity0_credit]
: [relationship.entity0_credit, relationship.entity1_credit];
const hasPendingEdits = relationship.editsPending;
const relHasPendingEdits = relationship.editsPending;
const targetHasPendingEdits = Boolean(target.editsPending);
const openEditsLink = getOpenEditsLink(relationship);
const isRemoved = relationship._status === REL_STATUS_REMOVE;
const removeButtonId =
Expand Down Expand Up @@ -280,7 +284,27 @@ const RelationshipItem = (React.memo<PropsT>(({
})
)
: targetDisplay}
{hasPendingEdits && nonEmpty(openEditsLink) ? (
{targetHasPendingEdits ? (
<>
{' '}
<Tooltip
content={exp.l(
'This entity has {edits_link|pending edits}.',
{edits_link: entityHref(target, '/open_edits')},
)}
target={
<img
alt={l('This entity has pending edits.')}
className="info"
height={16}
src={openEditsForEntityIconUrl}
style={{verticalAlign: 'middle'}}
/>
}
/>
</>
) : null}
{relHasPendingEdits && nonEmpty(openEditsLink) ? (
<>
{' '}
<Tooltip
Expand All @@ -295,7 +319,6 @@ const RelationshipItem = (React.memo<PropsT>(({
height={16}
src={openEditsForRelIconUrl}
style={{verticalAlign: 'middle'}}
width={16}
/>
}
/>
Expand Down

0 comments on commit 183beaf

Please sign in to comment.