Skip to content

Commit

Permalink
MBS-13804: Also show where the review is on sidebar
Browse files Browse the repository at this point in the history
For reviews, it can be annoying to have just a "Review" link with no info
about what kind of review it is and have to hover in order to find out.
This shows the hostname of the review URL on the sidebar, so that
the user can decide based on that what review(s) they are interested in.
I remove www. because it doesn't seem to add anything of value
and takes sidebar space.
  • Loading branch information
reosarevok committed Jan 10, 2025
1 parent 9bdf62d commit 2f5895f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion root/layout/components/ExternalLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ component ExternalLinks(
for (let i = 0; i < relationships.length; i++) {
const relationship = relationships[i];
const target = relationship.target;
console.log(target);
const entityCredit = entity.id === relationship.entity0_id
? relationship.entity0_credit
: relationship.entity1_credit;
Expand Down Expand Up @@ -120,13 +121,19 @@ component ExternalLinks(
/>,
);
} else if (linkType.name === 'review') {
const urlObject = new URL(target.name);
const hostName = urlObject.host.replace('www.', '');

blogsAndReviews.push(
<ExternalLink
className="review-favicon"
editsPending={relationship.editsPending}
entityCredit={entityCredit}
key={relationship.id}
text={l('Review')}
text={texp.l(
'Review ({hostname})',
{hostname: hostName},
)}
url={target}
/>,
);
Expand Down

0 comments on commit 2f5895f

Please sign in to comment.