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.

fix programEnrollment.discount

Steven Tey6d8d70559bb3
diff --git a/apps/web/app/partners.dub.co/(dashboard)/programs/[programSlug]/page-client.tsx b/apps/web/app/partners.dub.co/(dashboard)/programs/[programSlug]/page-client.tsx
index 3ddbd1a3b7..04adb27bc9 100644
--- a/apps/web/app/partners.dub.co/(dashboard)/programs/[programSlug]/page-client.tsx
+++ b/apps/web/app/partners.dub.co/(dashboard)/programs/[programSlug]/page-client.tsx
@@ -71,7 +71,7 @@ export default function ProgramPageClient() {
{program ? (
<ProgramCommissionDescription
program={program}
- discount={programEnrollment?.discount || program.discounts?.[0]}
+ discount={programEnrollment?.discount}
/>
) : (
<div className="h-7 w-5/6 animate-pulse rounded-md bg-neutral-200" />
diff --git a/apps/web/lib/api/programs/get-program-enrollment-or-throw.ts b/apps/web/lib/api/programs/get-program-enrollment-or-throw.ts
index 9b8817dc65..57f5e115c9 100644
--- a/apps/web/lib/api/programs/get-program-enrollment-or-throw.ts
+++ b/apps/web/lib/api/programs/get-program-enrollment-or-throw.ts
@@ -19,6 +19,7 @@ export async function getProgramEnrollmentOrThrow({
include: {
program: true,
link: true,
+ discount: true,
},
})
: await prisma.programEnrollment.findFirst({
@@ -31,6 +32,7 @@ export async function getProgramEnrollmentOrThrow({
include: {
program: true,
link: true,
+ discount: true,
},
});
diff --git a/apps/web/ui/partners/program-commission-description.tsx b/apps/web/ui/partners/program-commission-description.tsx
index 48c47f7cb8..c4cb6e39af 100644
--- a/apps/web/ui/partners/program-commission-description.tsx
+++ b/apps/web/ui/partners/program-commission-description.tsx
@@ -64,9 +64,11 @@ export function ProgramCommissionDescription({
})}
</strong>{" "}
off for{" "}
- {discount.duration
- ? `${discount.duration} ${pluralize(discount.interval || "cycle", discount.duration)}.`
- : "their first purchase."}
+ <strong className={cn("font-semibold", periodClassName)}>
+ {discount.duration
+ ? `${discount.duration} ${pluralize(discount.interval || "cycle", discount.duration)}.`
+ : "their first purchase."}
+ </strong>
</>
) : null}
</>