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 discount

Steven Teydfe7e5100016
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/page-client.tsx
index f43c27eb90..2f0d21a068 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/page-client.tsx
@@ -48,7 +48,7 @@ export default function ProgramOverviewPageClient() {
<p className="relative text-xl text-white">
<ProgramCommissionDescription
program={program}
- discount={program.discounts[0]}
+ discount={program.discounts?.[0]}
amountClassName="text-blue-400 font-medium"
periodClassName="text-white font-medium"
/>
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 e5992c72f8..3ddbd1a3b7 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
@@ -69,7 +69,10 @@ export default function ProgramPageClient() {
</span>
<div className="relative mt-24 text-lg text-neutral-900 sm:max-w-[50%]">
{program ? (
- <ProgramCommissionDescription program={program} />
+ <ProgramCommissionDescription
+ program={program}
+ discount={programEnrollment?.discount || program.discounts?.[0]}
+ />
) : (
<div className="h-7 w-5/6 animate-pulse rounded-md bg-neutral-200" />
)}
diff --git a/apps/web/lib/zod/schemas/programs.ts b/apps/web/lib/zod/schemas/programs.ts
index ccddc68cea..69d48b36be 100644
--- a/apps/web/lib/zod/schemas/programs.ts
+++ b/apps/web/lib/zod/schemas/programs.ts
@@ -59,6 +59,7 @@ export const ProgramEnrollmentSchema = z.object({
sales: true,
saleAmount: true,
}).nullable(),
+ discount: DiscountSchema.nullish(),
commissionAmount: z.number().nullable(),
createdAt: z.date(),
});
diff --git a/apps/web/ui/partners/program-invite-card.tsx b/apps/web/ui/partners/program-invite-card.tsx
index 3063bdbd7b..8c7b42d513 100644
--- a/apps/web/ui/partners/program-invite-card.tsx
+++ b/apps/web/ui/partners/program-invite-card.tsx
@@ -52,6 +52,7 @@ export function ProgramInviteCard({
<p className="text-balance text-xs text-neutral-600">
<ProgramCommissionDescription
program={invite.program}
+ discount={invite.program.discounts?.[0]}
amountClassName="font-light"
periodClassName="font-light"
/>