Skip to content

Commit 223a8ad

Browse files
authored
preventDefault on Contact onClick only when $crisp is there (#1795)
1 parent 3e6147b commit 223a8ad

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

.changeset/cuddly-shoes-crash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@theguild/components': patch
3+
---
4+
5+
Call event.preventDefault on Contact onClick only if $crisp is there

packages/components/src/components/get-your-api-game-right-section.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ export function GetYourAPIGameRightSection({ className }: { className?: string }
2828
variant="tertiary"
2929
href="https://the-guild.dev/contact"
3030
onClick={event => {
31-
window.$crisp?.push(['do', 'chat:open']);
32-
event.preventDefault();
31+
if (window.$crisp) {
32+
window.$crisp.push(['do', 'chat:open']);
33+
event.preventDefault();
34+
}
3335
}}
3436
>
3537
Talk to us

packages/components/src/components/hive-footer.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ export function HiveFooter({
5959
className="hive-focus -m-2 rounded p-2 font-medium hover:text-blue-700 hover:underline dark:hover:text-blue-100"
6060
href="https://the-guild.dev/contact"
6161
onClick={event => {
62-
window.$crisp?.push(['do', 'chat:open']);
63-
event.preventDefault();
62+
if (window.$crisp) {
63+
window.$crisp.push(['do', 'chat:open']);
64+
event.preventDefault();
65+
}
6466
}}
6567
>
6668
Contact Us

packages/components/src/components/hive-navigation/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,10 @@ export function HiveNavigation({
165165
target="_blank"
166166
rel="noopener noreferrer"
167167
onClick={event => {
168-
window.$crisp?.push(['do', 'chat:open']);
169-
event.preventDefault();
168+
if (window.$crisp) {
169+
window.$crisp.push(['do', 'chat:open']);
170+
event.preventDefault();
171+
}
170172
}}
171173
>
172174
Contact <span className="hidden xl:contents">us</span>

0 commit comments

Comments
 (0)