Skip to content

Commit

Permalink
SUPP0RT-1256: Updated poster to display only url domain
Browse files Browse the repository at this point in the history
  • Loading branch information
jekuaitk committed Oct 9, 2023
1 parent dd3fefd commit 7fe0079
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build/poster.js

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions src/poster/poster.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,15 @@ function Poster({ slide, content, run, slideDone, executionId }) {
return capitalize(dayjs(date).locale(localeDa).format("DD MMMM"));
};

const trimUrl = (urlToTrim) =>
urlToTrim.replace(/^(https?:\/\/)?(www.)?/i, "");
const getUrlDomain = (urlString) => {
return (
urlString
// Remove scheme
.replace(/^[^:]*:\/\//, "")
// Remove paths
.replace(/\/.*$/, "")
);
};

// Setup feed entry switch and animation, if there is more than one post.
useEffect(() => {
Expand Down Expand Up @@ -215,7 +222,7 @@ function Poster({ slide, content, run, slideDone, executionId }) {
<>
{readMoreText && <p className="moreinfo">{readMoreText}</p>}
{!overrideReadMoreUrl && url && (
<span className="look-like-link">{trimUrl(url)}</span>
<span className="look-like-link">{getUrlDomain(url)}</span>
)}
{overrideReadMoreUrl && (
<span className="look-like-link">{overrideReadMoreUrl}</span>
Expand Down

0 comments on commit 7fe0079

Please sign in to comment.