Skip to content

Commit

Permalink
MBS-13804: Show review links as such on sidebar
Browse files Browse the repository at this point in the history
Similarly as with blog and homepage, this shows all review rels
as such regardless of what the URL is, rather than showing, say, YouTube
links as "Play on YouTube".
  • Loading branch information
reosarevok committed Nov 7, 2024
1 parent 940c3a0 commit 0a17108
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
11 changes: 11 additions & 0 deletions root/layout/components/ExternalLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ component ExternalLinks(
url={target}
/>,
);
} else if (/^review$/.test(linkType.name)) {
blogLinks.push(
<ExternalLink
className="review-favicon"
editsPending={relationship.editsPending}
entityCredit={entityCredit}
key={relationship.id}
text={l('Review')}
url={target}
/>,
);
} else if (target.show_in_external_links /*:: === true */) {
otherLinks.push({
editsPending: relationship.editsPending,
Expand Down
1 change: 1 addition & 0 deletions root/static/images/attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Images:

external-favicons/home-32.png (original: https://www.iconfinder.com/icons/42257/about_icon)
external-favicons/blog-32.png (original: https://www.iconfinder.com/icons/42282/notepad_icon)
external-favicons/review-32.png (original: https://www.iconfinder.com/icons/42347/line_spechbubble_sq_icon)

----------------------------------------------------------------------------

Expand Down
Binary file added root/static/images/external-favicons/review.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion root/static/scripts/edit/externalLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,20 @@ export class ExternalLink extends React.Component<LinkProps> {
if (isBlog) {
faviconClass = 'blog';
} else {
faviconClass = 'no';
const isReview = props.relationships.some(link => {
const linkType = link.type
? linkedEntities.link_type[link.type]
: null;
if (linkType) {
return /^review$/.test(linkType.name);
}
return false;
});
if (isReview) {
faviconClass = 'review';
} else {
faviconClass = 'no';
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions root/static/styles/favicons.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

.favicon("home", 32);
.favicon("blog", 32);
.favicon("review", 32);

.favicon("allmusic");
.favicon("amazon", 32);
Expand Down

0 comments on commit 0a17108

Please sign in to comment.