-
-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
MBS-12622: Show if URL / URL relationship has pending edits in links editor
- Loading branch information
Showing
5 changed files
with
171 additions
and
63 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
root/static/scripts/edit/components/EntityPendingEditsWarning.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* @flow strict-local | ||
* Copyright (C) 2023 MetaBrainz Foundation | ||
* | ||
* This file is part of MusicBrainz, the open internet music database, | ||
* and is licensed under the GPL version 2, or (at your option) any | ||
* later version: http://www.gnu.org/licenses/gpl-2.0.txt | ||
*/ | ||
|
||
import * as React from 'react'; | ||
|
||
import openEditsForEntityIconUrl | ||
from '../../../images/icons/open_edits_for_entity.svg'; | ||
import entityHref from '../../common/utility/entityHref.js'; | ||
|
||
import Tooltip from './Tooltip.js'; | ||
|
||
type PropsT = { | ||
+entity: RelatableEntityT, | ||
}; | ||
|
||
const EntityPendingEditsWarning = ({ | ||
entity, | ||
}: PropsT): React$Element<typeof React.Fragment> | null => { | ||
const hasPendingEdits = Boolean(entity.editsPending); | ||
const openEditsLink = entityHref(entity, '/open_edits'); | ||
|
||
return hasPendingEdits && nonEmpty(openEditsLink) ? ( | ||
<> | ||
{' '} | ||
<Tooltip | ||
content={exp.l( | ||
'This entity has {edits_link|pending edits}.', | ||
{edits_link: openEditsLink}, | ||
)} | ||
target={ | ||
<img | ||
alt={l('This entity has pending edits.')} | ||
className="info" | ||
height={16} | ||
src={openEditsForEntityIconUrl} | ||
style={{verticalAlign: 'middle'}} | ||
/> | ||
} | ||
/> | ||
</> | ||
) : null; | ||
}; | ||
|
||
export default EntityPendingEditsWarning; |
57 changes: 57 additions & 0 deletions
57
root/static/scripts/edit/components/RelationshipPendingEditsWarning.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* @flow strict-local | ||
* Copyright (C) 2023 MetaBrainz Foundation | ||
* | ||
* This file is part of MusicBrainz, the open internet music database, | ||
* and is licensed under the GPL version 2, or (at your option) any | ||
* later version: http://www.gnu.org/licenses/gpl-2.0.txt | ||
*/ | ||
|
||
import * as React from 'react'; | ||
|
||
import openEditsForRelIconUrl | ||
from '../../../images/icons/open_edits_for_rel.svg'; | ||
import type { | ||
RelationshipStateT, | ||
} from '../../relationship-editor/types.js'; | ||
import getOpenEditsLink | ||
from '../../relationship-editor/utility/getOpenEditsLink.js'; | ||
import type { | ||
LinkRelationshipT, | ||
} from '../externalLinks.js'; | ||
|
||
import Tooltip from './Tooltip.js'; | ||
|
||
type PropsT = { | ||
+relationship: LinkRelationshipT | RelationshipStateT, | ||
}; | ||
|
||
const RelationshipPendingEditsWarning = ({ | ||
relationship, | ||
}: PropsT): React$Element<typeof React.Fragment> | null => { | ||
const hasPendingEdits = relationship.editsPending; | ||
const openEditsLink = getOpenEditsLink(relationship); | ||
|
||
return hasPendingEdits && nonEmpty(openEditsLink) ? ( | ||
<> | ||
{' '} | ||
<Tooltip | ||
content={exp.l( | ||
'This relationship has {edit_search|pending edits}.', | ||
{edit_search: openEditsLink}, | ||
)} | ||
target={ | ||
<img | ||
alt={l('This relationship has pending edits.')} | ||
className="info" | ||
height={16} | ||
src={openEditsForRelIconUrl} | ||
style={{verticalAlign: 'middle'}} | ||
/> | ||
} | ||
/> | ||
</> | ||
) : null; | ||
}; | ||
|
||
export default RelationshipPendingEditsWarning; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters