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.

Updated logic

Marcus Farrell3bc1e1516de5
diff --git a/apps/web/ui/partners/program-reward-description.tsx b/apps/web/ui/partners/program-reward-description.tsx
index e865c80ad4..536de29fc0 100644
--- a/apps/web/ui/partners/program-reward-description.tsx
+++ b/apps/web/ui/partners/program-reward-description.tsx
@@ -30,17 +30,25 @@ export function ProgramRewardDescription({
type: reward.type,
})}{" "}
</strong>
- for each {reward.event}
+ {reward.event === "sale" && reward.maxDuration === 0 ? (
+ <>for the first sale</>
+ ) : (
+ <>per {reward.event}</>
+ )}
{reward.maxDuration === null ? (
+ <>
+ {" "}for the{" "}
<strong className={cn("font-semibold", periodClassName)}>
- {" "}
- for the customer's lifetime.
+ customer's lifetime.
</strong>
+ </>
) : reward.maxDuration && reward.maxDuration > 1 ? (
<>
- , and again{" "}
+ {" "}for{" "}
<strong className={cn("font-semibold", periodClassName)}>
- every month for {reward.maxDuration} months
+ {reward.maxDuration % 12 === 0
+ ? `${reward.maxDuration / 12} year${reward.maxDuration / 12 > 1 ? 's' : ''}`
+ : `${reward.maxDuration} months`}
</strong>
.
</>
diff --git a/apps/web/ui/partners/program-reward-list.tsx b/apps/web/ui/partners/program-reward-list.tsx
index ad7cd2910a..c7008094cf 100644
--- a/apps/web/ui/partners/program-reward-list.tsx
+++ b/apps/web/ui/partners/program-reward-list.tsx
@@ -31,11 +31,26 @@ export function ProgramRewardList({
amount: reward.amount,
type: reward.type,
})}{" "}
- per {reward.event}
+ {reward.event === "sale" && reward.maxDuration === 0 ? (
+ <>for the first sale</>
+ ) : (
+ <>per {reward.event}</>
+ )}
{reward.maxDuration === null ? (
- <> for the customer's lifetime</>
+ <>
+ {" "}for the{" "}
+ <strong className={cn("font-semibold")}>customer's lifetime.</strong>
+ </>
) : reward.maxDuration && reward.maxDuration > 1 ? (
- <>, and again every month for {reward.maxDuration} months</>
+ <>
+ {" "}for{" "}
+ <strong className={cn("font-semibold")}>
+ {reward.maxDuration % 12 === 0
+ ? `${reward.maxDuration / 12} year${reward.maxDuration / 12 > 1 ? 's' : ''}`
+ : `${reward.maxDuration} months`}
+ </strong>
+ .
+ </>
) : null}
</>
)}