in website/src/components/gallery/ShowcaseCard/index.tsx [124:181]
function ShowcaseCard({ user }: { user: User }) {
// Function to determine if the URL contains a specific tracking parameter
function urlContainsParameter(url, parameter) {
return url.includes(parameter);
}
// Determine the URL to use
let urlToUse = user.source;
// Check if the URL contains the tracking parameter "?ocid=biafy25h1_communitygallery_webpage_azuremktg"
if (!urlContainsParameter(urlToUse, '?ocid=biafy25h1_communitygallery_webpage_azuremktg')) {
// If the tracking parameter "?ocid=biafy25h1_communitygallery_webpage_azuremktg" is not present, append "?ocid=biafy25h1_communitygallery_webpage_azuremktg"
const trackingParameter = '?ocid=biafy25h1_communitygallery_webpage_azuremktg';
// Check if the URL already has query parameters
if (urlToUse.includes('?')) {
// URL already has parameters, use '&' to append the new parameter
urlToUse += `&ocid=biafy25h1_communitygallery_webpage_azuremktg`;
} else {
// URL does not have any parameters, use '?' to append the new parameter
urlToUse += trackingParameter;
}
}
// Return the card with the determined URL
return (
<li key={user.title} className="card">
<Link
className="card-link"
to={urlToUse}
target="_blank"
rel="noopener noreferrer"
data-bi-area="BodyGrid"
data-bi-name={user.title}
>
{/* Image goes here */}
{/* <div className={clsx('card__image', styles.showcaseCardImage)}>
<Image img={user.preview} alt={user.title} />
</div> */}
<div className="card__body">
<div>
<h3>{user.title}</h3>
{user.source && <ShowcaseMultipleAuthorsDropdown user={user} />}
</div>
<p>{user.description}</p>
{/* {user.tags.includes('featured') && (
<FavoriteIcon svgClass={styles.svgIconFavorite} size="small" />
)} */}
</div>
<div className={clsx('card__footer', styles.cardFooter)}>
<div className="margin-bottom--md">
<ShowcaseCardTag tags={user.tags} />
</div>
</div>
</Link>
</li>
);
}