Skip to content

Commit d10767b

Browse files
authored
Fix hp templates link (#83)
* Fix header * Update template link card
1 parent 29f6961 commit d10767b

File tree

4 files changed

+36
-19
lines changed

4 files changed

+36
-19
lines changed

src/app/_components/TemplateCard/TemplateButton.tsx

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,27 @@ interface TemplateButtonProps {
2929
template: HomepageData["templates"][0];
3030
}
3131

32+
export const handleClickTemplate = (
33+
createUrl: string,
34+
template: TemplateButtonProps["template"]
35+
) => {
36+
trackClientJourneyEvent("ai_interest_shown", {
37+
page: window.location.pathname,
38+
source: "template_gallery",
39+
template_id: template.id,
40+
template_name: template.name,
41+
template_type: template.type,
42+
});
43+
44+
setTimeout(() => {
45+
window.location.href = createUrl;
46+
}, 100);
47+
};
48+
3249
export function TemplateButton({ createUrl, template }: TemplateButtonProps) {
33-
const handleClick = () => {
34-
trackClientJourneyEvent("ai_interest_shown", {
35-
page: window.location.pathname,
36-
source: "template_gallery",
37-
template_id: template.id,
38-
template_name: template.name,
39-
template_type: template.type,
40-
});
41-
42-
setTimeout(() => {
43-
window.location.href = createUrl;
44-
}, 100);
50+
const handleClick = (ev: React.MouseEvent<HTMLButtonElement>) => {
51+
ev.stopPropagation();
52+
handleClickTemplate(createUrl, template);
4553
};
4654

4755
return (

src/app/_components/TemplateCard/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from "react";
22
import { getTemplatePreviewUrl, getTemplateCreateUrl } from "@/lib/grapes-api";
33
import type { HomepageData } from "@/lib/grapes-api";
44
import styles from "./styles.module.css";
5-
import { TemplateButton } from "./TemplateButton";
5+
import { handleClickTemplate, TemplateButton } from "./TemplateButton";
66

77
interface TemplateCardProps {
88
template: HomepageData["templates"][0];
@@ -14,7 +14,10 @@ export function TemplateCard({ template }: TemplateCardProps) {
1414
const createUrl = getTemplateCreateUrl(template.editorUrl);
1515

1616
return (
17-
<div className={styles.templateCard}>
17+
<div
18+
className={styles.templateCard}
19+
onClick={() => handleClickTemplate(createUrl, template)}
20+
>
1821
<div className={styles.preview}>
1922
<img
2023
src={previewUrl}

src/app/ai/header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default function HeaderStandalone({ className }: HeaderStandaloneProps) {
6161
<img
6262
src="https://cdn.grapesjs.com/workspaces/cmddyhbh105af12ivgiyr7vui/assets/57483344-a73e-4e1f-abb2-f2df8058ef62__grapesblackandwhite.png"
6363
alt="Grapes Studio"
64-
className="w-[150px] md:w-[200px]"
64+
className="w-[150px] h-[40px] md:w-[200px] md:h-[53px]"
6565
/>
6666
</a>
6767
</div>

src/app/layout.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,12 @@ export default function RootLayout({
6363
})`,
6464
}}
6565
/>
66-
<script id="rewardful-queue">
67-
{`(function(w,r){w._rwq=r;w[r]=w[r]||function(){(w[r].q=w[r].q||[]).push(arguments)}})(window,'rewardful');`}
68-
</script>
66+
<script
67+
id="rewardful-queue"
68+
dangerouslySetInnerHTML={{
69+
__html: `(function(w,r){w._rwq=r;w[r]=w[r]||function(){(w[r].q=w[r].q||[]).push(arguments)}})(window,'rewardful');`,
70+
}}
71+
/>
6972
<script src="https://r.wdfl.co/rw.js" data-rewardful="9302d5" />
7073
{/*
7174
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png"/>
@@ -77,7 +80,10 @@ export default function RootLayout({
7780
<link rel="alternate" type="application/rss+xml" href="/feed.xml" />
7881
*/}
7982
</head>
80-
<body className={cn(inter.className, manrope.className)}>
83+
<body
84+
suppressHydrationWarning
85+
className={cn(inter.className, manrope.className)}
86+
>
8187
<noscript>
8288
<iframe
8389
src="https://www.googletagmanager.com/ns.html?id=GTM-N6SVS9RS"

0 commit comments

Comments
 (0)