Skip to content

Commit 3c2a50f

Browse files
authored
Merge pull request #13515 from guardian/sIndicator
correct the link on the sIndicator roundel
2 parents 73b19e8 + 7f953d9 commit 3c2a50f

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

dotcom-rendering/src/client/sIndicator.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const displaySIndicatorRoundel = (
2121
const roundelElement =
2222
document.getElementById(overallRoundelElementId) ??
2323
(() => {
24-
const newElem = document.createElement('div');
24+
const newElem = document.createElement('a');
2525
newElem.id = overallRoundelElementId;
2626
document.body.appendChild(newElem);
2727
return newElem;
@@ -45,6 +45,17 @@ const displaySIndicatorRoundel = (
4545
roundelElement.style.width = '40px';
4646
roundelElement.style.height = '40px';
4747

48+
roundelElement.style.cursor = 'pointer';
49+
roundelElement.setAttribute(
50+
'href',
51+
window.location.hostname === 'localhost'
52+
? 'http://localhost:4200/sIndicator'
53+
: `https://syndication.${window.location.hostname.replace(
54+
/^(m\.|www\.)/i,
55+
'',
56+
)}/sIndicator`,
57+
);
58+
4859
switch (status) {
4960
case 'loading':
5061
roundelElement.title = 'Checking syndication status...';
@@ -66,15 +77,6 @@ const displaySIndicatorRoundel = (
6677
'There was an error checking syndication status. Click to check your CAPI key...';
6778
roundelElement.style.backgroundColor = 'yellow';
6879
roundelElement.textContent = '⚠️';
69-
roundelElement.style.cursor = 'pointer';
70-
roundelElement.addEventListener(
71-
'click',
72-
() =>
73-
(window.location.href =
74-
window.location.hostname === 'localhost'
75-
? 'http://localhost:4200/sIndicator'
76-
: `https://syndication.${window.location.hostname}/sIndicator`),
77-
);
7880
break;
7981
}
8082
};

0 commit comments

Comments
 (0)