Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions src/components/seo/ProductGridCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,21 @@ export function ProductGridCard({ product }: { product: LandingProduct }) {
const isMerchantOffer =
product.href.startsWith("http://") || product.href.startsWith("https://");
const detailUrl =
product.productUrl ||
`/search?q=${encodeURIComponent(product.name)}`;
product.productUrl || `/search?q=${encodeURIComponent(product.name)}`;

function handleMerchantClick(e: React.MouseEvent) {
e.preventDefault();
e.stopPropagation();
window.open(product.href, "_blank", "noopener,noreferrer");
}

function handleMerchantKeyDown(e: React.KeyboardEvent) {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
e.stopPropagation();
window.open(product.href, "_blank", "noopener,noreferrer");
}
}

return (
<Link
Expand Down Expand Up @@ -65,15 +78,15 @@ export function ProductGridCard({ product }: { product: LandingProduct }) {
</p>
</div>
{isMerchantOffer ? (
<a
href={product.href}
target="_blank"
rel="noopener noreferrer"
onClick={(e) => e.stopPropagation()}
className="inline-flex items-center rounded-full bg-amber-700 px-3 py-1.5 text-sm font-semibold text-white shadow-sm transition-colors hover:bg-amber-800"
<span
role="button"
tabIndex={0}
onClick={handleMerchantClick}
onKeyDown={handleMerchantKeyDown}
className="inline-flex cursor-pointer items-center rounded-full bg-amber-700 px-3 py-1.5 text-sm font-semibold text-white shadow-sm transition-colors hover:bg-amber-800"
>
Buy at {product.merchant}
</a>
</span>
) : (
<span className="text-sm font-medium text-amber-700">
View details
Expand Down
11 changes: 4 additions & 7 deletions src/components/seo/SeoLandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,10 @@ function buildRefreshedLabel(config: SeoLandingPageConfig, products: LandingProd
return `Updated ${formatted}`;
}

// No live products with a timestamp — use the build/date of render.
return `Updated ${new Date().toLocaleDateString("en-US", {
month: "long",
day: "numeric",
year: "numeric",
timeZone: "UTC",
})}`;
// No live products with a timestamp — use a stable, deterministic label.
// Relying on new Date() here produces different text on the server and client,
// which triggers React hydration mismatches (Minified React error #418/#422).
return "Live prices updated regularly";
}


Expand Down