Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Use one handler for the Reach out link on program cards

Rafib36943a5b15e
diff --git a/apps/web/ui/partners/program-card.tsx b/apps/web/ui/partners/program-card.tsx
index dd5ae9c67b..5ba187df8e 100644
--- a/apps/web/ui/partners/program-card.tsx
+++ b/apps/web/ui/partners/program-card.tsx
@@ -26,7 +26,7 @@ import {
import NumberFlow from "@number-flow/react";
import Link from "next/link";
import { useRouter } from "next/navigation";
-import { type ReactNode } from "react";
+import { type ReactNode, type SyntheticEvent } from "react";
function RejectionTooltipRow({
icon,
@@ -244,6 +244,13 @@ function ProgramCardStatus({
return null;
}
+ // the card is a link, so stop the click from opening the program page
+ const openMessages = (e: SyntheticEvent) => {
+ e.preventDefault();
+ e.stopPropagation();
+ router.push(`/messages/${program.slug}`);
+ };
+
return (
<p>
{description}
@@ -252,17 +259,9 @@ function ProgramCardStatus({
<span
role="button"
tabIndex={0}
- onClick={(e) => {
- e.preventDefault();
- e.stopPropagation();
- router.push(`/messages/${program.slug}`);
- }}
+ onClick={openMessages}
onKeyDown={(e) => {
- if (e.key === "Enter" || e.key === " ") {
- e.preventDefault();
- e.stopPropagation();
- router.push(`/messages/${program.slug}`);
- }
+ if (e.key === "Enter" || e.key === " ") openMessages(e);
}}
className="cursor-pointer underline decoration-dotted underline-offset-2 hover:text-neutral-700"
>