-
-
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.
MBS-12622: Show if URL has pending edits in links editor
If a URL is being edited, we should indicate it in the links editor. This way it is possible to find out that, say, the URL you are adding or changing the relationship for is actually going to change soon, otherwise making your changes have unexpected consequences.
- Loading branch information
1 parent
6f992e1
commit 796a3d2
Showing
3 changed files
with
61 additions
and
26 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; |
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